1
0
forked from me/IronOS

Stop adjust buttons auto-rotating

Closes #270
This commit is contained in:
Ben V. Brown
2018-07-29 11:57:24 +10:00
parent 8ddfa0e275
commit f716578138
2 changed files with 25 additions and 34 deletions

View File

@@ -6,7 +6,7 @@
*/ */
#include "Translation.h" #include "Translation.h"
#ifndef LANG #ifndef LANG
#define LANG_FR #define LANG_EN
#endif #endif
// TEMPLATES for short names - choose one and use it as base for your // TEMPLATES for short names - choose one and use it as base for your
// translation: // translation:

View File

@@ -283,42 +283,24 @@ static void gui_solderingTempAdjust() {
case BUTTON_B_LONG: case BUTTON_B_LONG:
if (xTaskGetTickCount() - autoRepeatTimer if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) { + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (!lcd.getRotation()) { systemSettings.SolderingTemp -= 10; // sub 10
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
autoRepeatTimer = xTaskGetTickCount(); autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
} }
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
if (xTaskGetTickCount() - autoRepeatTimer if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) { + autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (!lcd.getRotation()) { systemSettings.SolderingTemp += 10;
systemSettings.SolderingTemp -= 10;
} else {
systemSettings.SolderingTemp += 10;
}
autoRepeatTimer = xTaskGetTickCount(); autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
} }
break; break;
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
if (lcd.getRotation()) { systemSettings.SolderingTemp += 10; // add 10
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
break; break;
case BUTTON_B_SHORT: case BUTTON_B_SHORT:
if (!lcd.getRotation()) { systemSettings.SolderingTemp -= 10; // sub 10
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
break; break;
default: default:
break; break;
@@ -347,7 +329,12 @@ static void gui_solderingTempAdjust() {
if (xTaskGetTickCount() - lastChange > 200) if (xTaskGetTickCount() - lastChange > 200)
return; // exit if user just doesn't press anything for a bit return; // exit if user just doesn't press anything for a bit
lcd.drawChar('-');
if (lcd.getRotation())
lcd.drawChar('-');
else
lcd.drawChar('+');
lcd.drawChar(' '); lcd.drawChar(' ');
lcd.printNumber(systemSettings.SolderingTemp, 3); lcd.printNumber(systemSettings.SolderingTemp, 3);
if (systemSettings.temperatureInF) if (systemSettings.temperatureInF)
@@ -355,7 +342,10 @@ static void gui_solderingTempAdjust() {
else else
lcd.drawSymbol(1); lcd.drawSymbol(1);
lcd.drawChar(' '); lcd.drawChar(' ');
lcd.drawChar('+'); if (lcd.getRotation())
lcd.drawChar('+');
else
lcd.drawChar('-');
lcd.refresh(); lcd.refresh();
GUIDelay(); GUIDelay();
} }
@@ -440,14 +430,15 @@ static void display_countdown(int sleepThres) {
* Print seconds or minutes (if > 99 seconds) until sleep * Print seconds or minutes (if > 99 seconds) until sleep
* mode is triggered. * mode is triggered.
*/ */
int lastEventTime = lastButtonTime < lastMovementTime ? int lastEventTime =
lastMovementTime : lastButtonTime; lastButtonTime < lastMovementTime ?
lastMovementTime : lastButtonTime;
int downCount = sleepThres - xTaskGetTickCount() + lastEventTime; int downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
if (downCount > 9900) { if (downCount > 9900) {
lcd.printNumber(downCount/6000 + 1, 2); lcd.printNumber(downCount / 6000 + 1, 2);
lcd.print("M"); lcd.print("M");
} else { } else {
lcd.printNumber(downCount/100 + 1, 2); lcd.printNumber(downCount / 100 + 1, 2);
lcd.print("S"); lcd.print("S");
} }
} }
@@ -522,8 +513,7 @@ static void gui_solderingMode() {
lcd.printNumber(getTipPWM(), 3); lcd.printNumber(getTipPWM(), 3);
lcd.print("%"); lcd.print("%");
if (systemSettings.sensitivity && systemSettings.SleepTime) if (systemSettings.sensitivity && systemSettings.SleepTime) {
{
lcd.print(" "); lcd.print(" ");
display_countdown(sleepThres); display_countdown(sleepThres);
} }
@@ -605,7 +595,8 @@ static void gui_solderingMode() {
} }
static const char *HEADERS[] = { static const char *HEADERS[] = {
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ","Rtip: ","Ctip: ","Vin :" }; __DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
"Ctip: ", "Vin :" };
void showVersion(void) { void showVersion(void) {
uint8_t screen = 0; uint8_t screen = 0;
@@ -638,10 +629,10 @@ void showVersion(void) {
lcd.printNumber(lastMovementTime / 100, 5); lcd.printNumber(lastMovementTime / 100, 5);
break; break;
case 7: case 7:
lcd.printNumber(getTipRawTemp(0),5); lcd.printNumber(getTipRawTemp(0), 5);
break; break;
case 8: case 8:
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)),5); lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
break; break;
case 9: case 9:
printVoltage(); printVoltage();