From ab6d71ef368603ea77864def05eaf0da867c45cc Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Sat, 19 Mar 2016 00:11:40 +0100 Subject: [PATCH] Make waterfall colors and levels easily accessible from config. --- config_webrx.py | 5 +++++ htdocs/index.wrx | 3 +++ htdocs/openwebrx.js | 25 ++++++------------------- openwebrx.py | 5 ++++- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index eb8641a..02f17b7 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -131,7 +131,12 @@ iq_server_port = 4951 #TCP port for ncat to listen on. It will send I/Q data ove #access_log = "~/openwebrx_access.log" +waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" +waterfall_min_level = -115 #in dB +waterfall_max_level = 0 + #Warning! The settings below are very experimental. csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. csdr_print_bufsizes = False # This prints the buffer sizes used for csdr processes. csdr_through = False # Setting this True will print out how much data is going into the DSP chains. + diff --git a/htdocs/index.wrx b/htdocs/index.wrx index 73e6d25..c0dc4cf 100644 --- a/htdocs/index.wrx +++ b/htdocs/index.wrx @@ -30,6 +30,9 @@ var audio_buffering_fill_to=%[AUDIO_BUFSIZE]; var starting_mod = "%[START_MOD]"; var starting_offset_frequency = %[START_OFFSET_FREQ]; + var waterfall_colors=%[WATERFALL_COLORS]; + var waterfall_min_level=%[WATERFALL_MIN_LEVEL]; + var waterfall_max_level=%[WATERFALL_MAX_LEVEL]; diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index c596744..eaf7bdf 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1534,30 +1534,17 @@ function open_websocket() ws.onerror = on_ws_error; } -//var color_scale=[0xFFFFFFFF, 0x000000FF]; -//var color_scale=[0x000000FF, 0x000000FF, 0x3a0090ff, 0x10c400ff, 0xffef00ff, 0xff5656ff]; -//var color_scale=[0x000000FF, 0x000000FF, 0x534b37ff, 0xcedffaff, 0x8899a9ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]; - -//var color_scale=[ 0x000000FF, 0xff5656ff, 0xffffffff]; - -//2014-04-22 -var color_scale=[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff] -//2015-04-10 -//var color_scale=[0x112634ff,0x4991c6ff,0x18364cff,0x9dc4e0ff,0xfff775ff,0xff9f60,0xff4d4dff,0x8d0000ff]; - function waterfall_mkcolor(db_value) { - min_value=-115; //in dB - max_value=0; - if(db_valuemax_value) db_value=max_value; - full_scale=max_value-min_value; - relative_value=db_value-min_value; + if(db_valuewaterfall_max_level) db_value=waterfall_max_level; + full_scale=waterfall_max_level-waterfall_min_level; + relative_value=db_value-waterfall_min_level; value_percent=relative_value/full_scale; - percent_for_one_color=1/(color_scale.length-1); + percent_for_one_color=1/(waterfall_colors.length-1); index=Math.floor(value_percent/percent_for_one_color); remain=(value_percent-percent_for_one_color*index)/percent_for_one_color; - return color_between(color_scale[index+1],color_scale[index],remain); + return color_between(waterfall_colors[index+1],waterfall_colors[index],remain); } function color_between(first, second, percent) diff --git a/openwebrx.py b/openwebrx.py index ebf409c..d153ff8 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -577,7 +577,10 @@ class WebRXHandler(BaseHTTPRequestHandler): ("%[RX_DEVICE]",cfg.receiver_device), ("%[AUDIO_BUFSIZE]",str(cfg.client_audio_buffer_size)), ("%[START_OFFSET_FREQ]",str(cfg.start_freq-cfg.center_freq)), - ("%[START_MOD]",cfg.start_mod) + ("%[START_MOD]",cfg.start_mod), + ("%[WATERFALL_COLORS]",cfg.waterfall_colors), + ("%[WATERFALL_MIN_LEVEL]",str(cfg.waterfall_min_level)), + ("%[WATERFALL_MAX_LEVEL]",str(cfg.waterfall_max_level)) ) for rule in replace_dictionary: while data.find(rule[0])!=-1: