From 52031b9c3664d7585858059711a7d3655be45156 Mon Sep 17 00:00:00 2001 From: Kevin Jahaziel Leon Morales Date: Sat, 1 Feb 2025 19:48:26 -0600 Subject: [PATCH] fix(liveSpectrumScan.py): Add encoding fail logic --- extras/SX126x_Spectrum_Scan/liveSpectrumScan.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extras/SX126x_Spectrum_Scan/liveSpectrumScan.py b/extras/SX126x_Spectrum_Scan/liveSpectrumScan.py index cd919e9e..7fc92cfb 100644 --- a/extras/SX126x_Spectrum_Scan/liveSpectrumScan.py +++ b/extras/SX126x_Spectrum_Scan/liveSpectrumScan.py @@ -168,8 +168,9 @@ class SpectrumScan: continue self.__data_dissector(bytestream) except serial.SerialException as e: - LOG_ERROR(e) - break + LOG_WARNING(e) + continue + com.reset_input_buffer() com.reset_output_buffer() com.close() @@ -233,6 +234,12 @@ class SpectrumScan: self.start_freq = args.freqStart self.end_freq = args.freqEnd + try: + self.device_uart.open() + except serial.SerialException as e: + LOG_ERROR(e) + return + # Update the initial values with the args values self.delta_freq = int((self.end_freq - self.start_freq) / DEFAULT_STEP_PER_FREQ) self.data_matrix = np.zeros((SCAN_WIDTH, self.delta_freq))