Merge pull request #661 from paulfertser/last-value-pause
Add a pause for the last value in settings menus
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
|
|
||||||
#define PRESS_ACCEL_STEP 3
|
#define PRESS_ACCEL_STEP 30
|
||||||
#define PRESS_ACCEL_INTERVAL_MIN 100
|
#define PRESS_ACCEL_INTERVAL_MIN 100
|
||||||
#define PRESS_ACCEL_INTERVAL_MAX 300
|
#define PRESS_ACCEL_INTERVAL_MAX 300
|
||||||
|
|
||||||
@@ -19,16 +19,12 @@
|
|||||||
|
|
||||||
//Declarations for all the methods for the settings menu (at end of this file)
|
//Declarations for all the methods for the settings menu (at end of this file)
|
||||||
|
|
||||||
//Wrapper for holding a function pointer
|
|
||||||
typedef struct state_func_t {
|
|
||||||
void (*func)(void);
|
|
||||||
} state_func;
|
|
||||||
|
|
||||||
//Struct for holding the function pointers and descriptions
|
//Struct for holding the function pointers and descriptions
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *description;
|
const char *description;
|
||||||
const state_func incrementHandler;
|
// return true if increment reached the maximum value
|
||||||
const state_func draw;
|
bool (* const incrementHandler)(void);
|
||||||
|
void (* const draw)(void);
|
||||||
} menuitem;
|
} menuitem;
|
||||||
|
|
||||||
void enterSettingsMenu();
|
void enterSettingsMenu();
|
||||||
|
|||||||
@@ -18,70 +18,70 @@
|
|||||||
void gui_Menu(const menuitem *menu);
|
void gui_Menu(const menuitem *menu);
|
||||||
|
|
||||||
#ifdef MODEL_TS100
|
#ifdef MODEL_TS100
|
||||||
static void settings_setInputVRange(void);
|
static bool settings_setInputVRange(void);
|
||||||
static void settings_displayInputVRange(void);
|
static void settings_displayInputVRange(void);
|
||||||
#else
|
#else
|
||||||
static void settings_setInputPRange(void);
|
static bool settings_setInputPRange(void);
|
||||||
static void settings_displayInputPRange(void);
|
static void settings_displayInputPRange(void);
|
||||||
#endif
|
#endif
|
||||||
static void settings_setSleepTemp(void);
|
static bool settings_setSleepTemp(void);
|
||||||
static void settings_displaySleepTemp(void);
|
static void settings_displaySleepTemp(void);
|
||||||
static void settings_setSleepTime(void);
|
static bool settings_setSleepTime(void);
|
||||||
static void settings_displaySleepTime(void);
|
static void settings_displaySleepTime(void);
|
||||||
static void settings_setShutdownTime(void);
|
static bool settings_setShutdownTime(void);
|
||||||
static void settings_displayShutdownTime(void);
|
static void settings_displayShutdownTime(void);
|
||||||
static void settings_setSensitivity(void);
|
static bool settings_setSensitivity(void);
|
||||||
static void settings_displaySensitivity(void);
|
static void settings_displaySensitivity(void);
|
||||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static void settings_setTempF(void);
|
static bool settings_setTempF(void);
|
||||||
static void settings_displayTempF(void);
|
static void settings_displayTempF(void);
|
||||||
#endif
|
#endif
|
||||||
static void settings_setAdvancedSolderingScreens(void);
|
static bool settings_setAdvancedSolderingScreens(void);
|
||||||
static void settings_displayAdvancedSolderingScreens(void);
|
static void settings_displayAdvancedSolderingScreens(void);
|
||||||
static void settings_setAdvancedIDLEScreens(void);
|
static bool settings_setAdvancedIDLEScreens(void);
|
||||||
static void settings_displayAdvancedIDLEScreens(void);
|
static void settings_displayAdvancedIDLEScreens(void);
|
||||||
static void settings_setScrollSpeed(void);
|
static bool settings_setScrollSpeed(void);
|
||||||
static void settings_displayScrollSpeed(void);
|
static void settings_displayScrollSpeed(void);
|
||||||
static void settings_setPowerLimitEnable(void);
|
static bool settings_setPowerLimitEnable(void);
|
||||||
static void settings_displayPowerLimitEnable(void);
|
static void settings_displayPowerLimitEnable(void);
|
||||||
static void settings_setPowerLimit(void);
|
static bool settings_setPowerLimit(void);
|
||||||
static void settings_displayPowerLimit(void);
|
static void settings_displayPowerLimit(void);
|
||||||
static void settings_setDisplayRotation(void);
|
static bool settings_setDisplayRotation(void);
|
||||||
static void settings_displayDisplayRotation(void);
|
static void settings_displayDisplayRotation(void);
|
||||||
static void settings_setBoostModeEnabled(void);
|
static bool settings_setBoostModeEnabled(void);
|
||||||
static void settings_displayBoostModeEnabled(void);
|
static void settings_displayBoostModeEnabled(void);
|
||||||
static void settings_setBoostTemp(void);
|
static bool settings_setBoostTemp(void);
|
||||||
static void settings_displayBoostTemp(void);
|
static void settings_displayBoostTemp(void);
|
||||||
static void settings_setAutomaticStartMode(void);
|
static bool settings_setAutomaticStartMode(void);
|
||||||
static void settings_displayAutomaticStartMode(void);
|
static void settings_displayAutomaticStartMode(void);
|
||||||
static void settings_setCoolingBlinkEnabled(void);
|
static bool settings_setCoolingBlinkEnabled(void);
|
||||||
static void settings_displayCoolingBlinkEnabled(void);
|
static void settings_displayCoolingBlinkEnabled(void);
|
||||||
static void settings_setResetSettings(void);
|
static bool settings_setResetSettings(void);
|
||||||
static void settings_displayResetSettings(void);
|
static void settings_displayResetSettings(void);
|
||||||
static void settings_setCalibrate(void);
|
static bool settings_setCalibrate(void);
|
||||||
static void settings_displayCalibrate(void);
|
static void settings_displayCalibrate(void);
|
||||||
static void settings_setTipGain(void);
|
static bool settings_setTipGain(void);
|
||||||
static void settings_displayTipGain(void);
|
static void settings_displayTipGain(void);
|
||||||
static void settings_setCalibrateVIN(void);
|
static bool settings_setCalibrateVIN(void);
|
||||||
static void settings_displayCalibrateVIN(void);
|
static void settings_displayCalibrateVIN(void);
|
||||||
static void settings_displayReverseButtonTempChangeEnabled(void);
|
static void settings_displayReverseButtonTempChangeEnabled(void);
|
||||||
static void settings_setReverseButtonTempChangeEnabled(void);
|
static bool settings_setReverseButtonTempChangeEnabled(void);
|
||||||
static void settings_displayTempChangeShortStep(void);
|
static void settings_displayTempChangeShortStep(void);
|
||||||
static void settings_setTempChangeShortStep(void);
|
static bool settings_setTempChangeShortStep(void);
|
||||||
static void settings_displayTempChangeLongStep(void);
|
static void settings_displayTempChangeLongStep(void);
|
||||||
static void settings_setTempChangeLongStep(void);
|
static bool settings_setTempChangeLongStep(void);
|
||||||
static void settings_displayPowerPulse(void);
|
static void settings_displayPowerPulse(void);
|
||||||
static void settings_setPowerPulse(void);
|
static bool settings_setPowerPulse(void);
|
||||||
|
|
||||||
// Menu functions
|
// Menu functions
|
||||||
static void settings_displaySolderingMenu(void);
|
static void settings_displaySolderingMenu(void);
|
||||||
static void settings_enterSolderingMenu(void);
|
static bool settings_enterSolderingMenu(void);
|
||||||
static void settings_displayPowerMenu(void);
|
static void settings_displayPowerMenu(void);
|
||||||
static void settings_enterPowerMenu(void);
|
static bool settings_enterPowerMenu(void);
|
||||||
static void settings_displayUIMenu(void);
|
static void settings_displayUIMenu(void);
|
||||||
static void settings_enterUIMenu(void);
|
static bool settings_enterUIMenu(void);
|
||||||
static void settings_displayAdvancedMenu(void);
|
static void settings_displayAdvancedMenu(void);
|
||||||
static void settings_enterAdvancedMenu(void);
|
static bool settings_enterAdvancedMenu(void);
|
||||||
/*
|
/*
|
||||||
* Root Settings Menu
|
* Root Settings Menu
|
||||||
*
|
*
|
||||||
@@ -129,21 +129,21 @@ const menuitem rootSettingsMenu[] {
|
|||||||
* Exit
|
* Exit
|
||||||
*/
|
*/
|
||||||
#ifdef MODEL_TS100
|
#ifdef MODEL_TS100
|
||||||
{ (const char*) SettingsDescriptions[0], { settings_setInputVRange }, {
|
{ (const char*) SettingsDescriptions[0], settings_setInputVRange,
|
||||||
settings_displayInputVRange } }, /*Voltage input*/
|
settings_displayInputVRange }, /*Voltage input*/
|
||||||
#else
|
#else
|
||||||
{ (const char*) SettingsDescriptions[20], { settings_setInputPRange }, {
|
{ (const char*) SettingsDescriptions[20], settings_setInputPRange,
|
||||||
settings_displayInputPRange } }, /*Voltage input*/
|
settings_displayInputPRange }, /*Voltage input*/
|
||||||
#endif
|
#endif
|
||||||
{ (const char*) NULL, { settings_enterSolderingMenu }, {
|
{ (const char*) NULL, settings_enterSolderingMenu,
|
||||||
settings_displaySolderingMenu } }, /*Soldering*/
|
settings_displaySolderingMenu }, /*Soldering*/
|
||||||
{ (const char*) NULL, { settings_enterPowerMenu }, {
|
{ (const char*) NULL, settings_enterPowerMenu,
|
||||||
settings_displayPowerMenu } }, /*Sleep Options Menu*/
|
settings_displayPowerMenu }, /*Sleep Options Menu*/
|
||||||
{ (const char*) NULL, { settings_enterUIMenu },
|
{ (const char*) NULL, settings_enterUIMenu,
|
||||||
{ settings_displayUIMenu } }, /*UI Menu*/
|
settings_displayUIMenu }, /*UI Menu*/
|
||||||
{ (const char*) NULL, { settings_enterAdvancedMenu }, {
|
{ (const char*) NULL, settings_enterAdvancedMenu,
|
||||||
settings_displayAdvancedMenu } }, /*Advanced Menu*/
|
settings_displayAdvancedMenu }, /*Advanced Menu*/
|
||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ NULL, NULL , NULL } // end of menu marker. DO NOT REMOVE
|
||||||
};
|
};
|
||||||
|
|
||||||
const menuitem solderingMenu[] = {
|
const menuitem solderingMenu[] = {
|
||||||
@@ -154,17 +154,17 @@ const menuitem solderingMenu[] = {
|
|||||||
* Temp change short step
|
* Temp change short step
|
||||||
* Temp change long step
|
* Temp change long step
|
||||||
*/
|
*/
|
||||||
{ (const char*) SettingsDescriptions[8], { settings_setBoostModeEnabled }, {
|
{ (const char*) SettingsDescriptions[8], settings_setBoostModeEnabled,
|
||||||
settings_displayBoostModeEnabled } }, /*Enable Boost*/
|
settings_displayBoostModeEnabled }, /*Enable Boost*/
|
||||||
{ (const char*) SettingsDescriptions[9], { settings_setBoostTemp }, {
|
{ (const char*) SettingsDescriptions[9], settings_setBoostTemp,
|
||||||
settings_displayBoostTemp } }, /*Boost Temp*/
|
settings_displayBoostTemp }, /*Boost Temp*/
|
||||||
{ (const char*) SettingsDescriptions[10], { settings_setAutomaticStartMode }, {
|
{ (const char*) SettingsDescriptions[10], settings_setAutomaticStartMode,
|
||||||
settings_displayAutomaticStartMode } }, /*Auto start*/
|
settings_displayAutomaticStartMode }, /*Auto start*/
|
||||||
{ (const char*) SettingsDescriptions[24], { settings_setTempChangeShortStep }, {
|
{ (const char*) SettingsDescriptions[24], settings_setTempChangeShortStep,
|
||||||
settings_displayTempChangeShortStep } }, /*Temp change short step*/
|
settings_displayTempChangeShortStep }, /*Temp change short step*/
|
||||||
{ (const char*) SettingsDescriptions[25], { settings_setTempChangeLongStep }, {
|
{ (const char*) SettingsDescriptions[25], settings_setTempChangeLongStep,
|
||||||
settings_displayTempChangeLongStep } }, /*Temp change long step*/
|
settings_displayTempChangeLongStep }, /*Temp change long step*/
|
||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
||||||
};
|
};
|
||||||
const menuitem UIMenu[] = {
|
const menuitem UIMenu[] = {
|
||||||
/*
|
/*
|
||||||
@@ -176,21 +176,21 @@ const menuitem UIMenu[] = {
|
|||||||
* Reverse Temp change buttons + -
|
* Reverse Temp change buttons + -
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
|
{ (const char*) SettingsDescriptions[5], settings_setTempF,
|
||||||
settings_displayTempF } }, /* Temperature units*/
|
settings_displayTempF }, /* Temperature units*/
|
||||||
#endif
|
#endif
|
||||||
{ (const char*) SettingsDescriptions[7],
|
{ (const char*) SettingsDescriptions[7],
|
||||||
{ settings_setDisplayRotation }, {
|
settings_setDisplayRotation,
|
||||||
settings_displayDisplayRotation } }, /*Display Rotation*/
|
settings_displayDisplayRotation }, /*Display Rotation*/
|
||||||
{ (const char*) SettingsDescriptions[11], {
|
{ (const char*) SettingsDescriptions[11],
|
||||||
settings_setCoolingBlinkEnabled }, {
|
settings_setCoolingBlinkEnabled,
|
||||||
settings_displayCoolingBlinkEnabled } }, /*Cooling blink warning*/
|
settings_displayCoolingBlinkEnabled }, /*Cooling blink warning*/
|
||||||
{ (const char*) SettingsDescriptions[16], { settings_setScrollSpeed }, {
|
{ (const char*) SettingsDescriptions[16], settings_setScrollSpeed,
|
||||||
settings_displayScrollSpeed } }, /*Scroll Speed for descriptions*/
|
settings_displayScrollSpeed }, /*Scroll Speed for descriptions*/
|
||||||
{ (const char*) SettingsDescriptions[23], {
|
{ (const char*) SettingsDescriptions[23],
|
||||||
settings_setReverseButtonTempChangeEnabled }, {
|
settings_setReverseButtonTempChangeEnabled,
|
||||||
settings_displayReverseButtonTempChangeEnabled } }, /* Reverse Temp change buttons + - */
|
settings_displayReverseButtonTempChangeEnabled }, /* Reverse Temp change buttons + - */
|
||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
||||||
};
|
};
|
||||||
const menuitem PowerMenu[] = {
|
const menuitem PowerMenu[] = {
|
||||||
/*
|
/*
|
||||||
@@ -199,15 +199,15 @@ const menuitem PowerMenu[] = {
|
|||||||
* Shutdown Time
|
* Shutdown Time
|
||||||
* Motion Sensitivity
|
* Motion Sensitivity
|
||||||
*/
|
*/
|
||||||
{ (const char*) SettingsDescriptions[1], { settings_setSleepTemp }, {
|
{ (const char*) SettingsDescriptions[1], settings_setSleepTemp,
|
||||||
settings_displaySleepTemp } }, /*Sleep Temp*/
|
settings_displaySleepTemp }, /*Sleep Temp*/
|
||||||
{ (const char*) SettingsDescriptions[2], { settings_setSleepTime }, {
|
{ (const char*) SettingsDescriptions[2], settings_setSleepTime,
|
||||||
settings_displaySleepTime } }, /*Sleep Time*/
|
settings_displaySleepTime }, /*Sleep Time*/
|
||||||
{ (const char*) SettingsDescriptions[3], { settings_setShutdownTime }, {
|
{ (const char*) SettingsDescriptions[3], settings_setShutdownTime,
|
||||||
settings_displayShutdownTime } }, /*Shutdown Time*/
|
settings_displayShutdownTime }, /*Shutdown Time*/
|
||||||
{ (const char*) SettingsDescriptions[4], { settings_setSensitivity }, {
|
{ (const char*) SettingsDescriptions[4], settings_setSensitivity,
|
||||||
settings_displaySensitivity } }, /* Motion Sensitivity*/
|
settings_displaySensitivity }, /* Motion Sensitivity*/
|
||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
||||||
};
|
};
|
||||||
const menuitem advancedMenu[] = {
|
const menuitem advancedMenu[] = {
|
||||||
|
|
||||||
@@ -221,26 +221,26 @@ const menuitem advancedMenu[] = {
|
|||||||
* Reset Settings
|
* Reset Settings
|
||||||
* Power Pulse
|
* Power Pulse
|
||||||
*/
|
*/
|
||||||
{ (const char*) SettingsDescriptions[21], { settings_setPowerLimitEnable }, {
|
{ (const char*) SettingsDescriptions[21], settings_setPowerLimitEnable,
|
||||||
settings_displayPowerLimitEnable } }, /*Power limit enable*/
|
settings_displayPowerLimitEnable }, /*Power limit enable*/
|
||||||
{ (const char*) SettingsDescriptions[22], { settings_setPowerLimit }, {
|
{ (const char*) SettingsDescriptions[22], settings_setPowerLimit,
|
||||||
settings_displayPowerLimit } }, /*Power limit*/
|
settings_displayPowerLimit }, /*Power limit*/
|
||||||
{ (const char*) SettingsDescriptions[6], { settings_setAdvancedIDLEScreens }, {
|
{ (const char*) SettingsDescriptions[6], settings_setAdvancedIDLEScreens,
|
||||||
settings_displayAdvancedIDLEScreens } }, /* Advanced idle screen*/
|
settings_displayAdvancedIDLEScreens }, /* Advanced idle screen*/
|
||||||
{ (const char*) SettingsDescriptions[15],
|
{ (const char*) SettingsDescriptions[15],
|
||||||
{ settings_setAdvancedSolderingScreens }, {
|
settings_setAdvancedSolderingScreens,
|
||||||
settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
|
settings_displayAdvancedSolderingScreens }, /* Advanced soldering screen*/
|
||||||
{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
|
{ (const char*) SettingsDescriptions[13], settings_setResetSettings,
|
||||||
settings_displayResetSettings } }, /*Resets settings*/
|
settings_displayResetSettings }, /*Resets settings*/
|
||||||
{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
|
{ (const char*) SettingsDescriptions[12], settings_setCalibrate,
|
||||||
settings_displayCalibrate } }, /*Calibrate tip*/
|
settings_displayCalibrate }, /*Calibrate tip*/
|
||||||
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
|
{ (const char*) SettingsDescriptions[14], settings_setCalibrateVIN,
|
||||||
settings_displayCalibrateVIN } }, /*Voltage input cal*/
|
settings_displayCalibrateVIN }, /*Voltage input cal*/
|
||||||
{ (const char*) SettingsDescriptions[26], { settings_setPowerPulse }, {
|
{ (const char*) SettingsDescriptions[26], settings_setPowerPulse,
|
||||||
settings_displayPowerPulse } }, /*Power Pulse adjustment */
|
settings_displayPowerPulse }, /*Power Pulse adjustment */
|
||||||
{ (const char*) SettingsDescriptions[27], { settings_setTipGain }, {
|
{ (const char*) SettingsDescriptions[27], settings_setTipGain,
|
||||||
settings_displayTipGain } }, /*TipGain*/
|
settings_displayTipGain }, /*TipGain*/
|
||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
||||||
};
|
};
|
||||||
|
|
||||||
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
|
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
|
||||||
@@ -329,10 +329,11 @@ static int userConfirmation(const char *message) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef MODEL_TS100
|
#ifdef MODEL_TS100
|
||||||
static void settings_setInputVRange(void) {
|
static bool settings_setInputVRange(void) {
|
||||||
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
||||||
if (systemSettings.cutoutSetting)
|
if (systemSettings.cutoutSetting)
|
||||||
systemSettings.powerLimitEnable = 0; // disable power limit if switching to a lipo power source
|
systemSettings.powerLimitEnable = 0; // disable power limit if switching to a lipo power source
|
||||||
|
return systemSettings.cutoutSetting == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayInputVRange(void) {
|
static void settings_displayInputVRange(void) {
|
||||||
@@ -346,8 +347,9 @@ static void settings_displayInputVRange(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void settings_setInputPRange(void) {
|
static bool settings_setInputPRange(void) {
|
||||||
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 2;
|
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 2;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayInputPRange(void) {
|
static void settings_displayInputPRange(void) {
|
||||||
@@ -370,19 +372,21 @@ static void settings_displayInputPRange(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
static void settings_setSleepTemp(void) {
|
static bool settings_setSleepTemp(void) {
|
||||||
// If in C, 10 deg, if in F 20 deg
|
// If in C, 10 deg, if in F 20 deg
|
||||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
systemSettings.SleepTemp += 20;
|
systemSettings.SleepTemp += 20;
|
||||||
if (systemSettings.SleepTemp > 580)
|
if (systemSettings.SleepTemp > 580)
|
||||||
systemSettings.SleepTemp = 60;
|
systemSettings.SleepTemp = 60;
|
||||||
|
return systemSettings.SleepTemp == 580;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
systemSettings.SleepTemp += 10;
|
systemSettings.SleepTemp += 10;
|
||||||
if (systemSettings.SleepTemp > 300)
|
if (systemSettings.SleepTemp > 300)
|
||||||
systemSettings.SleepTemp = 10;
|
systemSettings.SleepTemp = 10;
|
||||||
|
return systemSettings.SleepTemp == 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +395,7 @@ static void settings_displaySleepTemp(void) {
|
|||||||
OLED::printNumber(systemSettings.SleepTemp, 3);
|
OLED::printNumber(systemSettings.SleepTemp, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setSleepTime(void) {
|
static bool settings_setSleepTime(void) {
|
||||||
systemSettings.SleepTime++; // Go up 1 minute at a time
|
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
|
systemSettings.SleepTime = 0; // can't set time over 10 mins
|
||||||
@@ -399,6 +403,7 @@ static void settings_setSleepTime(void) {
|
|||||||
// Remember that ^ is the time of no movement
|
// Remember that ^ is the time of no movement
|
||||||
if (PCBVersion == 3)
|
if (PCBVersion == 3)
|
||||||
systemSettings.SleepTime = 0; // Disable sleep on no accel
|
systemSettings.SleepTime = 0; // Disable sleep on no accel
|
||||||
|
return systemSettings.SleepTime == 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displaySleepTime(void) {
|
static void settings_displaySleepTime(void) {
|
||||||
@@ -414,13 +419,14 @@ static void settings_displaySleepTime(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setShutdownTime(void) {
|
static bool settings_setShutdownTime(void) {
|
||||||
systemSettings.ShutdownTime++;
|
systemSettings.ShutdownTime++;
|
||||||
if (systemSettings.ShutdownTime > 60) {
|
if (systemSettings.ShutdownTime > 60) {
|
||||||
systemSettings.ShutdownTime = 0; // wrap to off
|
systemSettings.ShutdownTime = 0; // wrap to off
|
||||||
}
|
}
|
||||||
if (PCBVersion == 3)
|
if (PCBVersion == 3)
|
||||||
systemSettings.ShutdownTime = 0; // Disable shutdown on no accel
|
systemSettings.ShutdownTime = 0; // Disable shutdown on no accel
|
||||||
|
return systemSettings.ShutdownTime == 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayShutdownTime(void) {
|
static void settings_displayShutdownTime(void) {
|
||||||
@@ -433,7 +439,7 @@ static void settings_displayShutdownTime(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static void settings_setTempF(void) {
|
static bool settings_setTempF(void) {
|
||||||
systemSettings.temperatureInF = !systemSettings.temperatureInF;
|
systemSettings.temperatureInF = !systemSettings.temperatureInF;
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
// Change sleep, boost and soldering temps to the F equiv
|
// Change sleep, boost and soldering temps to the F equiv
|
||||||
@@ -457,6 +463,7 @@ static void settings_setTempF(void) {
|
|||||||
systemSettings.SolderingTemp *= 10;
|
systemSettings.SolderingTemp *= 10;
|
||||||
systemSettings.SleepTemp = systemSettings.SleepTemp / 10;
|
systemSettings.SleepTemp = systemSettings.SleepTemp / 10;
|
||||||
systemSettings.SleepTemp *= 10;
|
systemSettings.SleepTemp *= 10;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayTempF(void) {
|
static void settings_displayTempF(void) {
|
||||||
@@ -466,9 +473,10 @@ static void settings_displayTempF(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void settings_setSensitivity(void) {
|
static bool settings_setSensitivity(void) {
|
||||||
systemSettings.sensitivity++;
|
systemSettings.sensitivity++;
|
||||||
systemSettings.sensitivity = systemSettings.sensitivity % 10;
|
systemSettings.sensitivity = systemSettings.sensitivity % 10;
|
||||||
|
return systemSettings.sensitivity == 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displaySensitivity(void) {
|
static void settings_displaySensitivity(void) {
|
||||||
@@ -476,8 +484,9 @@ static void settings_displaySensitivity(void) {
|
|||||||
OLED::printNumber(systemSettings.sensitivity, 1, false);
|
OLED::printNumber(systemSettings.sensitivity, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setAdvancedSolderingScreens(void) {
|
static bool settings_setAdvancedSolderingScreens(void) {
|
||||||
systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
|
systemSettings.detailedSoldering = !systemSettings.detailedSoldering;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayAdvancedSolderingScreens(void) {
|
static void settings_displayAdvancedSolderingScreens(void) {
|
||||||
@@ -486,8 +495,9 @@ static void settings_displayAdvancedSolderingScreens(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.detailedSoldering);
|
OLED::drawCheckbox(systemSettings.detailedSoldering);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setAdvancedIDLEScreens(void) {
|
static bool settings_setAdvancedIDLEScreens(void) {
|
||||||
systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
|
systemSettings.detailedIDLE = !systemSettings.detailedIDLE;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayAdvancedIDLEScreens(void) {
|
static void settings_displayAdvancedIDLEScreens(void) {
|
||||||
@@ -496,8 +506,9 @@ static void settings_displayAdvancedIDLEScreens(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.detailedIDLE);
|
OLED::drawCheckbox(systemSettings.detailedIDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setPowerLimitEnable(void) {
|
static bool settings_setPowerLimitEnable(void) {
|
||||||
systemSettings.powerLimitEnable = !systemSettings.powerLimitEnable;
|
systemSettings.powerLimitEnable = !systemSettings.powerLimitEnable;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayPowerLimitEnable(void) {
|
static void settings_displayPowerLimitEnable(void) {
|
||||||
@@ -505,11 +516,11 @@ static void settings_displayPowerLimitEnable(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.powerLimitEnable);
|
OLED::drawCheckbox(systemSettings.powerLimitEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setPowerLimit(void) {
|
static bool settings_setPowerLimit(void) {
|
||||||
if (systemSettings.powerLimit >= MAX_POWER_LIMIT)
|
systemSettings.powerLimit += POWER_LIMIT_STEPS;
|
||||||
|
if (systemSettings.powerLimit > MAX_POWER_LIMIT)
|
||||||
systemSettings.powerLimit = POWER_LIMIT_STEPS;
|
systemSettings.powerLimit = POWER_LIMIT_STEPS;
|
||||||
else
|
return systemSettings.powerLimit + POWER_LIMIT_STEPS > MAX_POWER_LIMIT;
|
||||||
systemSettings.powerLimit += POWER_LIMIT_STEPS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayPowerLimit(void) {
|
static void settings_displayPowerLimit(void) {
|
||||||
@@ -518,12 +529,14 @@ static void settings_displayPowerLimit(void) {
|
|||||||
OLED::print(SymbolWatts);
|
OLED::print(SymbolWatts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setScrollSpeed(void) {
|
static bool settings_setScrollSpeed(void) {
|
||||||
if (systemSettings.descriptionScrollSpeed == 0)
|
if (systemSettings.descriptionScrollSpeed == 0)
|
||||||
systemSettings.descriptionScrollSpeed = 1;
|
systemSettings.descriptionScrollSpeed = 1;
|
||||||
else
|
else
|
||||||
systemSettings.descriptionScrollSpeed = 0;
|
systemSettings.descriptionScrollSpeed = 0;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayScrollSpeed(void) {
|
static void settings_displayScrollSpeed(void) {
|
||||||
printShortDescription(16, 7);
|
printShortDescription(16, 7);
|
||||||
OLED::print(
|
OLED::print(
|
||||||
@@ -531,7 +544,7 @@ static void settings_displayScrollSpeed(void) {
|
|||||||
SettingFastChar : SettingSlowChar);
|
SettingFastChar : SettingSlowChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setDisplayRotation(void) {
|
static bool settings_setDisplayRotation(void) {
|
||||||
systemSettings.OrientationMode++;
|
systemSettings.OrientationMode++;
|
||||||
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
|
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
|
||||||
switch (systemSettings.OrientationMode) {
|
switch (systemSettings.OrientationMode) {
|
||||||
@@ -547,6 +560,7 @@ static void settings_setDisplayRotation(void) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return systemSettings.OrientationMode == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayDisplayRotation(void) {
|
static void settings_displayDisplayRotation(void) {
|
||||||
@@ -568,8 +582,9 @@ static void settings_displayDisplayRotation(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setBoostModeEnabled(void) {
|
static bool settings_setBoostModeEnabled(void) {
|
||||||
systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
|
systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayBoostModeEnabled(void) {
|
static void settings_displayBoostModeEnabled(void) {
|
||||||
@@ -578,13 +593,14 @@ static void settings_displayBoostModeEnabled(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.boostModeEnabled);
|
OLED::drawCheckbox(systemSettings.boostModeEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setBoostTemp(void) {
|
static bool settings_setBoostTemp(void) {
|
||||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
systemSettings.BoostTemp += 20; // Go up 20F at a time
|
systemSettings.BoostTemp += 20; // Go up 20F at a time
|
||||||
if (systemSettings.BoostTemp > 850) {
|
if (systemSettings.BoostTemp > 850) {
|
||||||
systemSettings.BoostTemp = 480; // loop back at 250
|
systemSettings.BoostTemp = 480;
|
||||||
}
|
}
|
||||||
|
return systemSettings.BoostTemp == 840;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -592,6 +608,7 @@ static void settings_setBoostTemp(void) {
|
|||||||
if (systemSettings.BoostTemp > 450) {
|
if (systemSettings.BoostTemp > 450) {
|
||||||
systemSettings.BoostTemp = 250; // loop back at 250
|
systemSettings.BoostTemp = 250; // loop back at 250
|
||||||
}
|
}
|
||||||
|
return systemSettings.BoostTemp == 450;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,9 +617,10 @@ static void settings_displayBoostTemp(void) {
|
|||||||
OLED::printNumber(systemSettings.BoostTemp, 3);
|
OLED::printNumber(systemSettings.BoostTemp, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setAutomaticStartMode(void) {
|
static bool settings_setAutomaticStartMode(void) {
|
||||||
systemSettings.autoStartMode++;
|
systemSettings.autoStartMode++;
|
||||||
systemSettings.autoStartMode %= 4;
|
systemSettings.autoStartMode %= 4;
|
||||||
|
return systemSettings.autoStartMode == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayAutomaticStartMode(void) {
|
static void settings_displayAutomaticStartMode(void) {
|
||||||
@@ -627,8 +645,9 @@ static void settings_displayAutomaticStartMode(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setCoolingBlinkEnabled(void) {
|
static bool settings_setCoolingBlinkEnabled(void) {
|
||||||
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
|
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayCoolingBlinkEnabled(void) {
|
static void settings_displayCoolingBlinkEnabled(void) {
|
||||||
@@ -637,7 +656,7 @@ static void settings_displayCoolingBlinkEnabled(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.coolingTempBlink);
|
OLED::drawCheckbox(systemSettings.coolingTempBlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setResetSettings(void) {
|
static bool settings_setResetSettings(void) {
|
||||||
if (userConfirmation(SettingsResetWarning)) {
|
if (userConfirmation(SettingsResetWarning)) {
|
||||||
resetSettings();
|
resetSettings();
|
||||||
|
|
||||||
@@ -648,6 +667,7 @@ static void settings_setResetSettings(void) {
|
|||||||
|
|
||||||
waitForButtonPressOrTimeout(2000); // 2 second timeout
|
waitForButtonPressOrTimeout(2000); // 2 second timeout
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayResetSettings(void) {
|
static void settings_displayResetSettings(void) {
|
||||||
@@ -686,20 +706,21 @@ static void setTipOffset() {
|
|||||||
|
|
||||||
//Provide the user the option to tune their own tip if custom is selected
|
//Provide the user the option to tune their own tip if custom is selected
|
||||||
//If not only do single point tuning as per usual
|
//If not only do single point tuning as per usual
|
||||||
static void settings_setCalibrate(void) {
|
static bool settings_setCalibrate(void) {
|
||||||
|
|
||||||
if (userConfirmation(SettingsCalibrationWarning)) {
|
if (userConfirmation(SettingsCalibrationWarning)) {
|
||||||
// User confirmed
|
// User confirmed
|
||||||
// So we now perform the actual calculation
|
// So we now perform the actual calculation
|
||||||
setTipOffset();
|
setTipOffset();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayCalibrate(void) {
|
static void settings_displayCalibrate(void) {
|
||||||
printShortDescription(12, 5);
|
printShortDescription(12, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setCalibrateVIN(void) {
|
static bool settings_setCalibrateVIN(void) {
|
||||||
// Jump to the voltage calibration subscreen
|
// Jump to the voltage calibration subscreen
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
@@ -732,8 +753,7 @@ static void settings_setCalibrateVIN(void) {
|
|||||||
OLED::printNumber(systemSettings.voltageDiv, 3);
|
OLED::printNumber(systemSettings.voltageDiv, 3);
|
||||||
OLED::refresh();
|
OLED::refresh();
|
||||||
waitForButtonPressOrTimeout(1000);
|
waitForButtonPressOrTimeout(1000);
|
||||||
return;
|
return false;
|
||||||
break;
|
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -757,9 +777,10 @@ static void settings_setCalibrateVIN(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setTipGain(void) {
|
static bool settings_setTipGain(void) {
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
|
|
||||||
@@ -783,8 +804,7 @@ static void settings_setTipGain(void) {
|
|||||||
case BUTTON_F_LONG:
|
case BUTTON_F_LONG:
|
||||||
case BUTTON_B_LONG:
|
case BUTTON_B_LONG:
|
||||||
saveSettings();
|
saveSettings();
|
||||||
return;
|
return false;
|
||||||
break;
|
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -800,15 +820,17 @@ static void settings_setTipGain(void) {
|
|||||||
systemSettings.TipGain = 300;
|
systemSettings.TipGain = 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayTipGain(void) {
|
static void settings_displayTipGain(void) {
|
||||||
printShortDescription(27, 5);
|
printShortDescription(27, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setReverseButtonTempChangeEnabled(void) {
|
static bool settings_setReverseButtonTempChangeEnabled(void) {
|
||||||
systemSettings.ReverseButtonTempChangeEnabled =
|
systemSettings.ReverseButtonTempChangeEnabled =
|
||||||
!systemSettings.ReverseButtonTempChangeEnabled;
|
!systemSettings.ReverseButtonTempChangeEnabled;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_displayReverseButtonTempChangeEnabled(void) {
|
static void settings_displayReverseButtonTempChangeEnabled(void) {
|
||||||
@@ -816,32 +838,37 @@ static void settings_displayReverseButtonTempChangeEnabled(void) {
|
|||||||
OLED::drawCheckbox(systemSettings.ReverseButtonTempChangeEnabled);
|
OLED::drawCheckbox(systemSettings.ReverseButtonTempChangeEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setTempChangeShortStep(void) {
|
static bool settings_setTempChangeShortStep(void) {
|
||||||
systemSettings.TempChangeShortStep += TEMP_CHANGE_SHORT_STEP;
|
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
|
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(24, 6);
|
printShortDescription(24, 6);
|
||||||
OLED::printNumber(systemSettings.TempChangeShortStep, 2);
|
OLED::printNumber(systemSettings.TempChangeShortStep, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setTempChangeLongStep(void) {
|
static bool settings_setTempChangeLongStep(void) {
|
||||||
systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP;
|
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
|
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(25, 6);
|
printShortDescription(25, 6);
|
||||||
OLED::printNumber(systemSettings.TempChangeLongStep, 2);
|
OLED::printNumber(systemSettings.TempChangeLongStep, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setPowerPulse(void) {
|
static bool settings_setPowerPulse(void) {
|
||||||
systemSettings.KeepAwakePulse += POWER_PULSE_INCREMENT;
|
systemSettings.KeepAwakePulse += POWER_PULSE_INCREMENT;
|
||||||
systemSettings.KeepAwakePulse %= POWER_PULSE_MAX;
|
systemSettings.KeepAwakePulse %= POWER_PULSE_MAX;
|
||||||
|
|
||||||
|
return systemSettings.KeepAwakePulse == POWER_PULSE_MAX - 1;
|
||||||
}
|
}
|
||||||
static void settings_displayPowerPulse(void) {
|
static void settings_displayPowerPulse(void) {
|
||||||
printShortDescription(26, 5);
|
printShortDescription(26, 5);
|
||||||
@@ -873,26 +900,30 @@ static void settings_displayCalibrateVIN(void) {
|
|||||||
static void settings_displaySolderingMenu(void) {
|
static void settings_displaySolderingMenu(void) {
|
||||||
displayMenu(0);
|
displayMenu(0);
|
||||||
}
|
}
|
||||||
static void settings_enterSolderingMenu(void) {
|
static bool settings_enterSolderingMenu(void) {
|
||||||
gui_Menu(solderingMenu);
|
gui_Menu(solderingMenu);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
static void settings_displayPowerMenu(void) {
|
static void settings_displayPowerMenu(void) {
|
||||||
displayMenu(1);
|
displayMenu(1);
|
||||||
}
|
}
|
||||||
static void settings_enterPowerMenu(void) {
|
static bool settings_enterPowerMenu(void) {
|
||||||
gui_Menu(PowerMenu);
|
gui_Menu(PowerMenu);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
static void settings_displayUIMenu(void) {
|
static void settings_displayUIMenu(void) {
|
||||||
displayMenu(2);
|
displayMenu(2);
|
||||||
}
|
}
|
||||||
static void settings_enterUIMenu(void) {
|
static bool settings_enterUIMenu(void) {
|
||||||
gui_Menu(UIMenu);
|
gui_Menu(UIMenu);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
static void settings_displayAdvancedMenu(void) {
|
static void settings_displayAdvancedMenu(void) {
|
||||||
displayMenu(3);
|
displayMenu(3);
|
||||||
}
|
}
|
||||||
static void settings_enterAdvancedMenu(void) {
|
static bool settings_enterAdvancedMenu(void) {
|
||||||
gui_Menu(advancedMenu);
|
gui_Menu(advancedMenu);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_Menu(const menuitem *menu) {
|
void gui_Menu(const menuitem *menu) {
|
||||||
@@ -908,13 +939,15 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
static bool enterGUIMenu = true;
|
static bool enterGUIMenu = true;
|
||||||
enterGUIMenu = true;
|
enterGUIMenu = true;
|
||||||
uint8_t scrollContentSize = 0;
|
uint8_t scrollContentSize = 0;
|
||||||
|
bool scrollBlink = false;
|
||||||
|
bool lastValue = false;
|
||||||
|
|
||||||
for (uint8_t i = 0; menu[i].draw.func != NULL; i++) {
|
for (uint8_t i = 0; menu[i].draw != NULL; i++) {
|
||||||
scrollContentSize += 1;
|
scrollContentSize += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animated menu opening.
|
// Animated menu opening.
|
||||||
if (menu[currentScreen].draw.func != NULL) {
|
if (menu[currentScreen].draw != NULL) {
|
||||||
// This menu is drawn in a secondary framebuffer.
|
// This menu is drawn in a secondary framebuffer.
|
||||||
// Then we play a transition from the current primary
|
// Then we play a transition from the current primary
|
||||||
// framebuffer to the new buffer.
|
// framebuffer to the new buffer.
|
||||||
@@ -923,12 +956,12 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::setCursor(0, 0);
|
OLED::setCursor(0, 0);
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
menu[currentScreen].draw.func();
|
menu[currentScreen].draw();
|
||||||
OLED::useSecondaryFramebuffer(false);
|
OLED::useSecondaryFramebuffer(false);
|
||||||
OLED::transitionSecondaryFramebuffer(true);
|
OLED::transitionSecondaryFramebuffer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
|
while ((menu[currentScreen].draw != NULL) && earlyExit == false) {
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::setCursor(0, 0);
|
OLED::setCursor(0, 0);
|
||||||
// If the user has hesitated for >=3 seconds, show the long text
|
// If the user has hesitated for >=3 seconds, show the long text
|
||||||
@@ -936,10 +969,13 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
if ((xTaskGetTickCount() - lastButtonTime < 3000)
|
if ((xTaskGetTickCount() - lastButtonTime < 3000)
|
||||||
|| menu[currentScreen].description == NULL) {
|
|| menu[currentScreen].description == NULL) {
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
menu[currentScreen].draw.func();
|
menu[currentScreen].draw();
|
||||||
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
|
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
|
||||||
uint8_t position = OLED_HEIGHT * currentScreen / scrollContentSize;
|
uint8_t position = OLED_HEIGHT * currentScreen / scrollContentSize;
|
||||||
OLED::drawScrollIndicator(position, indicatorHeight);
|
if (lastValue)
|
||||||
|
scrollBlink = !scrollBlink;
|
||||||
|
if (!lastValue || !scrollBlink)
|
||||||
|
OLED::drawScrollIndicator(position, indicatorHeight);
|
||||||
lastOffset = -1;
|
lastOffset = -1;
|
||||||
lcdRefresh = true;
|
lcdRefresh = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -978,16 +1014,16 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
case BUTTON_F_SHORT:
|
case BUTTON_F_SHORT:
|
||||||
// increment
|
// increment
|
||||||
if (descriptionStart == 0) {
|
if (descriptionStart == 0) {
|
||||||
if (menu[currentScreen].incrementHandler.func != NULL) {
|
if (menu[currentScreen].incrementHandler != NULL) {
|
||||||
enterGUIMenu = false;
|
enterGUIMenu = false;
|
||||||
menu[currentScreen].incrementHandler.func();
|
lastValue = menu[currentScreen].incrementHandler();
|
||||||
|
|
||||||
if (enterGUIMenu) {
|
if (enterGUIMenu) {
|
||||||
OLED::useSecondaryFramebuffer(true);
|
OLED::useSecondaryFramebuffer(true);
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::setCursor(0, 0);
|
OLED::setCursor(0, 0);
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
menu[currentScreen].draw.func();
|
menu[currentScreen].draw();
|
||||||
OLED::useSecondaryFramebuffer(false);
|
OLED::useSecondaryFramebuffer(false);
|
||||||
OLED::transitionSecondaryFramebuffer(false);
|
OLED::transitionSecondaryFramebuffer(false);
|
||||||
}
|
}
|
||||||
@@ -999,16 +1035,22 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
descriptionStart = 0;
|
descriptionStart = 0;
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_SHORT:
|
case BUTTON_B_SHORT:
|
||||||
if (descriptionStart == 0)
|
if (descriptionStart == 0) {
|
||||||
currentScreen++;
|
currentScreen++;
|
||||||
else
|
lastValue = false;
|
||||||
|
} else
|
||||||
descriptionStart = 0;
|
descriptionStart = 0;
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_LONG:
|
case BUTTON_F_LONG:
|
||||||
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
|
if ((int)(xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration) >
|
||||||
PRESS_ACCEL_INTERVAL_MAX) {
|
PRESS_ACCEL_INTERVAL_MAX) {
|
||||||
menu[currentScreen].incrementHandler.func();
|
if ((lastValue = menu[currentScreen].incrementHandler()))
|
||||||
autoRepeatTimer = xTaskGetTickCount();
|
autoRepeatTimer = 1000;
|
||||||
|
else
|
||||||
|
autoRepeatTimer = 0;
|
||||||
|
|
||||||
|
autoRepeatTimer += xTaskGetTickCount();
|
||||||
|
|
||||||
descriptionStart = 0;
|
descriptionStart = 0;
|
||||||
|
|
||||||
autoRepeatAcceleration += PRESS_ACCEL_STEP;
|
autoRepeatAcceleration += PRESS_ACCEL_STEP;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1
|
#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1
|
||||||
#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10
|
#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10
|
||||||
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
|
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
|
||||||
#define TEMP_CHANGE_LONG_STEP_MAX 100 // Temp change long step MAX value
|
#define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value
|
||||||
|
|
||||||
/* Power pulse for keeping power banks awake*/
|
/* Power pulse for keeping power banks awake*/
|
||||||
#define POWER_PULSE_INCREMENT 1
|
#define POWER_PULSE_INCREMENT 1
|
||||||
|
|||||||
Reference in New Issue
Block a user