Don't update the menu if nothing actually changed.

This commit is contained in:
Chris Giacofei 2022-01-24 11:40:12 -05:00
parent 045d5a8feb
commit 85c710e3b7

View File

@ -14,7 +14,11 @@ void doEncoder()
speed >= 10 ? inc = 5 : inc = 1; speed >= 10 ? inc = 5 : inc = 1;
if (result == DIR_CCW) inc = inc * -1; if (result == DIR_CCW) inc = inc * -1;
} }
SettingChanged = true;
if (KettleController.Mode() == MANUAL) { if (KettleController.Mode() == MANUAL) {
uint8_t KettleDuty = (uint8_t)KettleController.Power(); uint8_t KettleDuty = (uint8_t)KettleController.Power();
KettleDuty = max(0, min((KettleDuty / inc) * inc + inc, 100)); KettleDuty = max(0, min((KettleDuty / inc) * inc + inc, 100));
KettleController.Power((double)KettleDuty); KettleController.Power((double)KettleDuty);
@ -24,9 +28,10 @@ void doEncoder()
uint8_t KettleTemp = (uint8_t)KettleController.Setpoint(); uint8_t KettleTemp = (uint8_t)KettleController.Setpoint();
KettleTemp = max(0, min((KettleTemp / inc) * inc + inc, 220)); KettleTemp = max(0, min((KettleTemp / inc) * inc + inc, 220));
KettleController.Setpoint((double)KettleTemp); KettleController.Setpoint((double)KettleTemp);
}
SettingChanged = true; } else {
SettingChanged = false;
}
} }
// Return a character array to represent the // Return a character array to represent the
@ -64,7 +69,6 @@ char* ShowKettleSetting() {
void UpdateBoilKettle(){ void UpdateBoilKettle(){
if (Enter.pressed()) { if (Enter.pressed()) {
KettleController.CycleMode(); KettleController.CycleMode();
SettingChanged = true; SettingChanged = true;