-
-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Description
Bug Description
If a motherboard is powered by USB but the main power supply is not powered on, executing M500 will save the wrong values into EEPROM.
My Configurations
Steps to Reproduce
- Use my configuration on an LPC-1768-based board.
- Power board with main power.
- Execute
M502. - Execute
M503and see that there is noM569 S1 T0 Eline in the output. This is the correct behavior. - Execute
M500. - Power down the board, power it up again, execute
M503and see that there still is noM569 S1 T0 Eline. - Power down the board, power it up just via USB, execute
M502followed byM500. - Power down the board, power it up via the main supply. Execute
M503- there will be aM569 S1 T0 Eline.
Expected behavior: [What you expect to happen]
M502 followed by M500 will initialize EEPROM to the values in Configuration.h regardless of whether the TMC drivers have full power.
Actual behavior: [What actually happens]
Executing M502 followed by M500 when board is only powered by USB results in different values in EEPROM than if full power is applied.
Additional Information
It looks like MarlinSettings::save() attempts to fetch the values from the drivers instead of using the cached values that are used by M80 and M122 I to re-initialize the drivers. I noticed this specifically with StealthChop/Spreadcycle but code review shows that other TMC driver configuration values suffer from the same issue.