DangerKlippers / danger-klipper

Klipper but... Dangerous
GNU General Public License v3.0
199 stars 71 forks source link

Feature request: Improve the way saved variables are managed #87

Open fbeauKmi opened 10 months ago

fbeauKmi commented 10 months ago

Currently, saved variables are stored at the end of the printer.cfg file in an odd structure. In my humble opinion, there are several areas for improvement.

I hope I've made myself clear, thanks for your work!

Piezoid commented 10 months ago
  • Allow values to be overridden (as is alreadyin the rest of the configuration). Indeed, in the case of a distributed configuration, it is currently impossible to perform a SAVE_CONFIG, klipper returns an error, (I don't know the exact mechanism).

In the current state, the saved values override the user values, if we simply remove the check. That's what you want, right?

Maybe we can turn the error into a warning?

  1. Ideally the user should be warned when a overridden value is changed in the manually managed config: "The change to the parameter x has no effect as it is overridden by a saved value". However, this require tracking config changes,
  2. Warn after SAVE_CONFIG: "You might want to remove parameter x which is now overridden by a saved value",
  3. Warn every klippy restart,
  4. 2. but also logs overridden parameters at boot. This could be generalized to duplicate parameters across includes.
fbeauKmi commented 10 months ago

In the current state, the saved values override the user values, if we simply remove the check. That's what you want, right? Yes, it is.

Maybe we can turn the error into a warning?

1. Ideally the user should be warned when a overridden value is changed in the manually managed config: "The change to the parameter x has no effect as it is overridden by a saved value". However, this require tracking config changes,

2. Warn after `SAVE_CONFIG`: "You might want to remove parameter x which is now overridden by a saved value",

3. Warn every klippy restart,

4. `2.` but also logs overridden parameters at boot. This could be generalized to duplicate parameters across includes.

TBH, i didn't think about warnings. Is a setting as allow_saveconfig_to_override : true is possible/good idea ? with default value = false. When false you got the actual behavior, when true, no really need to warn as you know what you do.

MasturMynd commented 6 months ago
  • Allow values to be overridden (as is alreadyin the rest of the configuration). Indeed, in the case of a distributed configuration, it is currently impossible to perform a SAVE_CONFIG, klipper returns an error, (I don't know the exact mechanism). -

Wanted to mention that this portion of the inquiry has been resolved via #153