introducing local noise level progressbar

This commit is contained in:
DJ2LS 2023-02-14 15:18:08 +01:00
parent 4395d08a5e
commit 61bb7b7c22
2 changed files with 91 additions and 5 deletions

View file

@ -64,6 +64,8 @@ const hamlib_elements = [
// this is an attempt of reducing CPU LOAD // this is an attempt of reducing CPU LOAD
// we are going to check if we have unequal values before we start calculating again // we are going to check if we have unequal values before we start calculating again
var dbfs_level_raw = 0; var dbfs_level_raw = 0;
var noise_level_raw = 0;
//Global version variable //Global version variable
var appVer = null; var appVer = null;
@ -1881,6 +1883,19 @@ ipcRenderer.on("action-update-tnc-state", (event, arg) => {
dbfscntrl.setAttribute("style", "width:" + dbfs_level + "%;"); dbfscntrl.setAttribute("style", "width:" + dbfs_level + "%;");
} }
// noise / strength
// https://www.moellerstudios.org/converting-amplitude-representations/
if (noise_level_raw != arg.strength) {
noise_level_raw = arg.strength;
noise_level = Math.pow(10, arg.strength / 20) * 100;
document.getElementById("noise_level_value").textContent =
Math.round(arg.strength) + " dB";
var noisecntrl = document.getElementById("noise_level");
noisecntrl.setAttribute("aria-valuenow", noise_level);
noisecntrl.setAttribute("style", "width:" + noise_level + "%;");
}
// SET FREQUENCY // SET FREQUENCY
// https://stackoverflow.com/a/2901298 // https://stackoverflow.com/a/2901298
var freq = arg.frequency.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); var freq = arg.frequency.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
@ -3006,12 +3021,16 @@ function set_CPU_mode() {
if (config.high_graphics.toUpperCase() == "FALSE") { if (config.high_graphics.toUpperCase() == "FALSE") {
toggleClass("dbfs_level", "disable-effects", true); toggleClass("dbfs_level", "disable-effects", true);
toggleClass("dbfs_level", "progress-bar-striped", false); toggleClass("dbfs_level", "progress-bar-striped", false);
toggleClass("noise_level", "disable-effects", true);
toggleClass("noise_level", "progress-bar-striped", false);
toggleClass("waterfall", "disable-effects", true); toggleClass("waterfall", "disable-effects", true);
toggleClass("transmission_progress", "disable-effects", true); toggleClass("transmission_progress", "disable-effects", true);
toggleClass("transmission_progress", "progress-bar-striped", false); toggleClass("transmission_progress", "progress-bar-striped", false);
} else { } else {
toggleClass("dbfs_level", "disable-effects", false); toggleClass("dbfs_level", "disable-effects", false);
toggleClass("dbfs_level", "progress-bar-striped", true); toggleClass("dbfs_level", "progress-bar-striped", true);
toggleClass("noise_level", "disable-effects", false);
toggleClass("noise_level", "progress-bar-striped", true);
toggleClass("waterfall", "disable-effects", false); toggleClass("waterfall", "disable-effects", false);
toggleClass("transmission_progress", "disable-effects", false); toggleClass("transmission_progress", "disable-effects", false);
toggleClass("transmission_progress", "progress-bar-striped", true); toggleClass("transmission_progress", "progress-bar-striped", true);

View file

@ -655,6 +655,65 @@
</button> </button>
</div> </div>
<div class="card-body p-2"> <div class="card-body p-2">
<div class="container">
<div class="row">
<div class="col-sm">
<div class="progress mb-0" style="height: 15px">
<div
class="progress-bar progress-bar-striped bg-primary force-gpu"
id="noise_level"
role="progressbar"
style="width: 0%"
aria-valuenow="0"
aria-valuemin="0"
aria-valuemax="100"
></div>
<p
class="justify-content-center d-flex position-absolute w-100"
id="noise_level_value"
>
S-Meter (dB)
</p>
</div>
<div class="progress mb-0" style="height: 5px">
<div
class="progress-bar progress-bar-striped bg-warning"
role="progressbar"
style="width: 1%"
aria-valuenow="1"
aria-valuemin="0"
aria-valuemax="100"
></div>
<div
class="progress-bar bg-success"
role="progressbar"
style="width: 89%"
aria-valuenow="50"
aria-valuemin="0"
aria-valuemax="100"
></div>
<div
class="progress-bar progress-bar-striped bg-warning"
role="progressbar"
style="width: 20%"
aria-valuenow="20"
aria-valuemin="0"
aria-valuemax="100"
></div>
<div
class="progress-bar progress-bar-striped bg-danger"
role="progressbar"
style="width: 29%"
aria-valuenow="29"
aria-valuemin="0"
aria-valuemax="100"
></div>
</div>
</div>
<div class="col-sm">
<div class="progress mb-0" style="height: 15px"> <div class="progress mb-0" style="height: 15px">
<div <div
class="progress-bar progress-bar-striped bg-primary force-gpu" class="progress-bar progress-bar-striped bg-primary force-gpu"
@ -706,6 +765,14 @@
aria-valuemax="100" aria-valuemax="100"
></div> ></div>
</div> </div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>