diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 39f48d4..d2fb5dc 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -73,7 +73,10 @@ var waterfall_min_level_default; var waterfall_max_level_default; var waterfall_colors = buildWaterfallColors(['#000', '#FFF']); var waterfall_auto_levels; +var waterfall_auto_level_default_mode; var waterfall_auto_min_range; +var waterfall_measure_minmax_now = false; +var waterfall_measure_minmax_continuous = false; function buildWaterfallColors(input) { return chroma.scale(input).colors(256, 'rgb') @@ -726,6 +729,12 @@ function on_ws_recv(evt) { waterfall_auto_levels = config['waterfall_auto_levels']; if ('waterfall_auto_min_range' in config) waterfall_auto_min_range = config['waterfall_auto_min_range']; + if ('waterfall_auto_level_default_mode' in config) + waterfall_measure_minmax_continuous = waterfall_auto_level_default_mode = config['waterfall_auto_level_default_mode']; + var waterfallAutoButton = $('#openwebrx-waterfall-colors-auto'); + waterfallAutoButton[waterfall_measure_minmax_continuous ? 'addClass' : 'removeClass']('highlighted'); + $('#openwebrx-waterfall-color-min, #openwebrx-waterfall-color-max').prop('disabled', waterfall_measure_minmax_continuous); + waterfallColorsDefault(); var initial_demodulator_params = {}; @@ -930,9 +939,6 @@ function on_ws_recv(evt) { } } -var waterfall_measure_minmax_now = false; -var waterfall_measure_minmax_continuous = false; - function waterfall_measure_minmax_do(what) { // this is based on an oversampling factor of about 1,25 var ignored = .1 * what.length; diff --git a/owrx/config/defaults.py b/owrx/config/defaults.py index f03dded..e8c0c84 100644 --- a/owrx/config/defaults.py +++ b/owrx/config/defaults.py @@ -142,6 +142,7 @@ defaultConfig = PropertyLayer( waterfall_scheme="GoogleTurboWaterfall", waterfall_levels=PropertyLayer(min=-88, max=-20), waterfall_auto_levels=PropertyLayer(min=3, max=10), + waterfall_auto_level_default_mode=False, waterfall_auto_min_range=50, tuning_precision=2, squelch_auto_margin=10, diff --git a/owrx/connection.py b/owrx/connection.py index a991eb8..7aaadda 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -129,6 +129,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): "waterfall_scheme", "waterfall_colors", "waterfall_auto_levels", + "waterfall_auto_level_default_mode", "waterfall_auto_min_range", "fft_size", "audio_compression", diff --git a/owrx/controllers/settings/general.py b/owrx/controllers/settings/general.py index e12c101..29e5bc5 100644 --- a/owrx/controllers/settings/general.py +++ b/owrx/controllers/settings/general.py @@ -2,6 +2,7 @@ from owrx.controllers.settings import SettingsFormController from owrx.form.section import Section from owrx.config.core import CoreConfig from owrx.form.input import ( + CheckboxInput, TextInput, NumberInput, FloatInput, @@ -117,6 +118,11 @@ class GeneralSettingsController(SettingsFormController): infotext="Specifies the upper and lower dynamic headroom that should be added when automatically " + "adjusting waterfall colors", ), + CheckboxInput( + "waterfall_auto_level_default_mode", + 'Automatically adjust waterfall level by default', + infotext="Enable this to automatically enable auto adjusting waterfall levels on page load." + ), NumberInput( "waterfall_auto_min_range", "Automatic adjustment minimum range",