fix(liveSpectrumScan.py): Add encoding fail logic

This commit is contained in:
Kevin Jahaziel Leon Morales 2025-02-01 19:48:26 -06:00
parent 00cf0936a5
commit 52031b9c36

View file

@ -168,8 +168,9 @@ class SpectrumScan:
continue continue
self.__data_dissector(bytestream) self.__data_dissector(bytestream)
except serial.SerialException as e: except serial.SerialException as e:
LOG_ERROR(e) LOG_WARNING(e)
break continue
com.reset_input_buffer() com.reset_input_buffer()
com.reset_output_buffer() com.reset_output_buffer()
com.close() com.close()
@ -233,6 +234,12 @@ class SpectrumScan:
self.start_freq = args.freqStart self.start_freq = args.freqStart
self.end_freq = args.freqEnd 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 # Update the initial values with the args values
self.delta_freq = int((self.end_freq - self.start_freq) / DEFAULT_STEP_PER_FREQ) self.delta_freq = int((self.end_freq - self.start_freq) / DEFAULT_STEP_PER_FREQ)
self.data_matrix = np.zeros((SCAN_WIDTH, self.delta_freq)) self.data_matrix = np.zeros((SCAN_WIDTH, self.delta_freq))