Added support for automatically enabling auto adjust waterfall levels - JBG

This commit is contained in:
Jason Gaunt 2021-12-19 17:32:52 +00:00
parent 66492ff40a
commit 5aeed3c670
4 changed files with 17 additions and 3 deletions

View File

@ -73,7 +73,10 @@ var waterfall_min_level_default;
var waterfall_max_level_default; var waterfall_max_level_default;
var waterfall_colors = buildWaterfallColors(['#000', '#FFF']); var waterfall_colors = buildWaterfallColors(['#000', '#FFF']);
var waterfall_auto_levels; var waterfall_auto_levels;
var waterfall_auto_level_default_mode;
var waterfall_auto_min_range; var waterfall_auto_min_range;
var waterfall_measure_minmax_now = false;
var waterfall_measure_minmax_continuous = false;
function buildWaterfallColors(input) { function buildWaterfallColors(input) {
return chroma.scale(input).colors(256, 'rgb') return chroma.scale(input).colors(256, 'rgb')
@ -726,6 +729,12 @@ function on_ws_recv(evt) {
waterfall_auto_levels = config['waterfall_auto_levels']; waterfall_auto_levels = config['waterfall_auto_levels'];
if ('waterfall_auto_min_range' in config) if ('waterfall_auto_min_range' in config)
waterfall_auto_min_range = config['waterfall_auto_min_range']; 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(); waterfallColorsDefault();
var initial_demodulator_params = {}; 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) { 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;

View File

@ -142,6 +142,7 @@ defaultConfig = PropertyLayer(
waterfall_scheme="GoogleTurboWaterfall", waterfall_scheme="GoogleTurboWaterfall",
waterfall_levels=PropertyLayer(min=-88, max=-20), waterfall_levels=PropertyLayer(min=-88, max=-20),
waterfall_auto_levels=PropertyLayer(min=3, max=10), waterfall_auto_levels=PropertyLayer(min=3, max=10),
waterfall_auto_level_default_mode=False,
waterfall_auto_min_range=50, waterfall_auto_min_range=50,
tuning_precision=2, tuning_precision=2,
squelch_auto_margin=10, squelch_auto_margin=10,

View File

@ -129,6 +129,7 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
"waterfall_scheme", "waterfall_scheme",
"waterfall_colors", "waterfall_colors",
"waterfall_auto_levels", "waterfall_auto_levels",
"waterfall_auto_level_default_mode",
"waterfall_auto_min_range", "waterfall_auto_min_range",
"fft_size", "fft_size",
"audio_compression", "audio_compression",

View File

@ -2,6 +2,7 @@ from owrx.controllers.settings import SettingsFormController
from owrx.form.section import Section from owrx.form.section import Section
from owrx.config.core import CoreConfig from owrx.config.core import CoreConfig
from owrx.form.input import ( from owrx.form.input import (
CheckboxInput,
TextInput, TextInput,
NumberInput, NumberInput,
FloatInput, FloatInput,
@ -117,6 +118,11 @@ class GeneralSettingsController(SettingsFormController):
infotext="Specifies the upper and lower dynamic headroom that should be added when automatically " infotext="Specifies the upper and lower dynamic headroom that should be added when automatically "
+ "adjusting waterfall colors", + "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( NumberInput(
"waterfall_auto_min_range", "waterfall_auto_min_range",
"Automatic adjustment minimum range", "Automatic adjustment minimum range",