CONFIGFILE: Added BACKUP and RESTART to SAVE_CONFIG

https://github.com/Klipper3d/klipper/pull/4515/files
This commit is contained in:
Nikolay Kopitonenko 2024-02-13 15:44:20 +03:00
parent a77d07907f
commit cfe89d7c63
1 changed files with 4 additions and 2 deletions

View File

@ -416,6 +416,7 @@ class PrinterConfig:
f = open(temp_name, 'w')
f.write(data)
f.close()
if gcmd.get_int('BACKUP', 1):
os.rename(cfgname, backup_name)
os.rename(temp_name, cfgname)
except:
@ -423,4 +424,5 @@ class PrinterConfig:
logging.exception(msg)
raise gcode.error(msg)
# Request a restart
if gcmd.get_int('RESTART', 1):
gcode.request_restart('restart')