erase waterfall calibration memory
This commit is contained in:
parent
95ac5aeb7d
commit
f90670f477
@ -83,26 +83,31 @@ var waterfall_colors;
|
|||||||
var waterfall_auto_level_margin;
|
var waterfall_auto_level_margin;
|
||||||
|
|
||||||
function updateWaterfallColors(which) {
|
function updateWaterfallColors(which) {
|
||||||
var wfmax = e("openwebrx-waterfall-color-max");
|
var $wfmax = $("#openwebrx-waterfall-color-max");
|
||||||
var wfmin = e("openwebrx-waterfall-color-min");
|
var $wfmin = $("#openwebrx-waterfall-color-min");
|
||||||
if (parseInt(wfmin.value) >= parseInt(wfmax.value)) {
|
waterfall_max_level = parseInt($wfmax.val());
|
||||||
if (!which) wfmin.value = (parseInt(wfmax.value) - 1).toString();
|
waterfall_min_level = parseInt($wfmin.val());
|
||||||
else wfmax.value = (parseInt(wfmin.value) + 1).toString();
|
if (waterfall_min_level >= waterfall_max_level) {
|
||||||
|
if (!which) {
|
||||||
|
$wfmin.val(waterfall_max_level - 1);
|
||||||
|
waterfall_min_level = waterfall_max_level -1;
|
||||||
|
} else {
|
||||||
|
$wfmax.val(waterfall_min_level + 1);
|
||||||
|
waterfall_max_level = waterfall_min_level + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waterfall_min_level = parseInt(wfmin.value);
|
|
||||||
waterfall_max_level = parseInt(wfmax.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function waterfallColorsDefault() {
|
function waterfallColorsDefault() {
|
||||||
waterfall_min_level = waterfall_min_level_default;
|
waterfall_min_level = waterfall_min_level_default;
|
||||||
waterfall_max_level = waterfall_max_level_default;
|
waterfall_max_level = waterfall_max_level_default;
|
||||||
e("openwebrx-waterfall-color-min").value = waterfall_min_level.toString();
|
$("#openwebrx-waterfall-color-min").val(waterfall_min_level);
|
||||||
e("openwebrx-waterfall-color-max").value = waterfall_max_level.toString();
|
$("#openwebrx-waterfall-color-max").val(waterfall_max_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waterfallColorsAuto() {
|
function waterfallColorsAuto(levels) {
|
||||||
e("openwebrx-waterfall-color-min").value = (waterfall_measure_minmax_min - waterfall_auto_level_margin.min).toString();
|
$("#openwebrx-waterfall-color-min").val(levels.min - waterfall_auto_level_margin.min);
|
||||||
e("openwebrx-waterfall-color-max").value = (waterfall_measure_minmax_max + waterfall_auto_level_margin.max).toString();
|
$("#openwebrx-waterfall-color-max").val(levels.max + waterfall_auto_level_margin.max);
|
||||||
updateWaterfallColors(0);
|
updateWaterfallColors(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,17 +1048,16 @@ function clear_metadata() {
|
|||||||
$(".openwebrx-dmr-timeslot-panel").removeClass("muted");
|
$(".openwebrx-dmr-timeslot-panel").removeClass("muted");
|
||||||
}
|
}
|
||||||
|
|
||||||
var waterfall_measure_minmax = false;
|
|
||||||
var waterfall_measure_minmax_now = false;
|
var waterfall_measure_minmax_now = false;
|
||||||
var waterfall_measure_minmax_min = 1e100;
|
|
||||||
var waterfall_measure_minmax_max = -1e100;
|
|
||||||
|
|
||||||
function waterfall_measure_minmax_do(what) {
|
function waterfall_measure_minmax_do(what) {
|
||||||
// this is based on an oversampling factor of about 1,25
|
// this is based on an oversampling factor of about 1,25
|
||||||
var ignored = .1 * what.length;
|
var ignored = .1 * what.length;
|
||||||
var data = what.slice(ignored, -ignored);
|
var data = what.slice(ignored, -ignored);
|
||||||
waterfall_measure_minmax_min = Math.min(waterfall_measure_minmax_min, Math.min.apply(Math, data));
|
return {
|
||||||
waterfall_measure_minmax_max = Math.max(waterfall_measure_minmax_max, Math.max.apply(Math, data));
|
min: Math.min.apply(Math, data),
|
||||||
|
max: Math.max.apply(Math, data)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_ws_opened() {
|
function on_ws_opened() {
|
||||||
@ -1258,11 +1262,10 @@ function waterfall_add(data) {
|
|||||||
if (!waterfall_setup_done) return;
|
if (!waterfall_setup_done) return;
|
||||||
var w = fft_size;
|
var w = fft_size;
|
||||||
|
|
||||||
if (waterfall_measure_minmax) waterfall_measure_minmax_do(data);
|
|
||||||
if (waterfall_measure_minmax_now) {
|
if (waterfall_measure_minmax_now) {
|
||||||
waterfall_measure_minmax_do(data);
|
var levels = waterfall_measure_minmax_do(data);
|
||||||
waterfall_measure_minmax_now = false;
|
waterfall_measure_minmax_now = false;
|
||||||
waterfallColorsAuto();
|
waterfallColorsAuto(levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add line to waterfall image
|
//Add line to waterfall image
|
||||||
|
Loading…
Reference in New Issue
Block a user