Songguo-PTS200 icon indicating copy to clipboard operation
Songguo-PTS200 copied to clipboard

Issue 19 fix - Doesn't save temp settings

Open dexter323i opened this issue 1 year ago • 5 comments

https://github.com/Eddddddddy/Songguo-PTS200/issues/19

This part causes it at line 612 in Thermostat() function:

if (SetTemp != DefaultTemp) {
    DefaultTemp = SetTemp;  // 把设置里面的默认温度也修改了
    update_default_temp_EEPROM();
}

When user finishes setting up things, and exists to main screen, then updateEEPROM() is called, which saves everything correctly. Even DefaultTemp too! Now normal operation starts, Thermostat() called from loop, but SetTemp won't be equal to DefaultTemp, so DefaultTemp is overwitten with SetTemp, then it is also saved in eeprom. Which is wrong, because it overwrites user's previous DefaultTemp modification.

My fix:

  • In SetupScreen() function there is no reason to store SetTemp value into SaveSetTemp variable, then in the end write it back. Nothing changes SetTemp within this part.
  • But if user changed DefaultTemp then we have to save it to SetTemp too. Because Thermostat() function will be called, and it would overwrite user's previous setting.

dexter323i avatar Nov 25 '23 23:11 dexter323i