diff --git a/README.md b/README.md index abb0672b3..f77489abb 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ If I want my printer to light itself on fire, I should be able to make my printe - [filament_switch|motion_sensor: runout distance, smart and runout gcode](https://github.com/DangerKlippers/danger-klipper/pull/158) +- [save_config: save without restarting the firmware](https://github.com/DangerKlippers/danger-klipper/pull/191) + - [configfile: recursive globs](https://github.com/DangerKlippers/danger-klipper/pull/200) / ([klipper#6375](https://github.com/Klipper3d/klipper/pull/6375)) If you're feeling adventurous, take a peek at the extra features in the bleeding-edge branch [feature documentation](docs/Bleeding_Edge.md) diff --git a/docs/G-Codes.md b/docs/G-Codes.md index c501d7e89..5fb72b10f 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -291,10 +291,11 @@ EEPROM of a BLTouch V3.1 Available output_modes are: `5V`, `OD` The configfile module is automatically loaded. #### SAVE_CONFIG -`SAVE_CONFIG`: This command will overwrite the main printer config +`SAVE_CONFIG [RESTART=0|1]`: This command will overwrite the main printer config file and restart the host software. This command is used in conjunction with other calibration commands to store the results of calibration tests. +If RESTART is set to 0, no restart will be performed !!USE WITH CAUTION!!. ### [delayed_gcode] diff --git a/klippy/configfile.py b/klippy/configfile.py index b715d93dd..e8fe649f0 100644 --- a/klippy/configfile.py +++ b/klippy/configfile.py @@ -696,5 +696,12 @@ def cmd_SAVE_CONFIG(self, gcmd): data = regular_data.rstrip() + autosave_data self._write_backup(cfgname, data, gcode) - # Request a restart - gcode.request_restart("restart") + # If requested restart or no restart just flag config saved + require_restart = gcmd.get_int("RESTART", 1, minval=0, maxval=1) + if require_restart: + # Request a restart + gcode.request_restart("restart") + else: + # flag config updated to false since config saved with no restart + self.save_config_pending = False + gcode.respond_info("Config update without restart successful") diff --git a/test/klippy/danger_options.test b/test/klippy/danger_options.test index c886479e9..e674e35e8 100644 --- a/test/klippy/danger_options.test +++ b/test/klippy/danger_options.test @@ -12,3 +12,7 @@ G1 X1 G1 Y1 SAVE_CONFIG + +SAVE_CONFIG RESTART=0 + +SAVE_CONFIG RESTART=1