@@ -313,26 +313,21 @@ def parse_data(ser, lsl_flag=False, csv_flag=False, gui_flag=False, verbose=Fals
313
313
print ("Process interrupted by user" )
314
314
315
315
finally :
316
- print ("Finally is called!" )
317
316
cleanup ()
318
317
319
- print (f"Exiting. \n Total missing samples: { missing_samples } " )
318
+ print (f"Total missing samples: { missing_samples } " )
320
319
sys .exit (0 )
321
320
322
321
def cleanup ():
323
322
global qApp , ser , lsl_outlet , csv_file
324
- print ("Cleanup function is called!" )
325
323
326
324
# Close the serial connection first
327
325
try :
328
326
if ser is not None and ser .is_open :
329
- print ("Sending STOP to Arduino and closing serial port." )
330
327
send_command (ser , 'STOP' ) # Ensure the STOP command is sent
331
328
time .sleep (1 )
332
329
ser .reset_input_buffer () # Clear the input buffer
333
- print ("Input buffer cleared." )
334
330
ser .reset_output_buffer () # Clear the output buffer
335
- print ("Output buffer cleared." )
336
331
ser .close () # Close the serial port
337
332
print ("Serial connection closed." )
338
333
else :
@@ -365,11 +360,10 @@ def cleanup():
365
360
print (f"Error while closing the GUI: { e } " )
366
361
367
362
print ("Cleanup completed, exiting program." )
368
- print (f"Exiting. \n Total missing samples: { missing_samples } " )
363
+ print (f"Total missing samples: { missing_samples } " )
369
364
sys .exit (0 )
370
365
371
366
def signal_handler (sig , frame ):
372
- print ("Entered into signal handler, Performing cleanup" )
373
367
cleanup ()
374
368
# sys.exit(0)
375
369
0 commit comments