Make waterfall colors and levels easily accessible from config.

This commit is contained in:
ha7ilm 2016-03-19 00:11:40 +01:00
parent c6b50e81f9
commit ab6d71ef36
4 changed files with 18 additions and 20 deletions

View File

@ -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" #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. #Warning! The settings below are very experimental.
csdr_dynamic_bufsize = False # This allows you to change the buffering mode of csdr. 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_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. csdr_through = False # Setting this True will print out how much data is going into the DSP chains.

View File

@ -30,6 +30,9 @@
var audio_buffering_fill_to=%[AUDIO_BUFSIZE]; var audio_buffering_fill_to=%[AUDIO_BUFSIZE];
var starting_mod = "%[START_MOD]"; var starting_mod = "%[START_MOD]";
var starting_offset_frequency = %[START_OFFSET_FREQ]; 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];
</script> </script>
<script src="sdr.js"></script> <script src="sdr.js"></script>
<script src="openwebrx.js"></script> <script src="openwebrx.js"></script>

View File

@ -1534,30 +1534,17 @@ function open_websocket()
ws.onerror = on_ws_error; 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) function waterfall_mkcolor(db_value)
{ {
min_value=-115; //in dB if(db_value<waterfall_min_level) db_value=waterfall_min_level;
max_value=0; if(db_value>waterfall_max_level) db_value=waterfall_max_level;
if(db_value<min_value) db_value=min_value; full_scale=waterfall_max_level-waterfall_min_level;
if(db_value>max_value) db_value=max_value; relative_value=db_value-waterfall_min_level;
full_scale=max_value-min_value;
relative_value=db_value-min_value;
value_percent=relative_value/full_scale; 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); index=Math.floor(value_percent/percent_for_one_color);
remain=(value_percent-percent_for_one_color*index)/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) function color_between(first, second, percent)

View File

@ -577,7 +577,10 @@ class WebRXHandler(BaseHTTPRequestHandler):
("%[RX_DEVICE]",cfg.receiver_device), ("%[RX_DEVICE]",cfg.receiver_device),
("%[AUDIO_BUFSIZE]",str(cfg.client_audio_buffer_size)), ("%[AUDIO_BUFSIZE]",str(cfg.client_audio_buffer_size)),
("%[START_OFFSET_FREQ]",str(cfg.start_freq-cfg.center_freq)), ("%[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: for rule in replace_dictionary:
while data.find(rule[0])!=-1: while data.find(rule[0])!=-1: