mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Refactoring: unify the names of the variables related to ReverseButtonMenu handling and add the option to the end of the settings struct to avoid the collisions on factory resets
This commit is contained in:
@@ -76,7 +76,7 @@ enum SettingsOptions {
|
|||||||
ProfileCooldownSpeed = 52, // Maximum allowed cooldown speed in degrees per second
|
ProfileCooldownSpeed = 52, // Maximum allowed cooldown speed in degrees per second
|
||||||
HallEffectSleepTime = 53, // Seconds (/5) timeout to sleep when hall effect over threshold
|
HallEffectSleepTime = 53, // Seconds (/5) timeout to sleep when hall effect over threshold
|
||||||
SolderingTipType = 54, // Selecting the type of soldering tip fitted
|
SolderingTipType = 54, // Selecting the type of soldering tip fitted
|
||||||
ReverseButtonNavEnabled = 55, // Change the A and B button assigment in menus
|
ReverseButtonMenu = 55, // Change the A and B button assigment in menus
|
||||||
//
|
//
|
||||||
SettingsOptionsLength = 56, // End marker
|
SettingsOptionsLength = 56, // End marker
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ enum class SettingsItemIndex : uint8_t {
|
|||||||
CooldownBlink,
|
CooldownBlink,
|
||||||
ScrollingSpeed,
|
ScrollingSpeed,
|
||||||
ReverseButtonTempChange,
|
ReverseButtonTempChange,
|
||||||
ReverseButtonNav,
|
|
||||||
AnimSpeed,
|
AnimSpeed,
|
||||||
AnimLoop,
|
AnimLoop,
|
||||||
Brightness,
|
Brightness,
|
||||||
@@ -108,6 +107,7 @@ enum class SettingsItemIndex : uint8_t {
|
|||||||
SettingsReset,
|
SettingsReset,
|
||||||
LanguageSwitch,
|
LanguageSwitch,
|
||||||
SolderingTipType,
|
SolderingTipType,
|
||||||
|
ReverseButtonMenu,
|
||||||
NUM_ITEMS,
|
NUM_ITEMS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
|
|||||||
{MIN_CALIBRATION_OFFSET, 2500, 1, CALIBRATION_OFFSET}, // CalibrationOffset
|
{MIN_CALIBRATION_OFFSET, 2500, 1, CALIBRATION_OFFSET}, // CalibrationOffset
|
||||||
{ 0, MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
|
{ 0, MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
|
||||||
{ 0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
|
{ 0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
|
||||||
{ 0, 1, 1, REVERSE_BUTTON_NAV}, // ReverseButtonNavEnabled
|
|
||||||
{ 5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
|
{ 5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
|
||||||
{ 1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
|
{ 1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
|
||||||
{ 0, 9, 1, 7}, // HallEffectSensitivity
|
{ 0, 9, 1, 7}, // HallEffectSensitivity
|
||||||
@@ -111,6 +110,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
|
|||||||
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
|
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
|
||||||
{ 0, 12, 1, 0}, // HallEffectSleepTime
|
{ 0, 12, 1, 0}, // HallEffectSleepTime
|
||||||
{ 0, (tipType_t::TIP_TYPE_MAX - 1) > 0 ? (tipType_t::TIP_TYPE_MAX - 1) : 0, 1, 0}, // SolderingTipType
|
{ 0, (tipType_t::TIP_TYPE_MAX - 1) > 0 ? (tipType_t::TIP_TYPE_MAX - 1) : 0, 1, 0}, // SolderingTipType
|
||||||
|
{ 0, 1, 1, REVERSE_BUTTON_MENU}, // ReverseButtonMenu
|
||||||
};
|
};
|
||||||
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));
|
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ static void displayAdvancedSolderingScreens(void);
|
|||||||
static void displayAdvancedIDLEScreens(void);
|
static void displayAdvancedIDLEScreens(void);
|
||||||
static void displayScrollSpeed(void);
|
static void displayScrollSpeed(void);
|
||||||
static void displayReverseButtonTempChangeEnabled(void);
|
static void displayReverseButtonTempChangeEnabled(void);
|
||||||
static void displayReverseButtonNavEnabled(void);
|
static void displayReverseButtonMenu(void);
|
||||||
static void displayPowerLimit(void);
|
static void displayPowerLimit(void);
|
||||||
|
|
||||||
#ifdef BLE_ENABLED
|
#ifdef BLE_ENABLED
|
||||||
@@ -397,7 +397,7 @@ const menuitem UIMenu[] = {
|
|||||||
/* Reverse Temp change buttons +/- */
|
/* Reverse Temp change buttons +/- */
|
||||||
{SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled, SettingsItemIndex::ReverseButtonTempChange, 7},
|
{SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled, SettingsItemIndex::ReverseButtonTempChange, 7},
|
||||||
/* Reverse menu nav buttons A/B */
|
/* Reverse menu nav buttons A/B */
|
||||||
{SETTINGS_DESC(SettingsItemIndex::ReverseButtonNav), nullptr, displayReverseButtonNavEnabled, nullptr, SettingsOptions::ReverseButtonNavEnabled, SettingsItemIndex::ReverseButtonNav, 7},
|
{SETTINGS_DESC(SettingsItemIndex::ReverseButtonMenu), nullptr, displayReverseButtonMenu, nullptr, SettingsOptions::ReverseButtonMenu, SettingsItemIndex::ReverseButtonMenu, 7},
|
||||||
/* Animation Speed adjustment */
|
/* Animation Speed adjustment */
|
||||||
{SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7},
|
{SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7},
|
||||||
/* Animation Loop switch */
|
/* Animation Loop switch */
|
||||||
@@ -855,7 +855,8 @@ static void displayCoolingBlinkEnabled(void) { OLED::drawCheckbox(getSettingValu
|
|||||||
static void displayScrollSpeed(void) { OLED::print(translatedString((getSettingValue(SettingsOptions::DescriptionScrollSpeed)) ? Tr->SettingFastChar : Tr->SettingSlowChar), FontStyle::LARGE); }
|
static void displayScrollSpeed(void) { OLED::print(translatedString((getSettingValue(SettingsOptions::DescriptionScrollSpeed)) ? Tr->SettingFastChar : Tr->SettingSlowChar), FontStyle::LARGE); }
|
||||||
|
|
||||||
static void displayReverseButtonTempChangeEnabled(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled)); }
|
static void displayReverseButtonTempChangeEnabled(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled)); }
|
||||||
static void displayReverseButtonNavEnabled(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::ReverseButtonNavEnabled)); }
|
|
||||||
|
static void displayReverseButtonMenu(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::ReverseButtonMenu)); }
|
||||||
|
|
||||||
static void displayAnimationSpeed(void) {
|
static void displayAnimationSpeed(void) {
|
||||||
switch (getSettingValue(SettingsOptions::AnimationSpeed)) {
|
switch (getSettingValue(SettingsOptions::AnimationSpeed)) {
|
||||||
@@ -952,7 +953,7 @@ static void setCalibrateVIN(void) {
|
|||||||
OLED::setCursor(0, 8);
|
OLED::setCursor(0, 8);
|
||||||
OLED::printNumber(getSettingValue(SettingsOptions::VoltageDiv), 3, FontStyle::SMALL);
|
OLED::printNumber(getSettingValue(SettingsOptions::VoltageDiv), 3, FontStyle::SMALL);
|
||||||
|
|
||||||
switch (getButtonState(getSettingValue(SettingsOptions::ReverseButtonNavEnabled))) {
|
switch (getButtonState(getSettingValue(SettingsOptions::ReverseButtonMenu))) {
|
||||||
case BUTTON_F_SHORT:
|
case BUTTON_F_SHORT:
|
||||||
prevSettingValue(SettingsOptions::VoltageDiv);
|
prevSettingValue(SettingsOptions::VoltageDiv);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ guiContext context; // Conte
|
|||||||
OperatingMode handle_post_init_state();
|
OperatingMode handle_post_init_state();
|
||||||
OperatingMode guiHandleDraw(void) {
|
OperatingMode guiHandleDraw(void) {
|
||||||
OLED::clearScreen(); // Clear ready for render pass
|
OLED::clearScreen(); // Clear ready for render pass
|
||||||
bool d = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
|
bool d = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
bool e = getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled);
|
bool e = getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled);
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef REVERSE_NAV_EVERYWHERE
|
||||||
bool f = currentOperatingMode == OperatingMode::TemperatureAdjust;
|
bool f = currentOperatingMode == OperatingMode::TemperatureAdjust;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
bool isFlipped = OLED::getRotation();
|
bool isFlipped = OLED::getRotation();
|
||||||
bool tipDisconnected = isTipDisconnected();
|
bool tipDisconnected = isTipDisconnected();
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef REVERSE_NAV_EVERYWHERE
|
||||||
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
|
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flip and switch buttons accordingly
|
// Flip and switch buttons accordingly
|
||||||
@@ -52,4 +52,4 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
OLED::setCursor(isFlipped ? 0 : 116, 0);
|
OLED::setCursor(isFlipped ? 0 : 116, 0);
|
||||||
ui_draw_power_source_icon();
|
ui_draw_power_source_icon();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
bool isFlipped = OLED::getRotation();
|
bool isFlipped = OLED::getRotation();
|
||||||
bool tipDisconnected = isTipDisconnected();
|
bool tipDisconnected = isTipDisconnected();
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef REVERSE_NAV_EVERYWHERE
|
||||||
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
|
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flip and switch buttons accordingly
|
// Flip and switch buttons accordingly
|
||||||
@@ -51,4 +51,4 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
OLED::setCursor(isFlipped ? 0 : 84, 0);
|
OLED::setCursor(isFlipped ? 0 : 84, 0);
|
||||||
ui_draw_power_source_icon();
|
ui_draw_power_source_icon();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ bool shouldShutdown(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef REVERSE_NAV_EVERYWHERE
|
||||||
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonNavEnabled) == BUTTON_B_LONG) { // allow also if back button is pressed long
|
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonMenu) == BUTTON_B_LONG) { // allow also if back button is pressed long
|
||||||
#else
|
#else
|
||||||
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
|
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user