|
|
|
|
@@ -17,12 +17,13 @@
|
|
|
|
|
|
|
|
|
|
void gui_Menu(const menuitem *menu);
|
|
|
|
|
|
|
|
|
|
#ifdef MODEL_TS100
|
|
|
|
|
#ifdef POW_DC
|
|
|
|
|
static bool settings_setInputVRange(void);
|
|
|
|
|
static void settings_displayInputVRange(void);
|
|
|
|
|
#else
|
|
|
|
|
static bool settings_setInputPRange(void);
|
|
|
|
|
static void settings_displayInputPRange(void);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef POW_QC
|
|
|
|
|
static bool settings_setQCInputV(void);
|
|
|
|
|
static void settings_displayQCInputV(void);
|
|
|
|
|
#endif
|
|
|
|
|
static bool settings_setSleepTemp(void);
|
|
|
|
|
static void settings_displaySleepTemp(void);
|
|
|
|
|
@@ -130,11 +131,11 @@ const menuitem rootSettingsMenu[]{
|
|
|
|
|
* Advanced Menu
|
|
|
|
|
* Exit
|
|
|
|
|
*/
|
|
|
|
|
#ifdef MODEL_TS100
|
|
|
|
|
{(const char *)SettingsDescriptions[0], settings_setInputVRange,
|
|
|
|
|
settings_displayInputVRange}, /*Voltage input*/
|
|
|
|
|
#else
|
|
|
|
|
{(const char *)SettingsDescriptions[19], settings_setInputPRange, settings_displayInputPRange}, /*Voltage input*/
|
|
|
|
|
#ifdef POW_DC
|
|
|
|
|
{ (const char *) SettingsDescriptions[0], settings_setInputVRange, settings_displayInputVRange }, /*Voltage input*/
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef POW_QC
|
|
|
|
|
{ (const char *) SettingsDescriptions[19], settings_setQCInputV, settings_displayQCInputV }, /*Voltage input*/
|
|
|
|
|
#endif
|
|
|
|
|
{ (const char *) NULL, settings_enterSolderingMenu, settings_displaySolderingMenu }, /*Soldering*/
|
|
|
|
|
{ (const char *) NULL, settings_enterPowerMenu, settings_displayPowerMenu }, /*Sleep Options Menu*/
|
|
|
|
|
@@ -215,8 +216,7 @@ const menuitem advancedMenu[] = {
|
|
|
|
|
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void printShortDescriptionDoubleLine(uint32_t shortDescIndex)
|
|
|
|
|
{
|
|
|
|
|
static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) {
|
|
|
|
|
OLED::setFont(1);
|
|
|
|
|
OLED::setCharCursor(0, 0);
|
|
|
|
|
OLED::print(SettingsShortNames[shortDescIndex][0]);
|
|
|
|
|
@@ -231,8 +231,7 @@ static void printShortDescriptionDoubleLine(uint32_t shortDescIndex)
|
|
|
|
|
* @param cursorCharPosition Custom cursor char position to set after printing
|
|
|
|
|
* description.
|
|
|
|
|
*/
|
|
|
|
|
static void printShortDescription(uint32_t shortDescIndex, uint16_t cursorCharPosition)
|
|
|
|
|
{
|
|
|
|
|
static void printShortDescription(uint32_t shortDescIndex, uint16_t cursorCharPosition) {
|
|
|
|
|
// print short description (default single line, explicit double line)
|
|
|
|
|
printShortDescriptionDoubleLine(shortDescIndex);
|
|
|
|
|
|
|
|
|
|
@@ -243,8 +242,7 @@ static void printShortDescription(uint32_t shortDescIndex, uint16_t cursorCharPo
|
|
|
|
|
OLED::setCursor(OLED::getCursorX() - 2, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int userConfirmation(const char *message)
|
|
|
|
|
{
|
|
|
|
|
static int userConfirmation(const char *message) {
|
|
|
|
|
uint16_t messageWidth = FONT_12_WIDTH * (strlen(message) + 7);
|
|
|
|
|
uint32_t messageStart = xTaskGetTickCount();
|
|
|
|
|
|
|
|
|
|
@@ -253,13 +251,11 @@ static int userConfirmation(const char *message)
|
|
|
|
|
int16_t lastOffset = -1;
|
|
|
|
|
bool lcdRefresh = true;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
for (;;) {
|
|
|
|
|
int16_t messageOffset = ((xTaskGetTickCount() - messageStart) / (systemSettings.descriptionScrollSpeed == 1 ? 10 : 20));
|
|
|
|
|
messageOffset %= messageWidth; // Roll around at the end
|
|
|
|
|
|
|
|
|
|
if (lastOffset != messageOffset)
|
|
|
|
|
{
|
|
|
|
|
if (lastOffset != messageOffset) {
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
|
|
|
|
|
//^ Rolling offset based on time
|
|
|
|
|
@@ -270,8 +266,7 @@ static int userConfirmation(const char *message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
switch (buttons)
|
|
|
|
|
{
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_F_SHORT:
|
|
|
|
|
// User confirmed
|
|
|
|
|
return 1;
|
|
|
|
|
@@ -286,8 +281,7 @@ static int userConfirmation(const char *message)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lcdRefresh)
|
|
|
|
|
{
|
|
|
|
|
if (lcdRefresh) {
|
|
|
|
|
OLED::refresh();
|
|
|
|
|
osDelay(40);
|
|
|
|
|
lcdRefresh = false;
|
|
|
|
|
@@ -295,43 +289,39 @@ static int userConfirmation(const char *message)
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#ifdef MODEL_TS100
|
|
|
|
|
static bool settings_setInputVRange(void)
|
|
|
|
|
{
|
|
|
|
|
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
|
|
|
|
if (systemSettings.cutoutSetting)
|
|
|
|
|
systemSettings.powerLimit = 0; // disable power limit if switching to a lipo power source
|
|
|
|
|
return systemSettings.cutoutSetting == 4;
|
|
|
|
|
#ifdef POW_DC
|
|
|
|
|
static bool settings_setInputVRange(void) {
|
|
|
|
|
systemSettings.minDCVoltageCells = (systemSettings.minDCVoltageCells + 1) % 5;
|
|
|
|
|
return systemSettings.minDCVoltageCells == 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayInputVRange(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayInputVRange(void) {
|
|
|
|
|
printShortDescription(0, 6);
|
|
|
|
|
|
|
|
|
|
if (systemSettings.cutoutSetting)
|
|
|
|
|
{
|
|
|
|
|
OLED::printNumber(2 + systemSettings.cutoutSetting, 1);
|
|
|
|
|
if (systemSettings.minDCVoltageCells) {
|
|
|
|
|
OLED::printNumber(2 + systemSettings.minDCVoltageCells, 1);
|
|
|
|
|
OLED::print(SymbolCellCount);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::print(SymbolDC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef POW_QC
|
|
|
|
|
static bool settings_setQCInputV(void) {
|
|
|
|
|
#ifdef POW_QC_20V
|
|
|
|
|
systemSettings.QCIdealVoltage = (systemSettings.QCIdealVoltage + 1) % 3;
|
|
|
|
|
return systemSettings.QCIdealVoltage == 2;
|
|
|
|
|
#else
|
|
|
|
|
static bool settings_setInputPRange(void)
|
|
|
|
|
{
|
|
|
|
|
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 2;
|
|
|
|
|
return false;
|
|
|
|
|
systemSettings.QCIdealVoltage = (systemSettings.QCIdealVoltage + 1) % 2;
|
|
|
|
|
return systemSettings.QCIdealVoltage == 1;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayInputPRange(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayQCInputV(void) {
|
|
|
|
|
printShortDescription(0, 5);
|
|
|
|
|
//0 = 9V, 1=12V (Fixed Voltages, these imply 1.5A limits)
|
|
|
|
|
// These are only used in QC3.0 modes
|
|
|
|
|
switch (systemSettings.cutoutSetting)
|
|
|
|
|
{
|
|
|
|
|
//0 = 9V, 1=12V, 2=20V (Fixed Voltages)
|
|
|
|
|
// These are only used in QC modes
|
|
|
|
|
switch (systemSettings.QCIdealVoltage) {
|
|
|
|
|
case 0:
|
|
|
|
|
OLED::printNumber(9, 2);
|
|
|
|
|
OLED::print(SymbolVolts);
|
|
|
|
|
@@ -340,14 +330,17 @@ static void settings_displayInputPRange(void)
|
|
|
|
|
OLED::printNumber(12, 2);
|
|
|
|
|
OLED::print(SymbolVolts);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
OLED::printNumber(20, 2);
|
|
|
|
|
OLED::print(SymbolVolts);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
static bool settings_setSleepTemp(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setSleepTemp(void) {
|
|
|
|
|
// If in C, 10 deg, if in F 20 deg
|
|
|
|
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
@@ -367,17 +360,14 @@ static bool settings_setSleepTemp(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displaySleepTemp(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displaySleepTemp(void) {
|
|
|
|
|
printShortDescription(1, 5);
|
|
|
|
|
OLED::printNumber(systemSettings.SleepTemp, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setSleepTime(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setSleepTime(void) {
|
|
|
|
|
systemSettings.SleepTime++; // Go up 1 minute at a time
|
|
|
|
|
if (systemSettings.SleepTime >= 16)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.SleepTime >= 16) {
|
|
|
|
|
systemSettings.SleepTime = 0; // can't set time over 10 mins
|
|
|
|
|
}
|
|
|
|
|
// Remember that ^ is the time of no movement
|
|
|
|
|
@@ -386,30 +376,22 @@ static bool settings_setSleepTime(void)
|
|
|
|
|
return systemSettings.SleepTime == 15;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displaySleepTime(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displaySleepTime(void) {
|
|
|
|
|
printShortDescription(2, 5);
|
|
|
|
|
if (systemSettings.SleepTime == 0)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.SleepTime == 0) {
|
|
|
|
|
OLED::print(OffString);
|
|
|
|
|
}
|
|
|
|
|
else if (systemSettings.SleepTime < 6)
|
|
|
|
|
{
|
|
|
|
|
} else if (systemSettings.SleepTime < 6) {
|
|
|
|
|
OLED::printNumber(systemSettings.SleepTime * 10, 2);
|
|
|
|
|
OLED::print(SymbolSeconds);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::printNumber(systemSettings.SleepTime - 5, 2);
|
|
|
|
|
OLED::print(SymbolMinutes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setShutdownTime(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setShutdownTime(void) {
|
|
|
|
|
systemSettings.ShutdownTime++;
|
|
|
|
|
if (systemSettings.ShutdownTime > 60)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.ShutdownTime > 60) {
|
|
|
|
|
systemSettings.ShutdownTime = 0; // wrap to off
|
|
|
|
|
}
|
|
|
|
|
if (PCBVersion == 3)
|
|
|
|
|
@@ -417,15 +399,11 @@ static bool settings_setShutdownTime(void)
|
|
|
|
|
return systemSettings.ShutdownTime == 60;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayShutdownTime(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayShutdownTime(void) {
|
|
|
|
|
printShortDescription(3, 5);
|
|
|
|
|
if (systemSettings.ShutdownTime == 0)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.ShutdownTime == 0) {
|
|
|
|
|
OLED::print(OffString);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::printNumber(systemSettings.ShutdownTime, 2);
|
|
|
|
|
OLED::print(SymbolMinutes);
|
|
|
|
|
}
|
|
|
|
|
@@ -469,69 +447,57 @@ static void settings_displayTempF(void)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static bool settings_setSensitivity(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setSensitivity(void) {
|
|
|
|
|
systemSettings.sensitivity++;
|
|
|
|
|
systemSettings.sensitivity = systemSettings.sensitivity % 10;
|
|
|
|
|
return systemSettings.sensitivity == 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displaySensitivity(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displaySensitivity(void) {
|
|
|
|
|
printShortDescription(4, 7);
|
|
|
|
|
OLED::printNumber(systemSettings.sensitivity, 1, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setAdvancedSolderingScreens(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setAdvancedSolderingScreens(void) {
|
|
|
|
|
systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayAdvancedSolderingScreens(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayAdvancedSolderingScreens(void) {
|
|
|
|
|
printShortDescription(14, 7);
|
|
|
|
|
|
|
|
|
|
OLED::drawCheckbox(systemSettings.detailedSoldering);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setAdvancedIDLEScreens(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setAdvancedIDLEScreens(void) {
|
|
|
|
|
systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayAdvancedIDLEScreens(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayAdvancedIDLEScreens(void) {
|
|
|
|
|
printShortDescription(6, 7);
|
|
|
|
|
|
|
|
|
|
OLED::drawCheckbox(systemSettings.detailedIDLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setPowerLimit(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setPowerLimit(void) {
|
|
|
|
|
systemSettings.powerLimit += POWER_LIMIT_STEPS;
|
|
|
|
|
if (systemSettings.powerLimit > MAX_POWER_LIMIT)
|
|
|
|
|
systemSettings.powerLimit = 0;
|
|
|
|
|
return systemSettings.powerLimit + POWER_LIMIT_STEPS > MAX_POWER_LIMIT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayPowerLimit(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayPowerLimit(void) {
|
|
|
|
|
printShortDescription(20, 5);
|
|
|
|
|
if (systemSettings.powerLimit == 0)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.powerLimit == 0) {
|
|
|
|
|
OLED::print(OffString);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::printNumber(systemSettings.powerLimit, 2);
|
|
|
|
|
OLED::print(SymbolWatts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setScrollSpeed(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setScrollSpeed(void) {
|
|
|
|
|
if (systemSettings.descriptionScrollSpeed == 0)
|
|
|
|
|
systemSettings.descriptionScrollSpeed = 1;
|
|
|
|
|
else
|
|
|
|
|
@@ -539,18 +505,15 @@ static bool settings_setScrollSpeed(void)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayScrollSpeed(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayScrollSpeed(void) {
|
|
|
|
|
printShortDescription(15, 7);
|
|
|
|
|
OLED::print((systemSettings.descriptionScrollSpeed) ? SettingFastChar : SettingSlowChar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setDisplayRotation(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setDisplayRotation(void) {
|
|
|
|
|
systemSettings.OrientationMode++;
|
|
|
|
|
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
|
|
|
|
|
switch (systemSettings.OrientationMode)
|
|
|
|
|
{
|
|
|
|
|
switch (systemSettings.OrientationMode) {
|
|
|
|
|
case 0:
|
|
|
|
|
OLED::setRotation(false);
|
|
|
|
|
break;
|
|
|
|
|
@@ -566,12 +529,10 @@ static bool settings_setDisplayRotation(void)
|
|
|
|
|
return systemSettings.OrientationMode == 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayDisplayRotation(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayDisplayRotation(void) {
|
|
|
|
|
printShortDescription(7, 7);
|
|
|
|
|
|
|
|
|
|
switch (systemSettings.OrientationMode)
|
|
|
|
|
{
|
|
|
|
|
switch (systemSettings.OrientationMode) {
|
|
|
|
|
case 0:
|
|
|
|
|
OLED::print(SettingRightChar);
|
|
|
|
|
break;
|
|
|
|
|
@@ -587,8 +548,7 @@ static void settings_displayDisplayRotation(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setBoostTemp(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setBoostTemp(void) {
|
|
|
|
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
|
|
|
|
if (systemSettings.temperatureInF)
|
|
|
|
|
{
|
|
|
|
|
@@ -610,48 +570,37 @@ static bool settings_setBoostTemp(void)
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.BoostTemp == 0)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.BoostTemp == 0) {
|
|
|
|
|
systemSettings.BoostTemp = 250; // loop back at 250
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
systemSettings.BoostTemp += 10; // Go up 10C at a time
|
|
|
|
|
}
|
|
|
|
|
if (systemSettings.BoostTemp > 450)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.BoostTemp > 450) {
|
|
|
|
|
systemSettings.BoostTemp = 0; //Go to off state
|
|
|
|
|
}
|
|
|
|
|
return systemSettings.BoostTemp == 450;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayBoostTemp(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayBoostTemp(void) {
|
|
|
|
|
printShortDescription(8, 5);
|
|
|
|
|
if (systemSettings.BoostTemp)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.BoostTemp) {
|
|
|
|
|
OLED::printNumber(systemSettings.BoostTemp, 3);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::print(OffString);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setAutomaticStartMode(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setAutomaticStartMode(void) {
|
|
|
|
|
systemSettings.autoStartMode++;
|
|
|
|
|
systemSettings.autoStartMode %= 4;
|
|
|
|
|
return systemSettings.autoStartMode == 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayAutomaticStartMode(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayAutomaticStartMode(void) {
|
|
|
|
|
printShortDescription(9, 7);
|
|
|
|
|
|
|
|
|
|
switch (systemSettings.autoStartMode)
|
|
|
|
|
{
|
|
|
|
|
switch (systemSettings.autoStartMode) {
|
|
|
|
|
case 0:
|
|
|
|
|
OLED::print(SettingStartNoneChar);
|
|
|
|
|
break;
|
|
|
|
|
@@ -670,19 +619,16 @@ static void settings_displayAutomaticStartMode(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setLockingMode(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setLockingMode(void) {
|
|
|
|
|
systemSettings.lockingMode++;
|
|
|
|
|
systemSettings.lockingMode %= 3;
|
|
|
|
|
return systemSettings.lockingMode == 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayLockingMode(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayLockingMode(void) {
|
|
|
|
|
printShortDescription(26, 7);
|
|
|
|
|
|
|
|
|
|
switch (systemSettings.lockingMode)
|
|
|
|
|
{
|
|
|
|
|
switch (systemSettings.lockingMode) {
|
|
|
|
|
case 0:
|
|
|
|
|
OLED::print (SettingLockDisableChar);
|
|
|
|
|
break;
|
|
|
|
|
@@ -698,23 +644,19 @@ static void settings_displayLockingMode(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setCoolingBlinkEnabled(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setCoolingBlinkEnabled(void) {
|
|
|
|
|
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayCoolingBlinkEnabled(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayCoolingBlinkEnabled(void) {
|
|
|
|
|
printShortDescription(10, 7);
|
|
|
|
|
|
|
|
|
|
OLED::drawCheckbox(systemSettings.coolingTempBlink);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setResetSettings(void)
|
|
|
|
|
{
|
|
|
|
|
if (userConfirmation(SettingsResetWarning))
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setResetSettings(void) {
|
|
|
|
|
if (userConfirmation(SettingsResetWarning)) {
|
|
|
|
|
resetSettings();
|
|
|
|
|
|
|
|
|
|
OLED::setFont(0);
|
|
|
|
|
@@ -727,23 +669,19 @@ static bool settings_setResetSettings(void)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayResetSettings(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayResetSettings(void) {
|
|
|
|
|
printShortDescription(12, 7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void setTipOffset()
|
|
|
|
|
{
|
|
|
|
|
static void setTipOffset() {
|
|
|
|
|
systemSettings.CalibrationOffset = 0;
|
|
|
|
|
|
|
|
|
|
// If the thermo-couple at the end of the tip, and the handle are at
|
|
|
|
|
// equilibrium, then the output should be zero, as there is no temperature
|
|
|
|
|
// differential.
|
|
|
|
|
while (systemSettings.CalibrationOffset == 0)
|
|
|
|
|
{
|
|
|
|
|
while (systemSettings.CalibrationOffset == 0) {
|
|
|
|
|
uint32_t offset = 0;
|
|
|
|
|
for (uint8_t i = 0; i < 16; i++)
|
|
|
|
|
{
|
|
|
|
|
for (uint8_t i = 0; i < 16; i++) {
|
|
|
|
|
offset += getTipRawTemp(1);
|
|
|
|
|
// cycle through the filter a fair bit to ensure we're stable.
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
@@ -766,11 +704,9 @@ static void setTipOffset()
|
|
|
|
|
|
|
|
|
|
//Provide the user the option to tune their own tip if custom is selected
|
|
|
|
|
//If not only do single point tuning as per usual
|
|
|
|
|
static bool settings_setCalibrate(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setCalibrate(void) {
|
|
|
|
|
|
|
|
|
|
if (userConfirmation(SettingsCalibrationWarning))
|
|
|
|
|
{
|
|
|
|
|
if (userConfirmation(SettingsCalibrationWarning)) {
|
|
|
|
|
// User confirmed
|
|
|
|
|
// So we now perform the actual calculation
|
|
|
|
|
setTipOffset();
|
|
|
|
|
@@ -778,20 +714,17 @@ static bool settings_setCalibrate(void)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayCalibrate(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayCalibrate(void) {
|
|
|
|
|
printShortDescription(11, 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setCalibrateVIN(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setCalibrateVIN(void) {
|
|
|
|
|
// Jump to the voltage calibration subscreen
|
|
|
|
|
OLED::setFont(0);
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
for (;;) {
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv, 0) / 10, 2);
|
|
|
|
|
OLED::print(SymbolDot);
|
|
|
|
|
@@ -799,8 +732,7 @@ static bool settings_setCalibrateVIN(void)
|
|
|
|
|
OLED::print(SymbolVolts);
|
|
|
|
|
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
switch (buttons)
|
|
|
|
|
{
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_F_SHORT:
|
|
|
|
|
systemSettings.voltageDiv++;
|
|
|
|
|
break;
|
|
|
|
|
@@ -837,12 +769,9 @@ static bool settings_setCalibrateVIN(void)
|
|
|
|
|
systemSettings.voltageDiv = 900;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
if (systemSettings.voltageDiv < 360)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.voltageDiv < 360) {
|
|
|
|
|
systemSettings.voltageDiv = 360;
|
|
|
|
|
}
|
|
|
|
|
else if (systemSettings.voltageDiv > 520)
|
|
|
|
|
{
|
|
|
|
|
} else if (systemSettings.voltageDiv > 520) {
|
|
|
|
|
systemSettings.voltageDiv = 520;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
@@ -850,21 +779,18 @@ static bool settings_setCalibrateVIN(void)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setTipGain(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setTipGain(void) {
|
|
|
|
|
OLED::setFont(0);
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
for (;;) {
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
OLED::printNumber(systemSettings.TipGain / 10, 2);
|
|
|
|
|
OLED::print(SymbolDot);
|
|
|
|
|
OLED::printNumber(systemSettings.TipGain % 10, 1);
|
|
|
|
|
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
switch (buttons)
|
|
|
|
|
{
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_F_SHORT:
|
|
|
|
|
systemSettings.TipGain -= 1;
|
|
|
|
|
break;
|
|
|
|
|
@@ -887,94 +813,75 @@ static bool settings_setTipGain(void)
|
|
|
|
|
osDelay(40);
|
|
|
|
|
|
|
|
|
|
// Cap to sensible values
|
|
|
|
|
if (systemSettings.TipGain < 150)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.TipGain < 150) {
|
|
|
|
|
systemSettings.TipGain = 150;
|
|
|
|
|
}
|
|
|
|
|
else if (systemSettings.TipGain > 300)
|
|
|
|
|
{
|
|
|
|
|
} else if (systemSettings.TipGain > 300) {
|
|
|
|
|
systemSettings.TipGain = 300;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayTipGain(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayTipGain(void) {
|
|
|
|
|
printShortDescription(25, 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setReverseButtonTempChangeEnabled(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setReverseButtonTempChangeEnabled(void) {
|
|
|
|
|
systemSettings.ReverseButtonTempChangeEnabled = !systemSettings.ReverseButtonTempChangeEnabled;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayReverseButtonTempChangeEnabled(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayReverseButtonTempChangeEnabled(void) {
|
|
|
|
|
printShortDescription(21, 7);
|
|
|
|
|
OLED::drawCheckbox(systemSettings.ReverseButtonTempChangeEnabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setTempChangeShortStep(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setTempChangeShortStep(void) {
|
|
|
|
|
systemSettings.TempChangeShortStep += TEMP_CHANGE_SHORT_STEP;
|
|
|
|
|
if (systemSettings.TempChangeShortStep > TEMP_CHANGE_SHORT_STEP_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.TempChangeShortStep > TEMP_CHANGE_SHORT_STEP_MAX) {
|
|
|
|
|
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; // loop back at TEMP_CHANGE_SHORT_STEP_MAX
|
|
|
|
|
}
|
|
|
|
|
return systemSettings.TempChangeShortStep == TEMP_CHANGE_SHORT_STEP_MAX;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayTempChangeShortStep(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayTempChangeShortStep(void) {
|
|
|
|
|
printShortDescription(22, 6);
|
|
|
|
|
OLED::printNumber(systemSettings.TempChangeShortStep, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setTempChangeLongStep(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setTempChangeLongStep(void) {
|
|
|
|
|
systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP;
|
|
|
|
|
if (systemSettings.TempChangeLongStep > TEMP_CHANGE_LONG_STEP_MAX)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.TempChangeLongStep > TEMP_CHANGE_LONG_STEP_MAX) {
|
|
|
|
|
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; // loop back at TEMP_CHANGE_LONG_STEP_MAX
|
|
|
|
|
}
|
|
|
|
|
return systemSettings.TempChangeLongStep == TEMP_CHANGE_LONG_STEP_MAX;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayTempChangeLongStep(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayTempChangeLongStep(void) {
|
|
|
|
|
printShortDescription(23, 6);
|
|
|
|
|
OLED::printNumber(systemSettings.TempChangeLongStep, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool settings_setPowerPulse(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setPowerPulse(void) {
|
|
|
|
|
systemSettings.KeepAwakePulse += POWER_PULSE_INCREMENT;
|
|
|
|
|
systemSettings.KeepAwakePulse %= POWER_PULSE_MAX;
|
|
|
|
|
|
|
|
|
|
return systemSettings.KeepAwakePulse == POWER_PULSE_MAX - 1;
|
|
|
|
|
}
|
|
|
|
|
static void settings_displayPowerPulse(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayPowerPulse(void) {
|
|
|
|
|
printShortDescription(24, 5);
|
|
|
|
|
if (systemSettings.KeepAwakePulse)
|
|
|
|
|
{
|
|
|
|
|
if (systemSettings.KeepAwakePulse) {
|
|
|
|
|
OLED::printNumber(systemSettings.KeepAwakePulse / 10, 1);
|
|
|
|
|
OLED::print(SymbolDot);
|
|
|
|
|
OLED::printNumber(systemSettings.KeepAwakePulse % 10, 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
OLED::print(OffString);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#ifdef HALL_SENSOR
|
|
|
|
|
static void settings_displayHallEffect(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayHallEffect(void) {
|
|
|
|
|
printShortDescription(26, 7);
|
|
|
|
|
switch (systemSettings.hallEffectSensitivity)
|
|
|
|
|
{
|
|
|
|
|
switch (systemSettings.hallEffectSensitivity) {
|
|
|
|
|
case 1:
|
|
|
|
|
OLED::print(SettingSensitivityLow);
|
|
|
|
|
break;
|
|
|
|
|
@@ -990,8 +897,7 @@ static void settings_displayHallEffect(void)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static bool settings_setHallEffect(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_setHallEffect(void) {
|
|
|
|
|
//To keep life simpler for now, we have a few preset sensitivity levels
|
|
|
|
|
// Off, Low, Medium, High
|
|
|
|
|
systemSettings.hallEffectSensitivity++;
|
|
|
|
|
@@ -999,8 +905,7 @@ static bool settings_setHallEffect(void)
|
|
|
|
|
return systemSettings.hallEffectSensitivity == 3;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
static void displayMenu(size_t index)
|
|
|
|
|
{
|
|
|
|
|
static void displayMenu(size_t index) {
|
|
|
|
|
// Call into the menu
|
|
|
|
|
OLED::setFont(1);
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
@@ -1012,49 +917,39 @@ static void displayMenu(size_t index)
|
|
|
|
|
OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void settings_displayCalibrateVIN(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayCalibrateVIN(void) {
|
|
|
|
|
printShortDescription(13, 5);
|
|
|
|
|
}
|
|
|
|
|
static void settings_displaySolderingMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displaySolderingMenu(void) {
|
|
|
|
|
displayMenu(0);
|
|
|
|
|
}
|
|
|
|
|
static bool settings_enterSolderingMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_enterSolderingMenu(void) {
|
|
|
|
|
gui_Menu(solderingMenu);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
static void settings_displayPowerMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayPowerMenu(void) {
|
|
|
|
|
displayMenu(1);
|
|
|
|
|
}
|
|
|
|
|
static bool settings_enterPowerMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_enterPowerMenu(void) {
|
|
|
|
|
gui_Menu(PowerMenu);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
static void settings_displayUIMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayUIMenu(void) {
|
|
|
|
|
displayMenu(2);
|
|
|
|
|
}
|
|
|
|
|
static bool settings_enterUIMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_enterUIMenu(void) {
|
|
|
|
|
gui_Menu(UIMenu);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
static void settings_displayAdvancedMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static void settings_displayAdvancedMenu(void) {
|
|
|
|
|
displayMenu(3);
|
|
|
|
|
}
|
|
|
|
|
static bool settings_enterAdvancedMenu(void)
|
|
|
|
|
{
|
|
|
|
|
static bool settings_enterAdvancedMenu(void) {
|
|
|
|
|
gui_Menu(advancedMenu);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void gui_Menu(const menuitem *menu)
|
|
|
|
|
{
|
|
|
|
|
void gui_Menu(const menuitem *menu) {
|
|
|
|
|
// Draw the settings menu and provide iteration support etc
|
|
|
|
|
uint8_t currentScreen = 0;
|
|
|
|
|
uint32_t autoRepeatTimer = 0;
|
|
|
|
|
@@ -1070,14 +965,12 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
bool scrollBlink = false;
|
|
|
|
|
bool lastValue = false;
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; menu[i].draw != NULL; i++)
|
|
|
|
|
{
|
|
|
|
|
for (uint8_t i = 0; menu[i].draw != NULL; i++) {
|
|
|
|
|
scrollContentSize += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Animated menu opening.
|
|
|
|
|
if (menu[currentScreen].draw != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (menu[currentScreen].draw != NULL) {
|
|
|
|
|
// This menu is drawn in a secondary framebuffer.
|
|
|
|
|
// Then we play a transition from the current primary
|
|
|
|
|
// framebuffer to the new buffer.
|
|
|
|
|
@@ -1091,14 +984,12 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
OLED::transitionSecondaryFramebuffer(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while ((menu[currentScreen].draw != NULL) && earlyExit == false)
|
|
|
|
|
{
|
|
|
|
|
while ((menu[currentScreen].draw != NULL) && earlyExit == false) {
|
|
|
|
|
OLED::setFont(0);
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
// If the user has hesitated for >=3 seconds, show the long text
|
|
|
|
|
// Otherwise "draw" the option
|
|
|
|
|
if ((xTaskGetTickCount() - lastButtonTime < 3000) || menu[currentScreen].description == NULL)
|
|
|
|
|
{
|
|
|
|
|
if ((xTaskGetTickCount() - lastButtonTime < 3000) || menu[currentScreen].description == NULL) {
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
menu[currentScreen].draw();
|
|
|
|
|
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
|
|
|
|
|
@@ -1109,9 +1000,7 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
OLED::drawScrollIndicator(position, indicatorHeight);
|
|
|
|
|
lastOffset = -1;
|
|
|
|
|
lcdRefresh = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
// Draw description
|
|
|
|
|
if (descriptionStart == 0)
|
|
|
|
|
descriptionStart = xTaskGetTickCount();
|
|
|
|
|
@@ -1120,8 +1009,7 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
FONT_12_WIDTH * (strlen(menu[currentScreen].description) + 7);
|
|
|
|
|
int16_t descriptionOffset = ((xTaskGetTickCount() - descriptionStart) / (systemSettings.descriptionScrollSpeed == 1 ? 10 : 20));
|
|
|
|
|
descriptionOffset %= descriptionWidth; // Roll around at the end
|
|
|
|
|
if (lastOffset != descriptionOffset)
|
|
|
|
|
{
|
|
|
|
|
if (lastOffset != descriptionOffset) {
|
|
|
|
|
OLED::clearScreen();
|
|
|
|
|
OLED::setCursor((OLED_WIDTH - descriptionOffset), 0);
|
|
|
|
|
OLED::print(menu[currentScreen].description);
|
|
|
|
|
@@ -1132,29 +1020,24 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
|
|
|
|
|
ButtonState buttons = getButtonState();
|
|
|
|
|
|
|
|
|
|
if (buttons != lastButtonState)
|
|
|
|
|
{
|
|
|
|
|
if (buttons != lastButtonState) {
|
|
|
|
|
autoRepeatAcceleration = 0;
|
|
|
|
|
lastButtonState = buttons;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (buttons)
|
|
|
|
|
{
|
|
|
|
|
switch (buttons) {
|
|
|
|
|
case BUTTON_BOTH:
|
|
|
|
|
earlyExit = true; // will make us exit next loop
|
|
|
|
|
descriptionStart = 0;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_F_SHORT:
|
|
|
|
|
// increment
|
|
|
|
|
if (descriptionStart == 0)
|
|
|
|
|
{
|
|
|
|
|
if (menu[currentScreen].incrementHandler != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (descriptionStart == 0) {
|
|
|
|
|
if (menu[currentScreen].incrementHandler != NULL) {
|
|
|
|
|
enterGUIMenu = false;
|
|
|
|
|
lastValue = menu[currentScreen].incrementHandler();
|
|
|
|
|
|
|
|
|
|
if (enterGUIMenu)
|
|
|
|
|
{
|
|
|
|
|
if (enterGUIMenu) {
|
|
|
|
|
OLED::useSecondaryFramebuffer(true);
|
|
|
|
|
OLED::setFont(0);
|
|
|
|
|
OLED::setCursor(0, 0);
|
|
|
|
|
@@ -1164,28 +1047,22 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
OLED::transitionSecondaryFramebuffer(false);
|
|
|
|
|
}
|
|
|
|
|
enterGUIMenu = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
earlyExit = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
} else
|
|
|
|
|
descriptionStart = 0;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_B_SHORT:
|
|
|
|
|
if (descriptionStart == 0)
|
|
|
|
|
{
|
|
|
|
|
if (descriptionStart == 0) {
|
|
|
|
|
currentScreen++;
|
|
|
|
|
lastValue = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
} else
|
|
|
|
|
descriptionStart = 0;
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_F_LONG:
|
|
|
|
|
if ((int) (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration) >
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MAX)
|
|
|
|
|
{
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MAX) {
|
|
|
|
|
if ((lastValue = menu[currentScreen].incrementHandler()))
|
|
|
|
|
autoRepeatTimer = 1000;
|
|
|
|
|
else
|
|
|
|
|
@@ -1200,8 +1077,7 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
break;
|
|
|
|
|
case BUTTON_B_LONG:
|
|
|
|
|
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MAX)
|
|
|
|
|
{
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MAX) {
|
|
|
|
|
currentScreen++;
|
|
|
|
|
autoRepeatTimer = xTaskGetTickCount();
|
|
|
|
|
descriptionStart = 0;
|
|
|
|
|
@@ -1215,20 +1091,17 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) <
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MIN)
|
|
|
|
|
{
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MIN) {
|
|
|
|
|
autoRepeatAcceleration =
|
|
|
|
|
PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lcdRefresh)
|
|
|
|
|
{
|
|
|
|
|
if (lcdRefresh) {
|
|
|
|
|
OLED::refresh(); // update the LCD
|
|
|
|
|
osDelay(40);
|
|
|
|
|
lcdRefresh = false;
|
|
|
|
|
}
|
|
|
|
|
if ((xTaskGetTickCount() - lastButtonTime) > (1000 * 30))
|
|
|
|
|
{
|
|
|
|
|
if ((xTaskGetTickCount() - lastButtonTime) > (1000 * 30)) {
|
|
|
|
|
// If user has not pressed any buttons in 30 seconds, exit back a menu layer
|
|
|
|
|
// This will trickle the user back to the main screen eventually
|
|
|
|
|
earlyExit = true;
|
|
|
|
|
@@ -1237,8 +1110,7 @@ void gui_Menu(const menuitem *menu)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void enterSettingsMenu()
|
|
|
|
|
{
|
|
|
|
|
void enterSettingsMenu() {
|
|
|
|
|
gui_Menu(rootSettingsMenu); // Call the root menu
|
|
|
|
|
saveSettings();
|
|
|
|
|
}
|
|
|
|
|
|