1
0
forked from me/IronOS

Add auto-repeat to temp adjust

Fixes #285
This commit is contained in:
Ben V. Brown
2018-05-11 13:06:10 +10:00
parent c9a56392a0
commit 48cc1ff8cc

View File

@@ -263,6 +263,8 @@ static void gui_drawBatteryIcon() {
static void gui_solderingTempAdjust() {
uint32_t lastChange = xTaskGetTickCount();
currentlyActiveTemperatureTarget = 0;
uint32_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
for (;;) {
lcd.setCursor(0, 0);
lcd.clearScreen();
@@ -279,10 +281,30 @@ static void gui_solderingTempAdjust() {
return;
break;
case BUTTON_B_LONG:
if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (!lcd.getRotation()) {
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_F_LONG:
if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (!lcd.getRotation()) {
systemSettings.SolderingTemp -= 10;
} else {
systemSettings.SolderingTemp += 10;
}
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_F_SHORT:
if (lcd.getRotation()) {
@@ -301,6 +323,11 @@ static void gui_solderingTempAdjust() {
default:
break;
}
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration)
< PRESS_ACCEL_INTERVAL_MIN) {
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- PRESS_ACCEL_INTERVAL_MIN;
}
// constrain between 50-450 C
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp > 850)