mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Unify behavior of menu items with questions/warnings (#157)
This commit is contained in:
committed by
Ben V. Brown
parent
4c0ba72542
commit
538a741912
@@ -20,6 +20,7 @@ extern const enum ShortNameType SettingsShortNameType;
|
||||
extern const char* SettingsShortNames[16][2];
|
||||
extern const char* SettingsLongNames[16];
|
||||
extern const char* SettingsCalibrationWarning;
|
||||
extern const char* SettingsResetWarning;
|
||||
extern const char* UVLOWarningString;
|
||||
extern const char* SleepingSimpleString;
|
||||
extern const char* SleepingAdvancedString;
|
||||
@@ -32,5 +33,6 @@ extern const char SettingRightChar;
|
||||
extern const char SettingLeftChar;
|
||||
extern const char SettingAutoChar;
|
||||
|
||||
#define LANG_CS_CZ
|
||||
|
||||
#endif /* TRANSLATION_H_ */
|
||||
|
||||
@@ -28,6 +28,6 @@ typedef struct {
|
||||
const state_func draw;
|
||||
} menuitem;
|
||||
|
||||
extern bool settingsResetRequest;
|
||||
extern const menuitem settingsMenu[];
|
||||
|
||||
#endif /* GUI_H_ */
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#include <MMA8652FC.hpp>
|
||||
#include "Setup.h"
|
||||
#include "OLED.hpp"
|
||||
|
||||
extern OLED lcd;
|
||||
extern MMA8652FC accel;
|
||||
|
||||
enum ButtonState {
|
||||
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
|
||||
BUTTON_F_SHORT = 1, /* User has pressed the front button*/
|
||||
@@ -20,6 +22,8 @@ enum ButtonState {
|
||||
* holding means it has gone low, and been low for longer than filter time
|
||||
*/
|
||||
};
|
||||
|
||||
ButtonState getButtonState();
|
||||
void waitForButtonPressOrTimeout(uint32_t timeout);
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
|
||||
@@ -78,8 +78,8 @@ const char* SettingsLongNames[16] =
|
||||
/* Calibrate input voltage */"VIN Calibration. Buttons adjust, long press to exit",
|
||||
/* Advanced soldering screen enabled */"Display detailed information while soldering", };
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars
|
||||
@@ -139,9 +139,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Показывать детальную информацию при пайке.",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Убедитесь, что жало остыло до комнатной температуры, прежде чем "
|
||||
"продолжать!";
|
||||
const char* SettingsCalibrationWarning = "Убедитесь, что жало остыло до комнатной температуры, прежде чем продолжать!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "БАТ РАЗР"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Хррр"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Ожидание..."; // <=17 chars
|
||||
@@ -203,8 +202,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Display detailed information while soldering",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars
|
||||
@@ -260,8 +259,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Display detailed information while soldering",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars
|
||||
@@ -317,9 +316,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Mostra informazioni dettagliate mentre stai saldando",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Assicurati che la punta si trovi a temperatura ambiente prima di "
|
||||
"continuare!";
|
||||
const char* SettingsCalibrationWarning = "Assicurati che la punta si trovi a temperatura ambiente prima di continuare!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Standby"; // <=17 chars
|
||||
@@ -375,8 +373,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Afficher des informations detaillees pendant la soudure",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars
|
||||
@@ -432,8 +430,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Detaillierte Anzeige im Lötmodus <T=An, F=Aus>",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!";
|
||||
const char* SettingsCalibrationWarning = "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzz "; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Ruhemodus..."; // <=17 chars
|
||||
@@ -489,8 +487,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Zobrazenie detailov pocas spajkovania <T=Zap, F=Vyp>",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Najprv sa prosim uistite, ze hrot ma izbovu teplotu!";
|
||||
const char* SettingsCalibrationWarning = "Najprv sa prosim uistite, ze hrot ma izbovu teplotu!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Chrr"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Kludovy rezim..."; // <=17 chars
|
||||
@@ -546,8 +544,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Lehimleme yaparken detaylı bilgi göster",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Lütfen devam etmeden önce ucun oda sıcaklığında olduğunu garantiye alın!";
|
||||
const char* SettingsCalibrationWarning = "Lütfen devam etmeden önce ucun oda sıcaklığında olduğunu garantiye alın!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Uyuyor..."; // <=17 chars
|
||||
@@ -603,9 +601,8 @@ const char* SettingsLongNames[16] = {
|
||||
/* Advanced soldering screen enabled */"Prikazivanje detaljnih informacija tijekom lemljenja.",
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Provjerite da je vršak ohlađen na sobnu temperaturu prije nego što "
|
||||
"nastavite!";
|
||||
const char* SettingsCalibrationWarning = "Provjerite da je vršak ohlađen na sobnu temperaturu prije nego što nastavite!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "NAPON!!!"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Spavanje..."; // <=17 chars
|
||||
@@ -650,16 +647,13 @@ const char* SettingsLongNames[16] = {
|
||||
"Cas do automatickeho vypnuti <Minut>", // Shutdown Time
|
||||
"Citlivost detekce pohybu <0=Vyp, 1=Min, ... 9=Max>", // Motion Sensitivity
|
||||
"Jednotky mereni teploty <C=Celsius, F=Fahrenheit>", // Temp Unit
|
||||
"Zobrazit podrobnosti na vychozi obrazovce <Z=Zap, V=Vyp>", // Detailed
|
||||
// Information
|
||||
"Zobrazit podrobnosti na vychozi obrazovce <Z=Zap, V=Vyp>", // Detailed Information
|
||||
"Otoceni displaye <A=Auto, L=Levak, P=Pravak>", // Orientation
|
||||
"Povolit boost drzenim leveho tlacitka pri pajeni <Z=Zap, V=Vyp>", // Boost
|
||||
// enable
|
||||
"Teplota pri boostu", // Boost Temp
|
||||
"Pri startu ihned nahrivat hrot <Z=Zap, V=Vyp, S=Rezim spanku>", // Auto
|
||||
// start
|
||||
"Blikani teploty pri chladnuti, dokud je hrot horky <Z=Zap, V=Vyp>", // Cooling
|
||||
// Blink
|
||||
"Pri startu ihned nahrivat hrot <Z=Zap, V=Vyp, S=Rezim spanku>", // Auto start
|
||||
"Blikani teploty pri chladnuti, dokud je hrot horky <Z=Zap, V=Vyp>", // Cooling Blink
|
||||
"Kalibrovat mereni teploty", // Calibrate Tip
|
||||
"Obnovit tovarni nastaveni", // Reset Settings
|
||||
"Kalibrovat vstupni napeti. Tlacitky upravte, podrzenim potvrdte.", // VIN
|
||||
@@ -667,8 +661,8 @@ const char* SettingsLongNames[16] = {
|
||||
"Zobrazit podrobnosti pri pajeni <Z=Zap, V=Vyp>", // ADV SLD
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Ujistete se, ze hrot ma pokojovou teplotu! "; // ending space needed
|
||||
const char* SettingsCalibrationWarning = "Ujistete se, ze hrot ma pokojovou teplotu! "; // ending space needed
|
||||
const char* SettingsResetWarning = "Opravdu chcete resetovat zarizeni do tovarniho nastaveni?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzz "; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Rezim spanku..."; // <=17 chars
|
||||
@@ -687,23 +681,18 @@ const char* SettingsShortNames[16][2] = {
|
||||
/* (<= 9) Sleep temperature */ {"Teplota v", "r. spanku"},
|
||||
/* (<= 9) Sleep timeout */ {"Cas do", "r. spanku"},
|
||||
/* (<= 11) Shutdown timeout */ {"Cas do", "vypnuti"},
|
||||
/* (<= 13) Motion sensitivity level */ {"Citlivost",
|
||||
"det. pohybu"},
|
||||
/* (<= 13) Motion sensitivity level */ {"Citlivost", "det. pohybu"},
|
||||
/* (<= 13) Temperature in F and C */ {"Jednotky", "teploty"},
|
||||
/* (<= 13) Advanced idle display mode enabled */ {"Podrobnosti",
|
||||
"na vych. obr."},
|
||||
/* (<= 13) Advanced idle display mode enabled */ {"Podrobnosti", "na vych. obr."},
|
||||
/* (<= 13) Display rotation mode */ {"Otoceni", "obrazovky"},
|
||||
/* (<= 13) Boost enabled */ {"Povolit", "boost"},
|
||||
/* (<= 9) Boost temperature */ {"Teplota v", "r. boost"},
|
||||
/* (<= 13) Automatic start mode */ {"Auto", "start"},
|
||||
/* (<= 13) Cooldown blink */ {"Blikani pri",
|
||||
"chladnuti"},
|
||||
/* (<= 13) Cooldown blink */ {"Blikani pri", "chladnuti"},
|
||||
/* (<= 16) Temperature calibration enter menu */ {"Kalibrovat", "teplotu?"},
|
||||
/* (<= 16) Settings reset command */ {"Tovarni", "nastaveni?"},
|
||||
/* (<= 16) Calibrate input voltage */ {"Kalibrovat",
|
||||
"vstupni napeti?"},
|
||||
/* (<= 13) Advanced soldering screen enabled */ {"Podrobnosti",
|
||||
"pri pajeni"},
|
||||
/* (<= 16) Calibrate input voltage */ {"Kalibrovat", "vstupni napeti?"},
|
||||
/* (<= 13) Advanced soldering screen enabled */ {"Podrobnosti", "pri pajeni"},
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -737,8 +726,8 @@ const char* SettingsLongNames[16] =
|
||||
"Részletes információk megjelenítése forrasztás közben", // ADV SLD
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Folytatás előtt győződj meg róla, hogy a hegy szobahőmérsékletű!";
|
||||
const char* SettingsCalibrationWarning = "Folytatás előtt győződj meg róla, hogy a hegy szobahőmérsékletű!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Alvás..."; // <=17 chars
|
||||
@@ -799,8 +788,8 @@ const char* SettingsLongNames[16] = {
|
||||
"Vis detialieret information mens der loddes", // ADV SLD
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Sørg for at loddespidsen er ved stuetemperatur, inden du fortsætter!";
|
||||
const char* SettingsCalibrationWarning = "Sørg for at loddespidsen er ved stuetemperatur, inden du fortsætter!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "Lav Volt"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Dvale..."; // <=17 chars
|
||||
@@ -866,9 +855,8 @@ const char*
|
||||
"wył.>", // ADV SLD
|
||||
};
|
||||
|
||||
const char* SettingsCalibrationWarning =
|
||||
"Przed kontynuowaniem upewnij się, że końcówka osiągnela temperature "
|
||||
"pokojowa!";
|
||||
const char* SettingsCalibrationWarning = "Przed kontynuowaniem upewnij się, że końcówka osiągnela temperature pokojowa!";
|
||||
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
|
||||
const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars
|
||||
const char* SleepingSimpleString = "Zzz!"; // Must be <= 4 chars
|
||||
const char* SleepingAdvancedString = "Uspienie..."; // <=17 chars
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "cmsis_os.h"
|
||||
#include "hardware.h"
|
||||
#include "string.h"
|
||||
|
||||
static void settings_setInputVRange(void);
|
||||
static void settings_displayInputVRange(void);
|
||||
static void settings_setSleepTemp(void);
|
||||
@@ -43,7 +44,6 @@ static void settings_displayCalibrate(void);
|
||||
static void settings_setCalibrateVIN(void);
|
||||
static void settings_displayCalibrateVIN(void);
|
||||
|
||||
bool settingsResetRequest = false;
|
||||
const menuitem settingsMenu[] = {
|
||||
/*Struct used for all settings options in the settings menu*/
|
||||
{(const char*)SettingsLongNames[0],
|
||||
@@ -132,6 +132,42 @@ static void printShortDescription(uint32_t shortDescIndex,
|
||||
lcd.setCharCursor(cursorCharPosition, 0);
|
||||
}
|
||||
|
||||
static int userConfirmation(const char* message) {
|
||||
uint8_t maxOffset = strlen(message) + 7;
|
||||
uint32_t messageStart = HAL_GetTick();
|
||||
|
||||
lcd.setFont(0);
|
||||
lcd.setCursor(0, 0);
|
||||
|
||||
for (;;) {
|
||||
int16_t messageOffset = (((HAL_GetTick() - messageStart) / 150) % maxOffset);
|
||||
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(12 * (7 - messageOffset), 0);
|
||||
lcd.print(message);
|
||||
|
||||
ButtonState buttons = getButtonState();
|
||||
switch (buttons) {
|
||||
case BUTTON_F_SHORT:
|
||||
//User confirmed
|
||||
return 1;
|
||||
|
||||
case BUTTON_BOTH:
|
||||
case BUTTON_B_SHORT:
|
||||
case BUTTON_F_LONG:
|
||||
case BUTTON_B_LONG:
|
||||
return 0;
|
||||
|
||||
case BUTTON_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
lcd.refresh();
|
||||
osDelay(50);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void settings_setInputVRange(void) {
|
||||
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
||||
}
|
||||
@@ -147,6 +183,7 @@ static void settings_displayInputVRange(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void settings_setSleepTemp(void) {
|
||||
systemSettings.SleepTemp += 10;
|
||||
if (systemSettings.SleepTemp > 300) systemSettings.SleepTemp = 50;
|
||||
@@ -157,6 +194,7 @@ static void settings_displaySleepTemp(void) {
|
||||
lcd.printNumber(systemSettings.SleepTemp, 3);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setSleepTime(void) {
|
||||
systemSettings.SleepTime++; // Go up 1 minute at a time
|
||||
if (systemSettings.SleepTime >= 16) {
|
||||
@@ -177,6 +215,7 @@ static void settings_displaySleepTime(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void settings_setShutdownTime(void) {
|
||||
systemSettings.ShutdownTime++;
|
||||
if (systemSettings.ShutdownTime > 60) {
|
||||
@@ -189,6 +228,7 @@ static void settings_displayShutdownTime(void) {
|
||||
lcd.printNumber(systemSettings.ShutdownTime, 2);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setTempF(void) {
|
||||
systemSettings.temperatureInF = !systemSettings.temperatureInF;
|
||||
}
|
||||
@@ -199,6 +239,7 @@ static void settings_displayTempF(void) {
|
||||
lcd.drawChar((systemSettings.temperatureInF) ? 'F' : 'C');
|
||||
}
|
||||
|
||||
|
||||
static void settings_setSensitivity(void) {
|
||||
systemSettings.sensitivity++;
|
||||
systemSettings.sensitivity = systemSettings.sensitivity % 10;
|
||||
@@ -209,6 +250,7 @@ static void settings_displaySensitivity(void) {
|
||||
lcd.printNumber(systemSettings.sensitivity, 1);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setAdvancedSolderingScreens(void) {
|
||||
systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
|
||||
}
|
||||
@@ -220,6 +262,7 @@ static void settings_displayAdvancedSolderingScreens(void) {
|
||||
: SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setAdvancedIDLEScreens(void) {
|
||||
systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
|
||||
}
|
||||
@@ -231,6 +274,7 @@ static void settings_displayAdvancedIDLEScreens(void) {
|
||||
: SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setDisplayRotation(void) {
|
||||
systemSettings.OrientationMode++;
|
||||
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
|
||||
@@ -255,6 +299,7 @@ static void settings_displayDisplayRotation(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void settings_setBoostModeEnabled(void) {
|
||||
systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
|
||||
}
|
||||
@@ -266,6 +311,7 @@ static void settings_displayBoostModeEnabled(void) {
|
||||
: SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setBoostTemp(void) {
|
||||
systemSettings.BoostTemp += 10; // Go up 10 at a time
|
||||
if (systemSettings.temperatureInF) {
|
||||
@@ -284,6 +330,7 @@ static void settings_displayBoostTemp(void) {
|
||||
lcd.printNumber(systemSettings.BoostTemp, 3);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setAutomaticStartMode(void) {
|
||||
systemSettings.autoStartMode++;
|
||||
systemSettings.autoStartMode %= 2;
|
||||
@@ -296,6 +343,7 @@ static void settings_displayAutomaticStartMode(void) {
|
||||
: SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setCoolingBlinkEnabled(void) {
|
||||
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
|
||||
}
|
||||
@@ -307,81 +355,56 @@ static void settings_displayCoolingBlinkEnabled(void) {
|
||||
: SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setResetSettings(void) {
|
||||
settingsResetRequest = !settingsResetRequest;
|
||||
if(userConfirmation(SettingsResetWarning)) {
|
||||
resetSettings();
|
||||
|
||||
lcd.setFont(0);
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("RESET OK");
|
||||
lcd.refresh();
|
||||
|
||||
waitForButtonPressOrTimeout(2000);
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_displayResetSettings(void) {
|
||||
printShortDescription(13, 7);
|
||||
|
||||
lcd.drawChar((settingsResetRequest) ? SettingTrueChar : SettingFalseChar);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setCalibrate(void) {
|
||||
// Calibrate the offset
|
||||
// We split off here to confirm with the user
|
||||
uint8_t maxOffset = strlen(SettingsCalibrationWarning) + 5;
|
||||
uint32_t descriptionStart = HAL_GetTick();
|
||||
|
||||
lcd.setFont(0);
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
|
||||
for (;;) {
|
||||
int16_t descriptionOffset =
|
||||
(((HAL_GetTick() - descriptionStart) / 150) % maxOffset);
|
||||
|
||||
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
||||
lcd.print(SettingsCalibrationWarning);
|
||||
|
||||
ButtonState buttons = getButtonState();
|
||||
switch (buttons) {
|
||||
case BUTTON_F_SHORT: {
|
||||
// User confirmed
|
||||
// So we now perform the actual calculation
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(".....");
|
||||
lcd.refresh();
|
||||
|
||||
setCalibrationOffset(0); // turn off the current offset
|
||||
for (uint8_t i = 0; i < 20; i++) {
|
||||
getTipRawTemp(1); // cycle through the filter a fair bit to ensure
|
||||
// we're stable.
|
||||
osDelay(20);
|
||||
}
|
||||
osDelay(100);
|
||||
|
||||
uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0));
|
||||
// We now measure the current reported tip temperature
|
||||
uint16_t handleTempC = getHandleTemperature() / 10;
|
||||
// We now have an error between these that we want to store as the
|
||||
// offset
|
||||
rawTempC = rawTempC - handleTempC;
|
||||
systemSettings.CalibrationOffset = rawTempC;
|
||||
setCalibrationOffset(rawTempC); // store the error
|
||||
osDelay(100);
|
||||
return;
|
||||
}
|
||||
|
||||
case BUTTON_BOTH:
|
||||
case BUTTON_B_SHORT:
|
||||
case BUTTON_F_LONG:
|
||||
case BUTTON_B_LONG:
|
||||
return;
|
||||
|
||||
case BUTTON_NONE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(userConfirmation(SettingsCalibrationWarning)) {
|
||||
//User confirmed
|
||||
//So we now perform the actual calculation
|
||||
lcd.clearScreen();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(".....");
|
||||
lcd.refresh();
|
||||
osDelay(50);
|
||||
|
||||
setCalibrationOffset(0); //turn off the current offset
|
||||
for (uint8_t i = 0; i < 20; i++) {
|
||||
getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
|
||||
osDelay(20);
|
||||
}
|
||||
osDelay(100);
|
||||
|
||||
uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0));
|
||||
//We now measure the current reported tip temperature
|
||||
uint16_t handleTempC = getHandleTemperature() / 10;
|
||||
//We now have an error between these that we want to store as the offset
|
||||
rawTempC = rawTempC - handleTempC;
|
||||
systemSettings.CalibrationOffset = rawTempC;
|
||||
setCalibrationOffset(rawTempC); //store the error
|
||||
osDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_displayCalibrate(void) { printShortDescription(12, 5); }
|
||||
static void settings_displayCalibrate(void) {
|
||||
printShortDescription(12, 5);
|
||||
}
|
||||
|
||||
|
||||
static void settings_setCalibrateVIN(void) {
|
||||
// Jump to the voltage calibration subscreen
|
||||
@@ -429,4 +452,6 @@ static void settings_setCalibrateVIN(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_displayCalibrateVIN(void) { printShortDescription(14, 5); }
|
||||
static void settings_displayCalibrateVIN(void) {
|
||||
printShortDescription(14, 5);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,8 @@ static void waitForButtonPress() {
|
||||
lcd.refresh();
|
||||
}
|
||||
}
|
||||
static void waitForButtonPressOrTimeout(uint32_t timeout) {
|
||||
|
||||
void waitForButtonPressOrTimeout(uint32_t timeout) {
|
||||
timeout += HAL_GetTick();
|
||||
// Make timeout our exit value
|
||||
for (;;) {
|
||||
@@ -306,7 +307,6 @@ static void gui_settingsMenu() {
|
||||
// Draw the settings menu and provide iteration support etc
|
||||
uint8_t currentScreen = 0;
|
||||
uint32_t autoRepeatTimer = 0;
|
||||
settingsResetRequest = false;
|
||||
bool earlyExit = false;
|
||||
uint32_t descriptionStart = 0;
|
||||
while ((settingsMenu[currentScreen].incrementHandler.func != NULL) &&
|
||||
@@ -321,7 +321,7 @@ static void gui_settingsMenu() {
|
||||
} else {
|
||||
// Draw description
|
||||
// draw string starting from descriptionOffset
|
||||
int16_t maxOffset = strlen(settingsMenu[currentScreen].description) + 5;
|
||||
int16_t maxOffset = strlen(settingsMenu[currentScreen].description) + 7;
|
||||
if (descriptionStart == 0) descriptionStart = HAL_GetTick();
|
||||
|
||||
int16_t descriptionOffset =
|
||||
@@ -374,9 +374,10 @@ static void gui_settingsMenu() {
|
||||
osDelay(20);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
}
|
||||
if (settingsResetRequest) resetSettings();
|
||||
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
static int gui_showTipTempWarning() {
|
||||
for (;;) {
|
||||
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
|
||||
|
||||
Reference in New Issue
Block a user