From 2c5089d18d633a160e77e5755ebc3fb8be3ab61e Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Thu, 19 Jan 2017 17:54:45 +0100 Subject: [PATCH] Added nmux_memory option to config_webrx and added auto calculation of nmux parameters to openwebrx.py. Also bumped version number to 0.15 --- config_webrx.py | 2 ++ openwebrx.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index e402bc1..b6c2d21 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -176,6 +176,8 @@ csdr_dynamic_bufsize = False # This allows you to change the buffering mode of c 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. +nmux_memory = 70 #in megabytes. This sets the approximate size of the circular buffer used by nmux. + #Look up external IP address automatically from icanhazip.com, and use it as [server_hostname] """ print "[openwebrx-config] Detecting external IP address..." diff --git a/openwebrx.py b/openwebrx.py index 92f1876..84f4d66 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -20,7 +20,8 @@ print "" # python2.7 is required to run OpenWebRX instead of python3. Please run along with this program. If not, see . """ -sw_version="v0.14+" +sw_version="v0.15" +#0.15 (added nmux) import os import code @@ -151,7 +152,14 @@ def main(): print "[openwebrx-main] You need to install an up-to-date version of \"csdr\" that contains the \"nmux\" tool to run OpenWebRX! Please upgrade \"csdr\"!\n" return if cfg.start_rtl_thread: - cfg.start_rtl_command += "| nmux -p %d -a 127.0.0.1" % cfg.iq_server_port + nmux_bufcnt = nmux_bufsize = 0 + while nmux_bufsize < cfg.samp_rate/4: nmux_bufsize += 4096 + while nmux_bufsize * nmux_bufcnt < cfg.nmux_memory * 1e6: nmux_bufcnt += 1 + if nmux_bufcnt == 0 or nmux_bufsize == 0: + print "[openwebrx-main] Error: nmux_bufsize or nmux_bufcnt is zero. These depend on nmux_memory and samp_rate options in config_webrx.py" + return + print "[openwebrx-main] nmux_bufsize = %d, nmux_bufcnt = %d" % (nmux_bufsize, nmux_bufcnt) + cfg.start_rtl_command += "| nmux --bufsize %d --bufcnt %d --port %d --address 127.0.0.1" % (nmux_bufsize, nmux_bufcnt, cfg.iq_server_port) rtl_thread=threading.Thread(target = lambda:subprocess.Popen(cfg.start_rtl_command, shell=True), args=()) rtl_thread.start() print "[openwebrx-main] Started rtl_thread: "+cfg.start_rtl_command