diff --git a/config_webrx.py b/config_webrx.py index ea693c1..a2fc5b2 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -117,9 +117,9 @@ To use a HackRF, compile the HackRF host tools from its "stdout" branch: #format_conversion="csdr convert_s16_f | csdr gain_ff 30" # >> /dev/urandom test signal source -#samp_rate = 2400000 -#start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) -#format_conversion="csdr convert_u8_f" +samp_rate = 2400000 +start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +format_conversion="csdr convert_u8_f" # >> Pre-recorded raw I/Q file as signal source # You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. @@ -151,6 +151,12 @@ waterfall_min_level = -115 #in dB waterfall_max_level = 0 #A guide is available to help you set these values: https://github.com/simonyiszk/openwebrx/wiki/Calibrating-waterfall-display-levels +mathbox_waterfall_frequency_resolution = 128 #bins +mathbox_waterfall_history_length = 10 #seconds +mathbox_waterfall_colors = "[0x000000ff,0x2e6893ff, 0x69a5d0ff, 0x214b69ff, 0x9dc4e0ff, 0xfff775ff, 0xff8a8aff, 0xb20000ff]" + + + #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. diff --git a/htdocs/index.wrx b/htdocs/index.wrx index 4a74896..c105280 100644 --- a/htdocs/index.wrx +++ b/htdocs/index.wrx @@ -28,11 +28,14 @@ var ws_url="%[WS_URL]"; var rx_photo_height=%[RX_PHOTO_HEIGHT]; 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 waterfall_colors=%[WATERFALL_COLORS]; var waterfall_min_level_default=%[WATERFALL_MIN_LEVEL]; var waterfall_max_level_default=%[WATERFALL_MAX_LEVEL]; + var mathbox_waterfall_frequency_resolution=%[MATHBOX_WATERFALL_FRES]; + var mathbox_waterfall_history_length=%[MATHBOX_WATERFALL_THIST]; + var mathbox_waterfall_colors=%[MATHBOX_WATERFALL_COLORS]; diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 6d940d0..26afabf 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1659,17 +1659,18 @@ function open_websocket() ws.onerror = on_ws_error; } -function waterfall_mkcolor(db_value) +function waterfall_mkcolor(db_value, waterfall_colors_arg) { + if(typeof waterfall_colors_arg === 'undefined') waterfall_colors_arg = waterfall_colors; 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/(waterfall_colors.length-1); + percent_for_one_color=1/(waterfall_colors_arg.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(waterfall_colors[index+1],waterfall_colors[index],remain); + return color_between(waterfall_colors_arg[index+1],waterfall_colors_arg[index],remain); } function color_between(first, second, percent) @@ -1960,8 +1961,8 @@ var mathbox_element; function mathbox_init() { - mathbox_data_max_depth_time = 10; //sec - mathbox_data_max_depth = fft_fps * mathbox_data_max_depth_time; //how many lines can the buffer store + //mathbox_waterfall_history_length is defined in the config + mathbox_data_max_depth = fft_fps * mathbox_waterfall_history_length; //how many lines can the buffer store mathbox_data_current_depth = 0; //how many lines are in the buffer currently mathbox_data_index = 0; //the index of the last empty line / the line to be overwritten mathbox_data = new Float32Array(fft_size * mathbox_data_max_depth); @@ -2021,7 +2022,7 @@ function mathbox_init() var remap = function(x,z,t) { var currentTimePos = mathbox_data_global_index/(fft_fps*1.0); - var realZAdd = (-(t-currentTimePos)/mathbox_data_max_depth_time); + var realZAdd = (-(t-currentTimePos)/mathbox_waterfall_history_length); var zAdd = realZAdd - mathbox_correction_for_z; if(zAdd<-0.2 || zAdd>0.2) { mathbox_correction_for_z = realZAdd; } @@ -2051,7 +2052,7 @@ function mathbox_init() if((y=remapResult.y)==undefined) return; emit(x, y, z+remapResult.zAdd); }, - width: 128, + width: mathbox_waterfall_frequency_resolution, height: mathbox_data_max_depth - 1, channels: 3, axes: [1, 3], @@ -2061,13 +2062,13 @@ function mathbox_init() expr: function (emit, x, z, i, j, t) { var dBValue; if((dBValue=remap(x,z,t).dBValue)==undefined) return; - var color=waterfall_mkcolor(dBValue); + var color=waterfall_mkcolor(dBValue, mathbox_waterfall_colors); var b = (color&0xff)/255.0; var g = ((color&0xff00)>>8)/255.0; var r = ((color&0xff0000)>>16)/255.0; emit(r, g, b, 1.0); }, - width: 128, + width: mathbox_waterfall_frequency_resolution, height: mathbox_data_max_depth - 1, channels: 4, axes: [1, 3], diff --git a/openwebrx.py b/openwebrx.py index 8f493fe..2c31c26 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -493,7 +493,7 @@ class WebRXHandler(BaseHTTPRequestHandler): if smeter_level == None: break except: break - if smeter_level!=None: + if smeter_level!=None: myclient.loopstat=31 rxws.send(self, "MSG s={0}".format(smeter_level)) @@ -632,7 +632,10 @@ class WebRXHandler(BaseHTTPRequestHandler): ("%[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)) + ("%[WATERFALL_MAX_LEVEL]",str(cfg.waterfall_max_level)), + ("%[MATHBOX_WATERFALL_FRES]",str(cfg.mathbox_waterfall_frequency_resolution)), + ("%[MATHBOX_WATERFALL_THIST]",str(cfg.mathbox_waterfall_history_length)), + ("%[MATHBOX_WATERFALL_COLORS]",cfg.mathbox_waterfall_colors), ) for rule in replace_dictionary: while data.find(rule[0])!=-1: