From 9f9a5ceaa35d374353ed53fa27e88214ec8f0f4f Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 12 Sep 2020 20:36:10 +0200 Subject: [PATCH] implement minimum waterfall range --- config_webrx.py | 2 +- htdocs/openwebrx.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index e0c1810..9e67241 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -262,7 +262,7 @@ waterfall_colors = [0x30123bff, 0x311542ff, 0x33184aff, 0x341b51ff, 0x351e58ff, waterfall_min_level = -88 # in dB 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: # [waterfall_min_level] = [current_min_power_level] - [waterfall_auto_level_margin["min"]] diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index c597e2d..c71c2df 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -104,8 +104,11 @@ function waterfallColorsDefault() { } function waterfallColorsAuto(levels) { - $("#openwebrx-waterfall-color-min").val(levels.min - waterfall_auto_level_margin.min); - $("#openwebrx-waterfall-color-max").val(levels.max + waterfall_auto_level_margin.max); + var min_level = levels.min - waterfall_auto_level_margin.min; + $("#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); }