Changed SAVE_CONFIG to update include configs #153
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proceeding under my own merits for #151, regarding #149
This update provides two changes to how autosave data is handled via klipper. The first is that included configs are now updated properly. In order to do this, the second change, a dedicated backups directory has been introduced; the importance of which is covered in further detail below. The backups directory will be created in the default configs directory for the printer.
The choice to make autosaving
include
s the danger option rather than the alternate backups directory is two-fold. Changing the path that a backup is saved to won't have any negative impact given that the path is pulled from klippy itself, then appended with the directory name. Additionally, code complexity and failure risk were considered for both options.I've done my best to provide short but descriptive comments so the code can be easily understood.
More detailed information about the updates:
First is the desire to process included files during SAVE_CONFIG. As I'm sure is known, SAVE_CONFIG in its current state will only apply autosave data to
printer.cfg
. This results in conflicts when something such as PID values are stored in a separate config file. The proposed changes will sift through all of the config files used to instruct machine operation for conflicts with autosave data and comment them out.The second change, the
config_backups
directory, was brought along out of necessity. During testing, @lraithel15133 was using a machine that had all of his additional config files in a single folder. Then, a[include foldername/*.cfg]
was used for simplicity and to ensure that any new config additions were automatically loaded. Since the naming scheme that klipper uses for backing up configs retains the.cfg
extension, the backups saved to thefoldername
directory were loaded via the include block resulting in error from_disallow_include_conflicts
. Rather than change the naming format that klipper uses for backup files and potentially causing issues downstream with mainsail / fluid, the decision was made to add a directory specific for backup configs.