Fix CONFIG_TOGGLE: replace printer.cfg "Session Variables" section in-place instead of appending - #69
Open
paynterf wants to merge 1 commit into
Open
Conversation
Previously the toggle stripped the marked block and appended the new config at the end of printer.cfg. This caused progressive corruption, lost the SAVE_CONFIG position, and dropped the closing #;> marker. The new implementation: - Strictly replaces only the text between (and including) the #;< / #;> markers - Leaves all other content (including SAVE_CONFIG) untouched and in order - Always writes both markers into the config_*.cfg files - Creates a timestamped backup before every toggle - Adds clear error checking for missing/duplicate markers Tested with multiple dock / no-dock round-trips on a Voron 2.4 + MissChanger.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes progressive corruption of
printer.cfgcaused byTOGGLE_CONFIG_MODE/SAVE_CONFIG_MODE.Previous behaviour
#;>marker was dropped when saving.SAVE_CONFIGwas no longer at the bottom and repeated toggles produced growing corruption.New behaviour
#;<…#;>markers.SAVE_CONFIGblock) untouched and in its original order.config_wt_dock.cfg/config_no_dock.cfg.printer.cfgbefore every toggle.Testing
Tested with multiple dock ↔ no-dock round-trips on a Voron 2.4 + MissChanger setup. After any number of toggles the file layout remains stable and
SAVE_CONFIGstays at the bottom.Tested with multiple dock / no-dock round-trips on a Voron 2.4 + MissChanger.
Done almost entirely by SuperGrok, with me a sock-puppet ;).