implement minimum waterfall range

This commit is contained in:
Jakob Ketterl 2020-09-12 20:36:10 +02:00
parent 36cf6097b3
commit 9f9a5ceaa3
2 changed files with 6 additions and 3 deletions

View File

@ -262,7 +262,7 @@ waterfall_colors = [0x30123bff, 0x311542ff, 0x33184aff, 0x341b51ff, 0x351e58ff,
waterfall_min_level = -88 # in dB waterfall_min_level = -88 # in dB
waterfall_max_level = -20 waterfall_max_level = -20
waterfall_auto_level_margin = {"min": 5, "max": 10} waterfall_auto_level_margin = {"min": 3, "max": 10, "min_range": 50}
# Note: When the auto waterfall level button is clicked, the following happens: # Note: When the auto waterfall level button is clicked, the following happens:
# [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin["min"]] # [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin["min"]]

View File

@ -104,8 +104,11 @@ function waterfallColorsDefault() {
} }
function waterfallColorsAuto(levels) { function waterfallColorsAuto(levels) {
$("#openwebrx-waterfall-color-min").val(levels.min - waterfall_auto_level_margin.min); var min_level = levels.min - waterfall_auto_level_margin.min;
$("#openwebrx-waterfall-color-max").val(levels.max + waterfall_auto_level_margin.max); $("#openwebrx-waterfall-color-min").val(min_level);
var max_level = levels.max + waterfall_auto_level_margin.max;
max_level = Math.max(min_level + (waterfall_auto_level_margin.min_range || 0), max_level);
$("#openwebrx-waterfall-color-max").val(max_level);
updateWaterfallColors(0); updateWaterfallColors(0);
} }