restructure config

This commit is contained in:
Jakob Ketterl 2021-03-31 00:00:38 +02:00
parent c6962b4f42
commit 170b720e48
5 changed files with 39 additions and 18 deletions

View File

@ -33,7 +33,7 @@ config_webrx: configuration options for OpenWebRX
"""
# configuration version. please only modify if you're able to perform the associated migration steps.
version = 6
version = 7
# NOTE: you can find additional information about configuring OpenWebRX in the Wiki:
# https://github.com/jketterl/openwebrx/wiki/Configuration-guide
@ -258,15 +258,17 @@ Note: if you experience audio underruns while CPU usage is 100%, you can:
#waterfall_colors = [0x0000FF, 0x00FF00, 0xFF0000]
### Waterfall calibration
#waterfall_levels = {"min": -88, "max": -20} # in dB
waterfall_auto_level_margin = {"min": 3, "max": 10, "min_range": 50}
#waterfall_auto_levels = {"min": -88, "max": -20} # in dB
waterfall_auto_levels = {"min": 3, "max": 10}
waterfall_auto_min_range = 50
# Note: When the auto waterfall level button is clicked, the following happens:
# [waterfall_levels.min] = [current_min_power_level] - [waterfall_auto_level_margin["min"]]
# [waterfall_levels.max] = [current_max_power_level] + [waterfall_auto_level_margin["max"]]
# [waterfall_levels.min] = [current_min_power_level] - [waterfall_auto_levels["min"]]
# [waterfall_levels.max] = [current_max_power_level] + [waterfall_auto_levels["max"]]
#
# ___|________________________________________|____________________________________|________________________________________|___> signal power
# \_waterfall_auto_level_margin["min"]_/ |__ current_min_power_level | \_waterfall_auto_level_margin["max"]_/
# ___|__________________________________|____________________________________|__________________________________|___> signal power
# \_waterfall_auto_levels["min"]_/ |__ current_min_power_level | \_waterfall_auto_levels["max"]_/
# current_max_power_level __|
# This setting allows you to modify the precision of the frequency displays in OpenWebRX.

View File

@ -72,7 +72,8 @@ var waterfall_max_level;
var waterfall_min_level_default;
var waterfall_max_level_default;
var waterfall_colors = buildWaterfallColors(['#000', '#FFF']);
var waterfall_auto_level_margin;
var waterfall_auto_levels;
var waterfall_auto_min_range;
function buildWaterfallColors(input) {
return chroma.scale(input).colors(256, 'rgb')
@ -110,9 +111,9 @@ function waterfallColorsDefault() {
}
function waterfallColorsAuto(levels) {
var min_level = levels.min - waterfall_auto_level_margin.min;
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);
var min_level = levels.min - waterfall_auto_levels.min;
var max_level = levels.max + waterfall_auto_levels.max;
max_level = Math.max(min_level + (waterfall_auto_min_range || 0), max_level);
waterfall_min_level = min_level;
waterfall_max_level = max_level;
updateWaterfallSliders();
@ -721,8 +722,10 @@ function on_ws_recv(evt) {
waterfall_min_level_default = config['waterfall_levels']['min'];
waterfall_max_level_default = config['waterfall_levels']['max'];
}
if ('waterfall_auto_level_margin' in config)
waterfall_auto_level_margin = config['waterfall_auto_level_margin'];
if ('waterfall_auto_levels' in config)
waterfall_auto_levels = config['waterfall_auto_levels'];
if ('waterfall_auto_min_range' in config)
waterfall_auto_min_range = config['waterfall_auto_min_range'];
waterfallColorsDefault();
var initial_demodulator_params = {};

View File

@ -2,7 +2,7 @@ from owrx.property import PropertyLayer
defaultConfig = PropertyLayer(
version=6,
version=7,
max_clients=20,
receiver_name="[Callsign]",
receiver_location="Budapest, Hungary",
@ -142,7 +142,8 @@ defaultConfig = PropertyLayer(
),
waterfall_scheme="GoogleTurboWaterfall",
waterfall_levels=PropertyLayer(min=-88, max=-20),
waterfall_auto_level_margin=PropertyLayer(min=3, max=10, min_range=50),
waterfall_auto_levels=PropertyLayer(min=3, max=10),
waterfall_auto_min_range=50,
tuning_precision=2,
squelch_auto_margin=10,
nmux_memory=50,

View File

@ -1,4 +1,5 @@
from abc import ABC, abstractmethod
from owrx.property import PropertyLayer
import logging
@ -98,14 +99,27 @@ class ConfigMigratorVersion5(ConfigMigrator):
config["version"] = 6
class ConfigMigratorVersion6(ConfigMigrator):
def migrate(self, config):
if "waterfall_auto_level_margin" in config:
walm_config = config["waterfall_auto_level_margin"]
if "min_range" in walm_config:
config["waterfall_auto_min_range"] = walm_config["min_range"]
wal = {k: v for k, v in walm_config.items() if k in ["min", "max"]}
config["waterfall_auto_levels"] = PropertyLayer(**wal)
del config["waterfall_auto_level_margin"]
config["version"] = 7
class Migrator(object):
currentVersion = 6
currentVersion = 7
migrators = {
1: ConfigMigratorVersion1(),
2: ConfigMigratorVersion2(),
3: ConfigMigratorVersion3(),
4: ConfigMigratorVersion4(),
5: ConfigMigratorVersion5(),
6: ConfigMigratorVersion6(),
}
@staticmethod

View File

@ -127,7 +127,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
global_config_keys = [
"waterfall_scheme",
"waterfall_colors",
"waterfall_auto_level_margin",
"waterfall_auto_levels",
"waterfall_auto_min_range",
"fft_size",
"audio_compression",
"fft_compression",