more work to allow seamless config switching
This commit is contained in:
		| @@ -159,7 +159,9 @@ To use a HackRF, compile the HackRF host tools from its "stdout" branch: | ||||
|  | ||||
| # ==== Misc settings ==== | ||||
|  | ||||
| shown_center_freq = center_freq #you can change this if you use an upconverter | ||||
| # you can change this if you use an upconverter. formula is: | ||||
| # shown_center_freq = center_freq + lfo_offset | ||||
| lfo_offset = 0 | ||||
|  | ||||
| client_audio_buffer_size = 5 | ||||
| #increasing client_audio_buffer_size will: | ||||
|   | ||||
							
								
								
									
										13
									
								
								csdr.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								csdr.py
									
									
									
									
									
								
							| @@ -211,8 +211,11 @@ class dsp: | ||||
|         if self.fft_compression=="adpcm": return (self.secondary_fft_size/2)+(10/2) | ||||
|  | ||||
|     def set_samp_rate(self,samp_rate): | ||||
|         #to change this, restart is required | ||||
|         self.samp_rate=samp_rate | ||||
|         self.calculate_decimation() | ||||
|         if self.running: self.restart() | ||||
|  | ||||
|     def calculate_decimation(self): | ||||
|         self.decimation=1 | ||||
|         while self.samp_rate/(self.decimation+1)>self.output_rate: | ||||
|             self.decimation+=1 | ||||
| @@ -229,7 +232,7 @@ class dsp: | ||||
|  | ||||
|     def set_output_rate(self,output_rate): | ||||
|         self.output_rate=output_rate | ||||
|         self.set_samp_rate(self.samp_rate) #as it depends on output_rate | ||||
|         self.calculate_decimation() | ||||
|  | ||||
|     def set_demodulator(self,demodulator): | ||||
|         #to change this, restart is required | ||||
| @@ -314,6 +317,9 @@ class dsp: | ||||
|                 except Exception as e: print("[openwebrx-dsp-plugin:csdr] try_delete_pipes() ::", e) | ||||
|  | ||||
|     def start(self): | ||||
|         if (self.running): return | ||||
|         self.running = True | ||||
|  | ||||
|         command_base=self.chain(self.demodulator) | ||||
|  | ||||
|         #create control pipes for csdr | ||||
| @@ -363,8 +369,6 @@ class dsp: | ||||
|  | ||||
|         threading.Thread(target = watch_thread).start() | ||||
|  | ||||
|         self.running = True | ||||
|  | ||||
|         #open control pipes for csdr and send initialization data | ||||
|         if self.bpf_pipe != None: | ||||
|             self.bpf_pipe_file=open(self.bpf_pipe,"w") | ||||
| @@ -422,6 +426,7 @@ class dsp: | ||||
|             # except: print "[openwebrx-dsp-plugin:csdr] stop() :: unlink failed: " + self.iqtee2_pipe | ||||
|  | ||||
|     def restart(self): | ||||
|         if not self.running: return | ||||
|         self.stop() | ||||
|         self.start() | ||||
|  | ||||
|   | ||||
| @@ -1172,7 +1172,7 @@ function on_ws_recv(evt) | ||||
|                         window.starting_offset_frequency = config.start_offset_frequency; | ||||
|                         window.audio_buffering_fill_to = config.client_audio_buffer_size; | ||||
|                         bandwidth = config.samp_rate; | ||||
|                         center_freq = config.shown_center_freq; | ||||
|                         center_freq = config.center_freq + config.lfo_offset; | ||||
|                         fft_size = config.fft_size; | ||||
| 						fft_fps = config.fft_fps; | ||||
| 						audio_compression = config.audio_compression; | ||||
| @@ -1183,7 +1183,7 @@ function on_ws_recv(evt) | ||||
| 						waterfall_init(); | ||||
| 						audio_preinit(); | ||||
|  | ||||
| 						if (audio_allowed) audio_init(); | ||||
| 						if (audio_allowed && !audio_initialized) audio_init(); | ||||
| 						waterfall_clear(); | ||||
|                     break; | ||||
|                     case "secondary_config": | ||||
|   | ||||
| @@ -85,7 +85,7 @@ class WebSocketMessageHandler(object): | ||||
|             self.client = OpenWebRxClient(conn) | ||||
|  | ||||
|             config_keys = ["waterfall_colors", "waterfall_min_level", "waterfall_max_level", | ||||
|                            "waterfall_auto_level_margin", "shown_center_freq", "samp_rate", "fft_size", "fft_fps", | ||||
|                            "waterfall_auto_level_margin", "lfo_offset", "samp_rate", "fft_size", "fft_fps", | ||||
|                            "audio_compression", "fft_compression", "max_clients", "start_mod", | ||||
|                            "client_audio_buffer_size", "start_freq", "center_freq"] | ||||
|  | ||||
|   | ||||
| @@ -34,17 +34,17 @@ class RtlNmuxSource(object): | ||||
|             self.start() | ||||
|         props.wire(restart) | ||||
|  | ||||
|         featureDetector = FeatureDetector() | ||||
|         if not featureDetector.is_available(props["rtl_type"]): | ||||
|             print("The RTL source type {0} is not available. please check requirements.".format(props["rtl_type"])) | ||||
|             return | ||||
|  | ||||
|         self.start() | ||||
|  | ||||
|     def start(self): | ||||
|  | ||||
|         props = self.props | ||||
|  | ||||
|         featureDetector = FeatureDetector() | ||||
|         if not featureDetector.is_available(props["rtl_type"]): | ||||
|             print("The RTL source type {0} is not available. please check requirements.".format(props["rtl_type"])) | ||||
|             return | ||||
|  | ||||
|         params = RtlNmuxSource.types[props["rtl_type"]] | ||||
|  | ||||
|         start_sdr_command = params["command"].format( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jakob Ketterl
					Jakob Ketterl