[FR] SAVE_CONFIG without restarting the machine

I would like to see a usefull (as for me) feature to be able to update printer.cfg without restarting firmware. It will be usefull for example for adjusting z offset on-the-fly: start a print->fine tune z offset to get perfect first layer->save offset to a config without interrupting the print process. With this feature one will not forget to update config after print finish

1 Like

Hello @yzheka !

If you have a screen with the printer, you should get the z-offset tuned in there on the fly.

Correct. But i would like to save adjusted value to a config file without restarting the firmware while printing is in progress

That is not possible because every change in the printer.cfg requires as firmware restart.
But what is the problem to save it after the print?

I Often forget to do it and i have auto shutdown in my end gcode. In fluidd i can edit and save printer.cfg while printing is in progress without firmware restart

You may add this to your end code:

Z_OFFSET_APPLY_ENDSTOP ; if you have a usual endstop.
Z_OFFSET_APPLY_PROBE ; if you have a BLtouch or similar)


Ok. Looks like the only way to solve it. But anyway I don’t want to save config everytime the print is finished. Thank you for your help, but i guess I will stay on manual editing of the printer.cfg

1 Like

I also would like to see such feature. In many cases, the config change is actually already active before the restart, so saving the config merely makes the config matching the running configuration. The Z offset tuning is apparently one example, another is the bed mesh calibration. I am using my printer also as a CNC mill, in which case I need to determine an X/Y origin quite precisely. In my workflow, I typically perform a “bed mesh calibration” to probe the surface of the workpart after determining the X/Y origin. Restarting the firmware at that point means losing homing of the X/Y axes, which reduces the precision of the origin by the repeat accuracy of the respective end stops (resp. forces me to redo the procedure). Having some command to just store the new config file without restarting and hence without re-interpreting it would be very helpful and time saving.

I cannot imagine there is a technical show stopper to implement this.

I can understand the want to restart to verify everything stuck. So I kept it as the default operation and just added a parameter on my local install.
So using SAVE_CONFIG NORESTART=1 just saves the config. I even set the save_config_pending back to false. I also sudo this feature as a M500 in my config… in my quest to try and keep some things common with my duet board running RepRap. ^^

If you want a quick code snippet to do this in configfile.py at ther very end of the file in the def cmd_SAVE_CONFIG(self, gcmd): replace.

# Request a restart


# If requested restart or no restart just flag config saved
restartTest = gcmd.get_int(‘NO_RESTART’, None)
if restartTest is None or restartTest != 1:
# Request a restart
# flag config updated to false since config saved with no restart
self.save_config_pending = False
gcode.respond_info(“Config File update without restart successful”)

I honestly have no idea the implication of not restarting because all the settings i care about like delta config write to the config file object and just forcing a file write before i start printing in case something hits the fan seems pretty benign to me. I also don’t know if its even worth a pull request based on the comments here. Take care.


No, it is not worth a pull request, unless sentiment has shifted:

CONFIGFILE: Added BACKUP and RESTART to SAVE_CONFIG by randellhodges · Pull Request #4515 · Klipper3d/klipper (github.com)

Another vote to this request. I have the save_config in the print_end macro, but it messes with other stuff, like my Octoprint plugin that shutdowns the printer after the print end. Octoprint interprets the reset as an error due to the lost communication and stops everything else. Klipper commands are very straight foward in many ways but this one is different. In my opinion SAVE_CONFIG should just save the configuration, or at least, should allow us to avoid the reset.

You can set the behaviour of OctoPrint in that case:

Thanks, I didn’t knew that configuration, but I don’t want to loose the disconnection error report on other disconnection events.