Skip to content

Fix CONFIG_TOGGLE: replace printer.cfg "Session Variables" section in-place instead of appending - #69

Open
paynterf wants to merge 1 commit into
VIN-y:mainfrom
paynterf:fix-config-switch-in-place
Open

Fix CONFIG_TOGGLE: replace printer.cfg "Session Variables" section in-place instead of appending#69
paynterf wants to merge 1 commit into
VIN-y:mainfrom
paynterf:fix-config-switch-in-place

Conversation

@paynterf

Copy link
Copy Markdown

Summary

Fixes progressive corruption of printer.cfg caused by TOGGLE_CONFIG_MODE / SAVE_CONFIG_MODE.

Previous behaviour

  • The toggle stripped the marked section and appended the new config at the end of the file.
  • The closing #;> marker was dropped when saving.
  • After the first toggle, SAVE_CONFIG was no longer at the bottom and repeated toggles produced growing corruption.

New behaviour

  • Strictly replaces only the text between (and including) the #;<#;> markers.
  • Leaves all other content (including the SAVE_CONFIG block) untouched and in its original order.
  • Always writes both markers into config_wt_dock.cfg / config_no_dock.cfg.
  • Creates a timestamped backup of printer.cfg before every toggle.
  • Adds clear error checking for missing or duplicate markers.

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_CONFIG stays 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 ;).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant