@@ -3492,21 +3492,20 @@ def on_exec(self, args: argparse.Namespace):
34923492 print (f"{ CR } Error: No response from device{ C0 } " )
34933493 return
34943494
3495- print (f"{ CG } Successfully set button wake-up time to { args .set } ms{ C0 } " )
3496-
3497- # Try to save settings to flash
3498- try :
3499- print ("Saving settings to flash..." )
3500- save_resp = self .cmd .save_settings ()
3501- if save_resp and hasattr (save_resp , 'status' ):
3502- if save_resp .status == Status .SUCCESS :
3495+ if resp .status == Status .SUCCESS :
3496+ print (f"{ CG } Successfully set button wake-up time to { args .set } ms{ C0 } " )
3497+
3498+ # Try to save settings to flash
3499+ try :
3500+ save_resp = self .cmd .save_settings ()
3501+ if save_resp and hasattr (save_resp , 'status' ) and save_resp .status == Status .SUCCESS :
35033502 print (f"{ CG } Settings saved to flash memory{ C0 } " )
35043503 else :
3505- print (f"{ CY } Warning: Save failed with status: { Status ( save_resp . status ). name } { C0 } " )
3506- else :
3507- print (f"{ CY } Warning: Invalid response when saving settings{ C0 } " )
3508- except Exception as e :
3509- print (f"{ CY } Warning: Could not save settings : { str ( e ) } { C0 } " )
3504+ print (f"{ CY } Warning: Failed to save settings to flash { C0 } " )
3505+ except Exception as e :
3506+ print (f"{ CY } Warning: Could not save settings: { str ( e ) } { C0 } " )
3507+ else :
3508+ print (f"{ CR } Failed to set wake-up time : { Status ( resp . status ). name } { C0 } " )
35103509
35113510 except Exception as e :
35123511 print (f"{ CR } Error setting wake-up time: { str (e )} { C0 } " )
@@ -3538,25 +3537,25 @@ def on_exec(self, args: argparse.Namespace):
35383537 print (f"[CLI] Setting field detection wake-up time to { args .set } ms" )
35393538 try :
35403539 resp = self .cmd .set_wakeup_field_time (args .set )
3540+
35413541 if resp is None :
35423542 print (f"{ CR } Error: No response from device{ C0 } " )
35433543 return
35443544
3545- print (f"{ CG } Successfully set field detection wake-up time to { args .set } ms{ C0 } " )
3546-
3547- # Try to save settings to flash
3548- try :
3549- print ("Saving settings to flash..." )
3550- save_resp = self .cmd .save_settings ()
3551- if save_resp and hasattr (save_resp , 'status' ):
3552- if save_resp .status == Status .SUCCESS :
3545+ if resp .status == Status .SUCCESS :
3546+ print (f"{ CG } Successfully set field detection wake-up time to { args .set } ms{ C0 } " )
3547+
3548+ # Try to save settings to flash
3549+ try :
3550+ save_resp = self .cmd .save_settings ()
3551+ if save_resp and hasattr (save_resp , 'status' ) and save_resp .status == Status .SUCCESS :
35533552 print (f"{ CG } Settings saved to flash memory{ C0 } " )
35543553 else :
3555- print (f"{ CY } Warning: Save failed with status: { Status ( save_resp . status ). name } { C0 } " )
3556- else :
3557- print (f"{ CY } Warning: Invalid response when saving settings{ C0 } " )
3558- except Exception as e :
3559- print (f"{ CY } Warning: Could not save settings : { str ( e ) } { C0 } " )
3554+ print (f"{ CY } Warning: Failed to save settings to flash { C0 } " )
3555+ except Exception as e :
3556+ print (f"{ CY } Warning: Could not save settings: { str ( e ) } { C0 } " )
3557+ else :
3558+ print (f"{ CR } Failed to set field detection wake-up time : { Status ( resp . status ). name } { C0 } " )
35603559
35613560 except Exception as e :
35623561 print (f"{ CR } Error setting field detection wake-up time: { str (e )} { C0 } " )
0 commit comments