diff options
author | Ben V. Brown <[email protected]> | 2021-09-25 11:07:58 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-09-25 11:07:58 +1000 |
commit | 5ff4a75b687ea92a7d49baf2dd2f982ead4518fd (patch) | |
tree | e9ec87e090df218d00f2582d8931cd51e74b98e2 | |
parent | f598b9a96f665692cfce700eabb04112217821e5 (diff) | |
parent | 0ea9ae19f2900342724c8030bf392da933ba71b2 (diff) | |
download | IronOS-5ff4a75b687ea92a7d49baf2dd2f982ead4518fd.tar.gz IronOS-5ff4a75b687ea92a7d49baf2dd2f982ead4518fd.zip |
Merge branch 'master' into ralim/dfuse-header
-rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 14 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/everything-else--questions--notes-etc-.md | 2 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/feature_request.md | 8 | ||||
-rw-r--r-- | .github/workflows/codeql-analysis.yml | 69 | ||||
-rw-r--r-- | Documentation/DebugMenu.md | 17 | ||||
-rw-r--r-- | PULL_REQUEST_TEMPLATE.md | 6 | ||||
-rwxr-xr-x | Translations/make_translation.py | 25 | ||||
-rw-r--r-- | source/Core/Inc/Translation.h | 4 | ||||
-rw-r--r-- | source/Core/Inc/gui.hpp | 3 | ||||
-rw-r--r-- | source/Core/Inc/main.hpp | 15 | ||||
-rw-r--r-- | source/Core/LangSupport/lang_multi.cpp | 6 | ||||
-rw-r--r-- | source/Core/LangSupport/lang_single.cpp | 5 | ||||
-rw-r--r-- | source/Core/Src/gui.cpp | 328 | ||||
-rw-r--r-- | source/Core/Src/main.cpp | 4 | ||||
-rw-r--r-- | source/Core/Threads/GUIThread.cpp | 6 | ||||
-rw-r--r-- | source/Core/Threads/MOVThread.cpp | 34 |
16 files changed, 228 insertions, 318 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6bc34713..00f284cd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,25 +8,25 @@ assignees: Ralim --- **Describe the bug** -A clear and concise description of what the bug is. +<!-- A clear and concise description of what the bug is. --> **To Reproduce** -Steps to reproduce the behavior: +<!-- Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' -4. See error +4. See error --> **Expected behavior** -A clear and concise description of what you expected to happen. +<!-- A clear and concise description of what you expected to happen. --> **Details on your device:** + <!-- You can get these from the debug menu by holding the rear button down and then using the front one to cycle through--> - Device: [e.g. TS80/Pinecil etc] - Release: [eg 2.15.40087E6] - Power adapter being used: - -Note you can grab these from the debug menu. + - If this is an acceleromter related issue, please include its model number here: **Additional context** -Add any other context about the problem here. +<!-- Add any other context about the problem here. --> diff --git a/.github/ISSUE_TEMPLATE/everything-else--questions--notes-etc-.md b/.github/ISSUE_TEMPLATE/everything-else--questions--notes-etc-.md index 440f1f67..1a1c7fd6 100644 --- a/.github/ISSUE_TEMPLATE/everything-else--questions--notes-etc-.md +++ b/.github/ISSUE_TEMPLATE/everything-else--questions--notes-etc-.md @@ -7,4 +7,4 @@ assignees: '' --- -**Questions are preferred to be kept to the discussions tab where possible, but otherwise go for it. be polite and as clear as possible.** +<!-- **Questions are preferred to be kept to the discussions tab where possible, but otherwise go for it. be polite and as clear as possible.** --> diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 259c5294..f0608cd9 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,13 +8,13 @@ assignees: Ralim --- **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> **Describe the solution you'd like** -A clear and concise description of what you want to happen. +<!-- A clear and concise description of what you want to happen. --> **Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. +<!-- A clear and concise description of any alternative solutions or features you've considered. --> **Additional context** -Add any other context or screenshots about the feature request here. +<!-- Add any other context or screenshots about the feature request here. --> diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 941bc5f0..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,69 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: "38 23 * * 6" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: ["cpp", "python"] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - - - name: chmod - run: chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build - - - name: Cached compiler source files - uses: actions/[email protected] - env: - cache-name: cache-compilers - with: - path: /build/cache - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}- - - - name: setup - run: ./setup.sh && cd source && ./build.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/Documentation/DebugMenu.md b/Documentation/DebugMenu.md index 6e622999..d2751a05 100644 --- a/Documentation/DebugMenu.md +++ b/Documentation/DebugMenu.md @@ -52,18 +52,17 @@ This is shown in degrees C x10, so 200 == 20.0C The input voltage as read by the internal ADC. Can be used to sanity check its being read correctly.
-### PCB
+### ACC
-This is slightly miss-named, but preserving the name for now.
-This indicates the PCB "version" number, which comes from the TS100 changing the model of accelerometer without warning.
This indicates the accelerometer that is fitted inside the unit.
-- 1 = MMA8652
-- 2 = LIS2DH12
-- 3 = BMA223
-- 4 = MSA301
-- 5 = SC7A20
-- 99 = None detected (running in fallback without movement detection)
+- MMA8652
+- LIS2DH12
+- BMA223
+- MSA301
+- SC7A20
+- None detected -> running in fallback without movement detection
+- Scanning -> Still searching I2C for one
### PWR
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 09867702..b80d237a 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,17 +1,17 @@ -Please try and fill out this template where possible, not all fields are required and can be removed. +<!-- Please try and fill out this template where possible, not all fields are required and can be removed. --> * **Please check if the PR fulfills these requirements** - [] The changes have been tested locally - [] There are no breaking changes * **What kind of change does this PR introduce?** -(Bug fix, feature, docs update, ...) +<!-- (Bug fix, feature, docs update, ...) --> * **What is the current behavior?** -(You can also link to an open issue here) +<!-- (You can also just link to an open issue here) --> * **What is the new behavior (if this is a feature change)?** diff --git a/Translations/make_translation.py b/Translations/make_translation.py index 97c9c395..77bb7b81 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -124,12 +124,24 @@ def get_debug_menu() -> List[str]: "CTip ",
"CHan ",
"Vin ",
- "PCB ",
+ "ACC ",
"PWR ",
"Max ",
]
+def get_accel_names_list() -> List[str]:
+ return [
+ "Scanning",
+ "None",
+ "MMA8652FC",
+ "LIS2DH12",
+ "BMA223",
+ "MSA301",
+ "SC7A20",
+ ]
+
+
def get_letter_counts(
defs: dict, lang: dict, build_version: str
) -> Tuple[List[str], Dict[str, int]]:
@@ -189,6 +201,7 @@ def get_letter_counts( for x in constants:
text_list.append(x[1])
text_list.extend(get_debug_menu())
+ text_list.extend(get_accel_names_list())
# collapse all strings down into the composite letters and store totals for these
@@ -948,6 +961,16 @@ def get_translation_common_text( f'\t "{convert_string(symbol_conversion_table, c)}",//{c} \n'
)
translation_common_text += "};\n\n"
+
+ # accel names
+ translation_common_text += "const char* AccelTypeNames[] = {\n"
+
+ for c in get_accel_names_list():
+ translation_common_text += (
+ f'\t "{convert_string(symbol_conversion_table, c)}",//{c} \n'
+ )
+ translation_common_text += "};\n\n"
+
return translation_common_text
diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 4f601fb8..5012d0da 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -26,6 +26,7 @@ extern const char *SymbolCellCount; extern const char *SymbolVersionNumber;
extern const char *DebugMenu[];
+extern const char *AccelTypeNames[];
enum class SettingsItemIndex : uint8_t {
DCInCutoff,
@@ -145,7 +146,8 @@ constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static const char *translatedString(uint16_t index);
void prepareTranslations();
-bool settings_displayLanguageSwitch(void);
+void settings_displayLanguageSwitch(void);
+bool settings_showLanguageSwitch(void);
bool settings_setLanguageSwitch(void);
#endif /* TRANSLATION_H_ */
diff --git a/source/Core/Inc/gui.hpp b/source/Core/Inc/gui.hpp index e21f1e1a..2d9f8b05 100644 --- a/source/Core/Inc/gui.hpp +++ b/source/Core/Inc/gui.hpp @@ -26,7 +26,8 @@ typedef struct { uint8_t description;
// return true if increment reached the maximum value
bool (*const incrementHandler)(void);
- bool (*const draw)(void);
+ void (*const draw)(void);
+ bool (*const isVisible)(void);
// If this is set, we will automatically use the settings increment handler instead, set >= num settings to disable
SettingsOptions autoSettingOption;
} menuitem;
diff --git a/source/Core/Inc/main.hpp b/source/Core/Inc/main.hpp index a139694c..42ee98e0 100644 --- a/source/Core/Inc/main.hpp +++ b/source/Core/Inc/main.hpp @@ -3,7 +3,6 @@ #include "OLED.hpp" #include "Setup.h" -extern uint8_t DetectedAccelerometerVersion; extern uint32_t currentTempTargetDegC; extern bool settingsWereReset; extern bool usb_pd_available; @@ -13,8 +12,6 @@ extern "C" { void vApplicationStackOverflowHook(TaskHandle_t *pxTask, signed portCHAR *pcTaskName); -#define NO_DETECTED_ACCELEROMETER 99 -#define ACCELEROMETERS_SCANNING 100 // Threads void startGUITask(void const *argument); void startPIDTask(void const *argument); @@ -26,5 +23,17 @@ extern uint8_t accelInit; extern TickType_t lastMovementTime; #ifdef __cplusplus } +// Accelerometer type +enum class AccelType { + Scanning = 0, + None = 1, + MMA = 2, + LIS = 3, + BMA = 4, + MSA = 5, + SC7 = 6, +}; +extern AccelType DetectedAccelerometerVersion; + #endif #endif /* __MAIN_H */ diff --git a/source/Core/LangSupport/lang_multi.cpp b/source/Core/LangSupport/lang_multi.cpp index c612d853..fb3fbb41 100644 --- a/source/Core/LangSupport/lang_multi.cpp +++ b/source/Core/LangSupport/lang_multi.cpp @@ -85,7 +85,5 @@ bool settings_setLanguageSwitch(void) { return selectedLangIndex == (LanguageCount - 1); } -bool settings_displayLanguageSwitch(void) { - OLED::printWholeScreen(translatedString(Tr->SettingsShortNames[static_cast<uint8_t>(SettingsItemIndex::LanguageSwitch)])); - return false; -} +bool settings_showLanguageSwitch(void) { return true; } +void settings_displayLanguageSwitch(void) { OLED::printWholeScreen(translatedString(Tr->SettingsShortNames[static_cast<uint8_t>(SettingsItemIndex::LanguageSwitch)])); } diff --git a/source/Core/LangSupport/lang_single.cpp b/source/Core/LangSupport/lang_single.cpp index 75258521..019c0938 100644 --- a/source/Core/LangSupport/lang_single.cpp +++ b/source/Core/LangSupport/lang_single.cpp @@ -2,6 +2,5 @@ bool settings_setLanguageSwitch(void) { return false; } -bool settings_displayLanguageSwitch(void) { - return true; // skip -} +void settings_displayLanguageSwitch(void) {} +bool settings_showLanguageSwitch(void) { return false; } diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index b1c5e25f..39c7cd1d 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -17,71 +17,72 @@ void gui_Menu(const menuitem *menu); #ifdef POW_DC -static bool settings_displayInputVRange(void); -static bool settings_displayInputMinVRange(void); +static void settings_displayInputVRange(void); +static void settings_displayInputMinVRange(void); #endif #ifdef POW_QC -static bool settings_displayQCInputV(void); +static void settings_displayQCInputV(void); #endif #ifdef POW_PD -static bool settings_displayPDNegTimeout(void); +static void settings_displayPDNegTimeout(void); #endif #ifndef NO_SLEEP_MODE static bool settings_setSleepTemp(void); -static bool settings_displaySleepTemp(void); -static bool settings_displaySleepTime(void); +static void settings_displaySleepTemp(void); +static void settings_displaySleepTime(void); #endif -static bool settings_displayShutdownTime(void); -static bool settings_displaySensitivity(void); +static void settings_displayShutdownTime(void); +static void settings_displaySensitivity(void); static bool settings_setTempF(void); -static bool settings_displayTempF(void); -static bool settings_displayAdvancedSolderingScreens(void); -static bool settings_displayAdvancedIDLEScreens(void); -static bool settings_displayScrollSpeed(void); -static bool settings_displayPowerLimit(void); +static void settings_displayTempF(void); +static void settings_displayAdvancedSolderingScreens(void); +static void settings_displayAdvancedIDLEScreens(void); +static void settings_displayScrollSpeed(void); +static void settings_displayPowerLimit(void); #ifndef NO_DISPLAY_ROTATE static bool settings_setDisplayRotation(void); -static bool settings_displayDisplayRotation(void); +static void settings_displayDisplayRotation(void); #endif static bool settings_setBoostTemp(void); -static bool settings_displayBoostTemp(void); -static bool settings_displayAutomaticStartMode(void); -static bool settings_displayLockingMode(void); -static bool settings_displayCoolingBlinkEnabled(void); +static void settings_displayBoostTemp(void); +static void settings_displayAutomaticStartMode(void); +static void settings_displayLockingMode(void); +static void settings_displayCoolingBlinkEnabled(void); static bool settings_setResetSettings(void); -static bool settings_displayResetSettings(void); +static void settings_displayResetSettings(void); static bool settings_setCalibrate(void); -static bool settings_displayCalibrate(void); +static void settings_displayCalibrate(void); static bool settings_setCalibrateVIN(void); -static bool settings_displayCalibrateVIN(void); -static bool settings_displayReverseButtonTempChangeEnabled(void); -static bool settings_displayTempChangeShortStep(void); -static bool settings_displayTempChangeLongStep(void); -static bool settings_displayPowerPulse(void); -static bool settings_displayAnimationSpeed(void); -static bool settings_displayAnimationLoop(void); -static bool settings_displayPowerPulseWait(void); -static bool settings_displayPowerPulseDuration(void); -static bool settings_displayBrightnessLevel(void); -static bool settings_displayInvertColor(void); +static void settings_displayCalibrateVIN(void); +static void settings_displayReverseButtonTempChangeEnabled(void); +static void settings_displayTempChangeShortStep(void); +static void settings_displayTempChangeLongStep(void); +static void settings_displayPowerPulse(void); +static void settings_displayAnimationSpeed(void); +static void settings_displayAnimationLoop(void); +static void settings_displayPowerPulseWait(void); +static bool settings_showPowerPulseOptions(void); +static void settings_displayPowerPulseDuration(void); +static void settings_displayBrightnessLevel(void); +static void settings_displayInvertColor(void); #ifdef HALL_SENSOR -static bool settings_displayHallEffect(void); +static void settings_displayHallEffect(void); #endif // Menu functions #if defined(POW_DC) || defined(POW_QC) -static bool settings_displayPowerMenu(void); +static void settings_displayPowerMenu(void); static bool settings_enterPowerMenu(void); #endif -static bool settings_displaySolderingMenu(void); +static void settings_displaySolderingMenu(void); static bool settings_enterSolderingMenu(void); -static bool settings_displayPowerSavingMenu(void); +static void settings_displayPowerSavingMenu(void); static bool settings_enterPowerSavingMenu(void); -static bool settings_displayUIMenu(void); +static void settings_displayUIMenu(void); static bool settings_enterUIMenu(void); -static bool settings_displayAdvancedMenu(void); +static void settings_displayAdvancedMenu(void); static bool settings_enterAdvancedMenu(void); /* * Root Settings Menu @@ -134,15 +135,15 @@ const menuitem rootSettingsMenu[] { */ #if defined(POW_DC) || defined(POW_QC) - {0, settings_enterPowerMenu, settings_displayPowerMenu, SettingsOptions::SettingsOptionsLength}, /*Power*/ + {0, settings_enterPowerMenu, settings_displayPowerMenu, nullptr, SettingsOptions::SettingsOptionsLength}, /*Power*/ #endif - {0, settings_enterSolderingMenu, settings_displaySolderingMenu, SettingsOptions::SettingsOptionsLength}, /*Soldering*/ - {0, settings_enterPowerSavingMenu, settings_displayPowerSavingMenu, SettingsOptions::SettingsOptionsLength}, /*Sleep Options Menu*/ - {0, settings_enterUIMenu, settings_displayUIMenu, SettingsOptions::SettingsOptionsLength}, /*UI Menu*/ - {0, settings_enterAdvancedMenu, settings_displayAdvancedMenu, SettingsOptions::SettingsOptionsLength}, /*Advanced Menu*/ - {0, settings_setLanguageSwitch, settings_displayLanguageSwitch, SettingsOptions::SettingsOptionsLength}, /*Language Switch*/ + {0, settings_enterSolderingMenu, settings_displaySolderingMenu, nullptr, SettingsOptions::SettingsOptionsLength}, /*Soldering*/ + {0, settings_enterPowerSavingMenu, settings_displayPowerSavingMenu, nullptr, SettingsOptions::SettingsOptionsLength}, /*Sleep Options Menu*/ + {0, settings_enterUIMenu, settings_displayUIMenu, nullptr, SettingsOptions::SettingsOptionsLength}, /*UI Menu*/ + {0, settings_enterAdvancedMenu, settings_displayAdvancedMenu, nullptr, SettingsOptions::SettingsOptionsLength}, /*Advanced Menu*/ + {0, settings_setLanguageSwitch, settings_displayLanguageSwitch, settings_showLanguageSwitch, SettingsOptions::SettingsOptionsLength}, /*Language Switch*/ { - 0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength + 0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength } // end of menu marker. DO NOT REMOVE }; @@ -152,16 +153,16 @@ const menuitem powerMenu[] = { * Power Source */ #ifdef POW_DC - {SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, settings_displayInputVRange, SettingsOptions::MinDCVoltageCells}, /*Voltage input*/ - {SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, settings_displayInputMinVRange, SettingsOptions::MinVoltageCells}, /*Minimum voltage input*/ + {SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, settings_displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells}, /*Voltage input*/ + {SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, settings_displayInputMinVRange, nullptr, SettingsOptions::MinVoltageCells}, /*Minimum voltage input*/ #endif #ifdef POW_QC - {SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, settings_displayQCInputV, SettingsOptions::QCIdealVoltage}, /*Voltage input*/ + {SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, settings_displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage}, /*Voltage input*/ #endif #ifdef POW_PD - {SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, settings_displayPDNegTimeout, SettingsOptions::PDNegTimeout}, /*PD timeout setup*/ + {SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, settings_displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout}, /*PD timeout setup*/ #endif - {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE + {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; #endif const menuitem solderingMenu[] = { @@ -172,12 +173,12 @@ const menuitem solderingMenu[] = { * Temp change short step * Temp change long step */ - {SETTINGS_DESC(SettingsItemIndex::BoostTemperature), settings_setBoostTemp, settings_displayBoostTemp, SettingsOptions::SettingsOptionsLength}, /*Boost Temp*/ - {SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, settings_displayAutomaticStartMode, SettingsOptions::AutoStartMode}, /*Auto start*/ - {SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, settings_displayTempChangeShortStep, SettingsOptions::TempChangeShortStep}, /*Temp change short step*/ - {SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, settings_displayTempChangeLongStep, SettingsOptions::TempChangeLongStep}, /*Temp change long step*/ - {SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, settings_displayLockingMode, SettingsOptions::LockingMode}, /*Locking Mode*/ - {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE + {SETTINGS_DESC(SettingsItemIndex::BoostTemperature), settings_setBoostTemp, settings_displayBoostTemp, nullptr, SettingsOptions::SettingsOptionsLength}, /*Boost Temp*/ + {SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, settings_displayAutomaticStartMode, nullptr, SettingsOptions::AutoStartMode}, /*Auto start*/ + {SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, settings_displayTempChangeShortStep, nullptr, SettingsOptions::TempChangeShortStep}, /*Temp change short step*/ + {SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, settings_displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep}, /*Temp change long step*/ + {SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, settings_displayLockingMode, nullptr, SettingsOptions::LockingMode}, /*Locking Mode*/ + {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; const menuitem UIMenu[] = { /* @@ -190,22 +191,22 @@ const menuitem UIMenu[] = { * Detailed IDLE * Detailed Soldering */ - {SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), settings_setTempF, settings_displayTempF, + {SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), settings_setTempF, settings_displayTempF, nullptr, SettingsOptions::SettingsOptionsLength}, /* Temperature units, this has to be the first element in the array to work with the logic in settings_enterUIMenu() */ #ifndef NO_DISPLAY_ROTATE - {SETTINGS_DESC(SettingsItemIndex::DisplayRotation), settings_setDisplayRotation, settings_displayDisplayRotation, SettingsOptions::SettingsOptionsLength}, /*Display Rotation*/ + {SETTINGS_DESC(SettingsItemIndex::DisplayRotation), settings_setDisplayRotation, settings_displayDisplayRotation, nullptr, SettingsOptions::SettingsOptionsLength}, /*Display Rotation*/ #endif - {SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, settings_displayCoolingBlinkEnabled, SettingsOptions::CoolingTempBlink}, /*Cooling blink warning*/ - {SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, settings_displayScrollSpeed, SettingsOptions::DescriptionScrollSpeed}, /*Scroll Speed for descriptions*/ - {SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, settings_displayReverseButtonTempChangeEnabled, - SettingsOptions::ReverseButtonTempChangeEnabled}, /* Reverse Temp change buttons + - */ - {SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, settings_displayAnimationSpeed, SettingsOptions::AnimationSpeed}, /*Animation Speed adjustment */ - {SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, settings_displayAnimationLoop, SettingsOptions::AnimationLoop}, /*Animation Loop switch */ - {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, settings_displayBrightnessLevel, SettingsOptions::OLEDBrightness}, /*Brightness Level*/ - {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, settings_displayInvertColor, SettingsOptions::OLEDInversion}, /*Invert screen colour*/ - {SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, settings_displayAdvancedIDLEScreens, SettingsOptions::DetailedIDLE}, /* Advanced idle screen*/ - {SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, settings_displayAdvancedSolderingScreens, SettingsOptions::DetailedSoldering}, /* Advanced soldering screen*/ - {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE + {SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, settings_displayCoolingBlinkEnabled, nullptr, SettingsOptions::CoolingTempBlink}, /*Cooling blink warning*/ + {SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, settings_displayScrollSpeed, nullptr, SettingsOptions::DescriptionScrollSpeed}, /*Scroll Speed for descriptions*/ + {SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, settings_displayReverseButtonTempChangeEnabled, nullptr, + SettingsOptions::ReverseButtonTempChangeEnabled}, /* Reverse Temp change buttons + - */ + {SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, settings_displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed}, /*Animation Speed adjustment */ + {SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, settings_displayAnimationLoop, nullptr, SettingsOptions::AnimationLoop}, /*Animation Loop switch */ + {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, settings_displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness}, /*Brightness Level*/ + {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, settings_displayInvertColor, nullptr, SettingsOptions::OLEDInversion}, /*Invert screen colour*/ + {SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, settings_displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE}, /* Advanced idle screen*/ + {SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, settings_displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering}, /* Advanced soldering screen*/ + {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; const menuitem PowerSavingMenu[] = { /* @@ -215,15 +216,15 @@ const menuitem PowerSavingMenu[] = { * Motion Sensitivity */ #ifndef NO_SLEEP_MODE - {SETTINGS_DESC(SettingsItemIndex::SleepTemperature), settings_setSleepTemp, settings_displaySleepTemp, SettingsOptions::SettingsOptionsLength}, /*Sleep Temp*/ - {SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, settings_displaySleepTime, SettingsOptions::SleepTime}, /*Sleep Time*/ + {SETTINGS_DESC(SettingsItemIndex::SleepTemperature), settings_setSleepTemp, settings_displaySleepTemp, nullptr, SettingsOptions::SettingsOptionsLength}, /*Sleep Temp*/ + {SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, settings_displaySleepTime, nullptr, SettingsOptions::SleepTime}, /*Sleep Time*/ #endif - {SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, SettingsOptions::ShutdownTime}, /*Shutdown Time*/ - {SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/ + {SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, nullptr, SettingsOptions::ShutdownTime}, /*Shutdown Time*/ + {SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, nullptr, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/ #ifdef HALL_SENSOR - {SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, settings_displayHallEffect, SettingsOptions::HallEffectSensitivity}, /* HallEffect Sensitivity*/ + {SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, settings_displayHallEffect, nullptr, SettingsOptions::HallEffectSensitivity}, /* HallEffect Sensitivity*/ #endif - {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE + {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; const menuitem advancedMenu[] = { @@ -238,14 +239,15 @@ const menuitem advancedMenu[] = { * Power Pulse Wait * Power Pulse Duration */ - {SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, settings_displayPowerLimit, SettingsOptions::PowerLimit}, /*Power limit*/ - {SETTINGS_DESC(SettingsItemIndex::SettingsReset), settings_setResetSettings, settings_displayResetSettings, SettingsOptions::SettingsOptionsLength}, /*Resets settings*/ - {SETTINGS_DESC(SettingsItemIndex::TemperatureCalibration), settings_setCalibrate, settings_displayCalibrate, SettingsOptions::SettingsOptionsLength}, /*Calibrate tip*/ - {SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), settings_setCalibrateVIN, settings_displayCalibrateVIN, SettingsOptions::SettingsOptionsLength}, /*Voltage input cal*/ - {SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, settings_displayPowerPulse, SettingsOptions::KeepAwakePulse}, /*Power Pulse adjustment */ - {SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, settings_displayPowerPulseWait, SettingsOptions::KeepAwakePulseWait}, /*Power Pulse Wait adjustment*/ - {SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, settings_displayPowerPulseDuration, SettingsOptions::KeepAwakePulseDuration}, /*Power Pulse Duration adjustment*/ - {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE + {SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, settings_displayPowerLimit, nullptr, SettingsOptions::PowerLimit}, /*Power limit*/ + {SETTINGS_DESC(SettingsItemIndex::SettingsReset), settings_setResetSettings, settings_displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength}, /*Resets settings*/ + {SETTINGS_DESC(SettingsItemIndex::TemperatureCalibration), settings_setCalibrate, settings_displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength}, /*Calibrate tip*/ + {SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), settings_setCalibrateVIN, settings_displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength}, /*Voltage input cal*/ + {SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, settings_displayPowerPulse, nullptr, SettingsOptions::KeepAwakePulse}, /*Power Pulse adjustment */ + {SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, settings_displayPowerPulseWait, settings_showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait}, /*Power Pulse Wait adjustment*/ + {SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, settings_displayPowerPulseDuration, settings_showPowerPulseOptions, + SettingsOptions::KeepAwakePulseDuration}, /*Power Pulse Duration adjustment*/ + {0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; /** @@ -296,7 +298,7 @@ static int userConfirmation(const char *message) { } #ifdef POW_DC -static bool settings_displayInputVRange(void) { +static void settings_displayInputVRange(void) { printShortDescription(SettingsItemIndex::DCInCutoff, 6); if (getSettingValue(SettingsOptions::MinDCVoltageCells)) { @@ -305,10 +307,9 @@ static bool settings_displayInputVRange(void) { } else { OLED::print(SymbolDC, FontStyle::LARGE); } - return false; } -static bool settings_displayInputMinVRange(void) { +static void settings_displayInputMinVRange(void) { if (getSettingValue(SettingsOptions::MinDCVoltageCells)) { printShortDescription(SettingsItemIndex::MinVolCell, 4); OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) / 10, 2, FontStyle::LARGE); @@ -318,12 +319,11 @@ static bool settings_displayInputMinVRange(void) { printShortDescription(SettingsItemIndex::MinVolCell, 5); OLED::print(translatedString(Tr->SettingNAChar), FontStyle::LARGE); } - return false; } #endif #ifdef POW_QC -static bool settings_displayQCInputV(void) { +static void settings_displayQCInputV(void) { printShortDescription(SettingsItemIndex::QCMaxVoltage, 4); // These are only used in QC modes // Allows setting the voltage negotiated for QC @@ -332,14 +332,13 @@ static bool settings_displayQCInputV(void) { OLED::print(SymbolDot, FontStyle::LARGE); OLED::printNumber(voltage % 10, 1, FontStyle::LARGE); OLED::print(SymbolVolts, FontStyle::LARGE); - return false; } #endif #ifdef POW_PD -static bool settings_displayPDNegTimeout(void) { +static void settings_displayPDNegTimeout(void) { printShortDescription(SettingsItemIndex::PDNegTimeout, 5); auto value = getSettingValue(SettingsOptions::PDNegTimeout); if (value == 0) { @@ -347,7 +346,6 @@ static bool settings_displayPDNegTimeout(void) { } else { OLED::printNumber(value, 2, FontStyle::LARGE); } - return false; } #endif @@ -370,13 +368,12 @@ static bool settings_setSleepTemp(void) { } } -static bool settings_displaySleepTemp(void) { +static void settings_displaySleepTemp(void) { printShortDescription(SettingsItemIndex::SleepTemperature, 5); OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE); - return false; } -static bool settings_displaySleepTime(void) { +static void settings_displaySleepTime(void) { printShortDescription(SettingsItemIndex::SleepTimeout, 5); if (getSettingValue(SettingsOptions::SleepTime) == 0) { OLED::print(translatedString(Tr->OffString), FontStyle::LARGE); @@ -387,11 +384,10 @@ static bool settings_displaySleepTime(void) { OLED::printNumber(getSettingValue(SettingsOptions::SleepTime) - 5, 2, FontStyle::LARGE); OLED::print(SymbolMinutes, FontStyle::LARGE); } - return false; } #endif -static bool settings_displayShutdownTime(void) { +static void settings_displayShutdownTime(void) { printShortDescription(SettingsItemIndex::ShutdownTimeout, 5); if (getSettingValue(SettingsOptions::ShutdownTime) == 0) { OLED::print(translatedString(Tr->OffString), FontStyle::LARGE); @@ -399,7 +395,6 @@ static bool settings_displayShutdownTime(void) { OLED::printNumber(getSettingValue(SettingsOptions::ShutdownTime), 2, FontStyle::LARGE); OLED::print(SymbolMinutes, FontStyle::LARGE); } - return false; } static bool settings_setTempF(void) { bool res = nextSettingValue(SettingsOptions::TemperatureInF); @@ -434,33 +429,29 @@ static bool settings_setTempF(void) { return res; } -static bool settings_displayTempF(void) { +static void settings_displayTempF(void) { printShortDescription(SettingsItemIndex::TemperatureUnit, 7); OLED::print((getSettingValue(SettingsOptions::TemperatureInF)) ? SymbolDegF : SymbolDegC, FontStyle::LARGE); - return false; } -static bool settings_displaySensitivity(void) { +static void settings_displaySensitivity(void) { printShortDescription(SettingsItemIndex::MotionSensitivity, 7); OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false); - return false; } -static bool settings_displayAdvancedSolderingScreens(void) { +static void settings_displayAdvancedSolderingScreens(void) { printShortDescription(SettingsItemIndex::AdvancedSoldering, 7); OLED::drawCheckbox(getSettingValue(SettingsOptions::DetailedSoldering)); - return false; } -static bool settings_displayAdvancedIDLEScreens(void) { +static void settings_displayAdvancedIDLEScreens(void) { printShortDescription(SettingsItemIndex::AdvancedIdle, 7); OLED::drawCheckbox(getSettingValue(SettingsOptions::DetailedIDLE)); - return false; } -static bool settings_displayPowerLimit(void) { +static void settings_displayPowerLimit(void) { printShortDescription(SettingsItemIndex::PowerLimit, 5); if (getSettingValue(SettingsOptions::PowerLimit) == 0) { OLED::print(translatedString(Tr->OffString), FontStyle::LARGE); @@ -468,13 +459,11 @@ static bool settings_displayPowerLimit(void) { OLED::printNumber(getSettingValue(SettingsOptions::PowerLimit), 2, FontStyle::LARGE); OLED::print(SymbolWatts, FontStyle::LARGE); } - return false; } -static bool settings_displayScrollSpeed(void) { +static void settings_displayScrollSpeed(void) { printShortDescription(SettingsItemIndex::ScrollingSpeed, 7); OLED::print(translatedString((getSettingValue(SettingsOptions::DescriptionScrollSpeed)) ? Tr->SettingFastChar : Tr->SettingSlowChar), FontStyle::LARGE); - return false; } #ifndef NO_DISPLAY_ROTATE @@ -496,7 +485,7 @@ static bool settings_setDisplayRotation(void) { return res; } -static bool settings_displayDisplayRotation(void) { +static void settings_displayDisplayRotation(void) { printShortDescription(SettingsItemIndex::DisplayRotation, 7); switch (getSettingValue(SettingsOptions::OrientationMode)) { @@ -513,7 +502,6 @@ static bool settings_displayDisplayRotation(void) { OLED::print(translatedString(Tr->SettingRightChar), FontStyle::LARGE); break; } - return false; } #endif static bool settings_setBoostTemp(void) { @@ -543,17 +531,16 @@ static bool settings_setBoostTemp(void) { return value == MAX_TEMP_C; } -static bool settings_displayBoostTemp(void) { +static void settings_displayBoostTemp(void) { printShortDescription(SettingsItemIndex::BoostTemperature, 5); if (getSettingValue(SettingsOptions::BoostTemp)) { OLED::printNumber(getSettingValue(SettingsOptions::BoostTemp), 3, FontStyle::LARGE); } else { OLED::print(translatedString(Tr->OffString), FontStyle::LARGE); } - return false; } -static bool settings_displayAutomaticStartMode(void) { +static void settings_displayAutomaticStartMode(void) { printShortDescription(SettingsItemIndex::AutoStart, 7); switch (getSettingValue(SettingsOptions::AutoStartMode)) { @@ -573,10 +560,9 @@ static bool settings_displayAutomaticStartMode(void) { OLED::print(translatedString(Tr->SettingStartNoneChar), FontStyle::LARGE); break; } - return false; } -static bool settings_displayLockingMode(void) { +static void settings_displayLockingMode(void) { printShortDescription(SettingsItemIndex::LockingMode, 7); switch (getSettingValue(SettingsOptions::LockingMode)) { @@ -593,13 +579,11 @@ static bool settings_displayLockingMode(void) { OLED::print(translatedString(Tr->SettingLockDisableChar), FontStyle::LARGE); break; } - return false; } -static bool settings_displayCoolingBlinkEnabled(void) { +static void settings_displayCoolingBlinkEnabled(void) { printShortDescription(SettingsItemIndex::CooldownBlink, 7); OLED::drawCheckbox(getSettingValue(SettingsOptions::CoolingTempBlink)); - return false; } static bool settings_setResetSettings(void) { @@ -610,10 +594,7 @@ static bool settings_setResetSettings(void) { return false; } -static bool settings_displayResetSettings(void) { - printShortDescription(SettingsItemIndex::SettingsReset, 7); - return false; -} +static void settings_displayResetSettings(void) { printShortDescription(SettingsItemIndex::SettingsReset, 7); } static void setTipOffset() { uint16_t setoffset = 0; @@ -657,10 +638,7 @@ static bool settings_setCalibrate(void) { return false; } -static bool settings_displayCalibrate(void) { - printShortDescription(SettingsItemIndex::TemperatureCalibration, 5); - return false; -} +static void settings_displayCalibrate(void) { printShortDescription(SettingsItemIndex::TemperatureCalibration, 5); } static bool settings_setCalibrateVIN(void) { // Jump to the voltage calibration subscreen @@ -701,25 +679,22 @@ static bool settings_setCalibrateVIN(void) { return false; } -static bool settings_displayReverseButtonTempChangeEnabled(void) { +static void settings_displayReverseButtonTempChangeEnabled(void) { printShortDescription(SettingsItemIndex::ReverseButtonTempChange, 7); OLED::drawCheckbox(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled)); - return false; } -static bool settings_displayTempChangeShortStep(void) { +static void settings_displayTempChangeShortStep(void) { printShortDescription(SettingsItemIndex::TempChangeShortStep, 6); OLED::printNumber(getSettingValue(SettingsOptions::TempChangeShortStep), 2, FontStyle::LARGE); - return false; } -static bool settings_displayTempChangeLongStep(void) { +static void settings_displayTempChangeLongStep(void) { printShortDescription(SettingsItemIndex::TempChangeLongStep, 6); OLED::printNumber(getSettingValue(SettingsOptions::TempChangeLongStep), 2, FontStyle::LARGE); - return false; } -static bool settings_displayPowerPulse(void) { +static void settings_displayPowerPulse(void) { printShortDescription(SettingsItemIndex::PowerPulsePower, 5); if (getSettingValue(SettingsOptions::KeepAwakePulse)) { OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulse) / 10, 1, FontStyle::LARGE); @@ -728,16 +703,14 @@ static bool settings_displayPowerPulse(void) { } else { OLED::print(translatedString(Tr->OffString), FontStyle::LARGE); } - return false; } -static bool settings_displayAnimationLoop(void) { +static void settings_displayAnimationLoop(void) { printShortDescription(SettingsItemIndex::AnimLoop, 7); OLED::drawCheckbox(getSettingValue(SettingsOptions::AnimationLoop)); - return false; } -static bool settings_displayAnimationSpeed(void) { +static void settings_displayAnimationSpeed(void) { printShortDescription(SettingsItemIndex::AnimSpeed, 7); switch (getSettingValue(SettingsOptions::AnimationSpeed)) { case settingOffSpeed_t::SLOW: @@ -753,40 +726,29 @@ static bool settings_displayAnimationSpeed(void) { OLED::print(translatedString(Tr->SettingOffChar), FontStyle::LARGE); break; } - return false; } -static bool settings_displayPowerPulseWait(void) { - if (getSettingValue(SettingsOptions::KeepAwakePulse)) { - printShortDescription(SettingsItemIndex::PowerPulseWait, 7); - OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulseWait), 1, FontStyle::LARGE); - return false; - } else { - return true; // skip - } +static bool settings_showPowerPulseOptions(void) { return getSettingValue(SettingsOptions::KeepAwakePulse) > 0; } +static void settings_displayPowerPulseWait(void) { + printShortDescription(SettingsItemIndex::PowerPulseWait, 7); + OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulseWait), 1, FontStyle::LARGE); } -static bool settings_displayPowerPulseDuration(void) { - if (getSettingValue(SettingsOptions::KeepAwakePulse)) { - printShortDescription(SettingsItemIndex::PowerPulseDuration, 7); - OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulseDuration), 1, FontStyle::LARGE); - return false; - } else { - return true; // skip - } +static void settings_displayPowerPulseDuration(void) { + printShortDescription(SettingsItemIndex::PowerPulseDuration, 7); + OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulseDuration), 1, FontStyle::LARGE); } -static bool settings_displayBrightnessLevel(void) { +static void settings_displayBrightnessLevel(void) { OLED::drawArea(0, 0, 16, 16, brightnessIcon); OLED::setCursor(5 * FONT_12_WIDTH - 2, 0); // printShortDescription(SettingsItemIndex::Brightness, 7); OLED::printNumber(getSettingValue(SettingsOptions::OLEDBrightness), 3, FontStyle::LARGE); // While not optimal to apply this here, it is _very_ convienient OLED::setBrightness(getSettingValue(SettingsOptions::OLEDBrightness)); - return false; } -static bool settings_displayInvertColor(void) { +static void settings_displayInvertColor(void) { OLED::drawArea(0, 0, 24, 16, invertDisplayIcon); OLED::setCursor(7 * FONT_12_WIDTH - 2, 0); // printShortDescription(SettingsItemIndex::ColourInversion, 7); @@ -794,11 +756,10 @@ static bool settings_displayInvertColor(void) { OLED::drawCheckbox(getSettingValue(SettingsOptions::OLEDInversion)); // While not optimal to apply this here, it is _very_ convienient OLED::setInverseDisplay(getSettingValue(SettingsOptions::OLEDInversion)); - return false; } #ifdef HALL_SENSOR -static bool settings_displayHallEffect(void) { +static void settings_displayHallEffect(void) { printShortDescription(SettingsItemIndex::HallEffSensitivity, 7); switch (getSettingValue(SettingsOptions::HallEffectSensitivity)) { case 1: @@ -815,7 +776,6 @@ static bool settings_displayHallEffect(void) { OLED::print(translatedString(Tr->SettingSensitivityOff), FontStyle::LARGE); break; } - return false; } #endif @@ -860,53 +820,35 @@ static void displayMenu(size_t index) { } // Draw symbol // 16 pixel wide image - // 2 pixel wide scrolling indicator + // less 2 pixel wide scrolling indicator OLED::drawArea(OLED_WIDTH - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[index][(16 * 2) * currentFrame])); } -static bool settings_displayCalibrateVIN(void) { - printShortDescription(SettingsItemIndex::VoltageCalibration, 5); - return false; -} +static void settings_displayCalibrateVIN(void) { printShortDescription(SettingsItemIndex::VoltageCalibration, 5); } #if defined(POW_DC) || defined(POW_QC) -static bool settings_displayPowerMenu(void) { - displayMenu(0); - return false; -} +static void settings_displayPowerMenu(void) { displayMenu(0); } static bool settings_enterPowerMenu(void) { gui_Menu(powerMenu); return false; } #endif -static bool settings_displaySolderingMenu(void) { - displayMenu(1); - return false; -} +static void settings_displaySolderingMenu(void) { displayMenu(1); } static bool settings_enterSolderingMenu(void) { gui_Menu(solderingMenu); return false; } -static bool settings_displayPowerSavingMenu(void) { - displayMenu(2); - return false; -} +static void settings_displayPowerSavingMenu(void) { displayMenu(2); } static bool settings_enterPowerSavingMenu(void) { gui_Menu(PowerSavingMenu); return false; } -static bool settings_displayUIMenu(void) { - displayMenu(3); - return false; -} +static void settings_displayUIMenu(void) { displayMenu(3); } static bool settings_enterUIMenu(void) { gui_Menu(HasFahrenheit ? UIMenu : UIMenu + 1); return false; } -static bool settings_displayAdvancedMenu(void) { - displayMenu(4); - return false; -} +static void settings_displayAdvancedMenu(void) { displayMenu(4); } static bool settings_enterAdvancedMenu(void) { gui_Menu(advancedMenu); return false; @@ -940,7 +882,11 @@ void gui_Menu(const menuitem *menu) { ScrollMessage scrollMessage; for (uint8_t i = 0; menu[i].draw != nullptr; i++) { - scrollContentSize += 1; + if (menu[i].isVisible == nullptr) { + scrollContentSize += 1; // Always visible + } else if (menu[i].isVisible()) { + scrollContentSize += 1; // Selectively visible and chosen to show + } } while ((menu[currentScreen].draw != nullptr) && earlyExit == false) { @@ -952,10 +898,12 @@ void gui_Menu(const menuitem *menu) { // to keep the primary framebuffer intact for the upcoming transition // animation. OLED::useSecondaryFramebuffer(true); - if (menu[currentScreen].draw()) { - currentScreen++; - OLED::useSecondaryFramebuffer(false); - continue; + if (menu[currentScreen].isVisible != nullptr) { + if (!menu[currentScreen].isVisible()) { + currentScreen++; + OLED::useSecondaryFramebuffer(false); + continue; + } } animOpenState = true; diff --git a/source/Core/Src/main.cpp b/source/Core/Src/main.cpp index 451dd2d2..e2e891cc 100644 --- a/source/Core/Src/main.cpp +++ b/source/Core/Src/main.cpp @@ -9,8 +9,8 @@ #include "Settings.h" #include "cmsis_os.h" #include "power.hpp" -uint8_t DetectedAccelerometerVersion = 0; -bool settingsWereReset = false; +AccelType DetectedAccelerometerVersion = AccelType::Scanning; +bool settingsWereReset = false; // FreeRTOS variables osThreadId GUITaskHandle; diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index d3add6ca..a3ba674c 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -713,7 +713,7 @@ void showDebugMenu(void) { break; case 10: // Print PCB ID number - OLED::printNumber(DetectedAccelerometerVersion, 2, FontStyle::SMALL); + OLED::print(AccelTypeNames[(int)DetectedAccelerometerVersion], FontStyle::SMALL); break; case 11: // Power negotiation status @@ -768,11 +768,11 @@ void showWarnings() { // We also want to alert if accel or pd is not detected / not responding // In this case though, we dont want to nag the user _too_ much // So only show first 2 times - while (DetectedAccelerometerVersion == ACCELEROMETERS_SCANNING) { + while (DetectedAccelerometerVersion == AccelType::Scanning) { osDelay(5); } // Display alert if accelerometer is not detected - if (DetectedAccelerometerVersion == NO_DETECTED_ACCELEROMETER) { + if (DetectedAccelerometerVersion == AccelType::None) { if (getSettingValue(SettingsOptions::AccelMissingWarningCounter) < 2) { nextSettingValue(SettingsOptions::AccelMissingWarningCounter); saveSettings(); diff --git a/source/Core/Threads/MOVThread.cpp b/source/Core/Threads/MOVThread.cpp index e0e7c86e..86c538f5 100644 --- a/source/Core/Threads/MOVThread.cpp +++ b/source/Core/Threads/MOVThread.cpp @@ -29,11 +29,11 @@ uint8_t accelInit = 0; TickType_t lastMovementTime = 0;
void detectAccelerometerVersion() {
- DetectedAccelerometerVersion = ACCELEROMETERS_SCANNING;
+ DetectedAccelerometerVersion = AccelType::Scanning;
#ifdef ACCEL_MMA
if (MMA8652FC::detect()) {
if (MMA8652FC::initalize()) {
- DetectedAccelerometerVersion = 1;
+ DetectedAccelerometerVersion = AccelType::MMA;
}
} else
#endif
@@ -41,7 +41,7 @@ void detectAccelerometerVersion() { if (LIS2DH12::detect()) {
// Setup the ST Accelerometer
if (LIS2DH12::initalize()) {
- DetectedAccelerometerVersion = 2;
+ DetectedAccelerometerVersion = AccelType::LIS;
}
} else
#endif
@@ -49,7 +49,7 @@ void detectAccelerometerVersion() { if (BMA223::detect()) {
// Setup the BMA223 Accelerometer
if (BMA223::initalize()) {
- DetectedAccelerometerVersion = 3;
+ DetectedAccelerometerVersion = AccelType::BMA;
}
} else
#endif
@@ -57,7 +57,7 @@ void detectAccelerometerVersion() { if (MSA301::detect()) {
// Setup the MSA301 Accelerometer
if (MSA301::initalize()) {
- DetectedAccelerometerVersion = 4;
+ DetectedAccelerometerVersion = AccelType::MSA;
}
} else
#endif
@@ -65,43 +65,43 @@ void detectAccelerometerVersion() { if (SC7A20::detect()) {
// Setup the SC7A20 Accelerometer
if (SC7A20::initalize()) {
- DetectedAccelerometerVersion = 5;
+ DetectedAccelerometerVersion = AccelType::SC7;
}
} else
#endif
{
// disable imu sensitivity
setSettingValue(SettingsOptions::Sensitivity, 0);
- DetectedAccelerometerVersion = NO_DETECTED_ACCELEROMETER;
+ DetectedAccelerometerVersion = AccelType::None;
}
}
inline void readAccelerometer(int16_t &tx, int16_t &ty, int16_t &tz, Orientation &rotation) {
-#ifdef ACCEL_LIS
- if (DetectedAccelerometerVersion == 2) {
- LIS2DH12::getAxisReadings(tx, ty, tz);
- rotation = LIS2DH12::getOrientation();
- } else
-#endif
#ifdef ACCEL_MMA
- if (DetectedAccelerometerVersion == 1) {
+ if (DetectedAccelerometerVersion == AccelType::MMA) {
MMA8652FC::getAxisReadings(tx, ty, tz);
rotation = MMA8652FC::getOrientation();
} else
#endif
+#ifdef ACCEL_LIS
+ if (DetectedAccelerometerVersion == AccelType::LIS) {
+ LIS2DH12::getAxisReadings(tx, ty, tz);
+ rotation = LIS2DH12::getOrientation();
+ } else
+#endif
#ifdef ACCEL_BMA
- if (DetectedAccelerometerVersion == 3) {
+ if (DetectedAccelerometerVersion == AccelType::BMA) {
BMA223::getAxisReadings(tx, ty, tz);
rotation = BMA223::getOrientation();
} else
#endif
#ifdef ACCEL_MSA
- if (DetectedAccelerometerVersion == 4) {
+ if (DetectedAccelerometerVersion == AccelType::MSA) {
MSA301::getAxisReadings(tx, ty, tz);
rotation = MSA301::getOrientation();
} else
#endif
#ifdef ACCEL_SC7
- if (DetectedAccelerometerVersion == 5) {
+ if (DetectedAccelerometerVersion == AccelType::SC7) {
SC7A20::getAxisReadings(tx, ty, tz);
rotation = SC7A20::getOrientation();
} else
|