CONFIGFILE: Added BACKUP and RESTART to SAVE_CONFIG
https://github.com/Klipper3d/klipper/pull/4515/files
This commit is contained in:
parent
a77d07907f
commit
cfe89d7c63
|
@ -416,11 +416,13 @@ class PrinterConfig:
|
|||
f = open(temp_name, 'w')
|
||||
f.write(data)
|
||||
f.close()
|
||||
os.rename(cfgname, backup_name)
|
||||
if gcmd.get_int('BACKUP', 1):
|
||||
os.rename(cfgname, backup_name)
|
||||
os.rename(temp_name, cfgname)
|
||||
except:
|
||||
msg = "Unable to write config file during SAVE_CONFIG"
|
||||
logging.exception(msg)
|
||||
raise gcode.error(msg)
|
||||
# Request a restart
|
||||
gcode.request_restart('restart')
|
||||
if gcmd.get_int('RESTART', 1):
|
||||
gcode.request_restart('restart')
|
||||
|
|
Loading…
Reference in New Issue