From 6ba2a5c259a7abd0eb42c0dba50c167ac538792c Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:07:38 +1000 Subject: [PATCH 1/6] BLE crash fixing (Part ?) (#1756) * Remap printf * Help to unify formatting --------- Co-authored-by: discip <53649486+discip@users.noreply.github.com> Co-authored-by: Ivan Zorin --- source/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/Makefile b/source/Makefile index 49b86532..3726cce4 100644 --- a/source/Makefile +++ b/source/Makefile @@ -427,7 +427,9 @@ DEV_LDFLAGS=-nostartfiles \ -L $(PINECILV2_BLE_CRAPWARE_BLOB_DIR) \ -L $(PINECILV2_RF_CRAPWARE_BLOB_DIR) \ -l blecontroller_702_m0s1s \ - -l bl702_rf + -l bl702_rf \ + -Wl,--wrap=printf \ + -Wl,--defsym=__wrap_printf=bflb_platform_printf DEV_AFLAGS= DEV_GLOBAL_DEFS=-DCFG_FREERTOS \ From 118fa09ce776711865716478b55544cb0461d7bc Mon Sep 17 00:00:00 2001 From: discip <53649486+discip@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:23:04 +0200 Subject: [PATCH 2/6] Enhanced V calibration (#1758) --- Translations/translation_BE.json | 2 +- Translations/translation_BG.json | 2 +- Translations/translation_CS.json | 2 +- Translations/translation_DA.json | 2 +- Translations/translation_DE.json | 2 +- Translations/translation_EL.json | 2 +- Translations/translation_EN.json | 2 +- Translations/translation_ES.json | 2 +- Translations/translation_FI.json | 2 +- Translations/translation_FR.json | 2 +- Translations/translation_HR.json | 2 +- Translations/translation_HU.json | 2 +- Translations/translation_IT.json | 2 +- Translations/translation_JA_JP.json | 2 +- Translations/translation_LT.json | 2 +- Translations/translation_NB.json | 2 +- Translations/translation_NL.json | 2 +- Translations/translation_NL_BE.json | 2 +- Translations/translation_PL.json | 2 +- Translations/translation_PT.json | 2 +- Translations/translation_RO.json | 2 +- Translations/translation_RU.json | 2 +- Translations/translation_SK.json | 2 +- Translations/translation_SL.json | 2 +- Translations/translation_SR_CYRL.json | 2 +- Translations/translation_SR_LATN.json | 2 +- Translations/translation_SV.json | 2 +- Translations/translation_TR.json | 2 +- Translations/translation_UK.json | 2 +- Translations/translation_VI.json | 2 +- Translations/translation_YUE_HK.json | 2 +- Translations/translation_ZH_CN.json | 2 +- Translations/translation_ZH_TW.json | 2 +- Translations/translations_definitions.json | 4 ++-- source/Core/Inc/Translation.h | 2 +- source/Core/Src/settingsGUI.cpp | 12 +++++++----- source/Core/Threads/OperatingModes/CJC.cpp | 2 +- 37 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index 72ddf0f5..327f760d 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -3,7 +3,7 @@ "languageLocalName": "Беларуская", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Каліброўка\nзроблена!" }, "ResetOKMessage": { diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index 72b4f49f..afc756ba 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -3,7 +3,7 @@ "languageLocalName": "Български", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index fb4c4d1f..05279d46 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -3,7 +3,7 @@ "languageLocalName": "Český", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Kalibrace\ndokončena!" }, "ResetOKMessage": { diff --git a/Translations/translation_DA.json b/Translations/translation_DA.json index 12625a67..5b42beb5 100644 --- a/Translations/translation_DA.json +++ b/Translations/translation_DA.json @@ -3,7 +3,7 @@ "languageLocalName": "Dansk", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 8ba129a3..c93cc0e4 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -3,7 +3,7 @@ "languageLocalName": "Deutsch", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Erfolgreich\nkalibriert!" }, "ResetOKMessage": { diff --git a/Translations/translation_EL.json b/Translations/translation_EL.json index ae81203d..83600bbc 100644 --- a/Translations/translation_EL.json +++ b/Translations/translation_EL.json @@ -3,7 +3,7 @@ "languageLocalName": "Greek", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Βαθμονόμηση\nολοκληρώθηκε!" }, "ResetOKMessage": { diff --git a/Translations/translation_EN.json b/Translations/translation_EN.json index 87409562..e33e8b6a 100644 --- a/Translations/translation_EN.json +++ b/Translations/translation_EN.json @@ -3,7 +3,7 @@ "languageLocalName": "English", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_ES.json b/Translations/translation_ES.json index ad352fd3..803db9f1 100644 --- a/Translations/translation_ES.json +++ b/Translations/translation_ES.json @@ -3,7 +3,7 @@ "languageLocalName": "Castellano", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "¡Calibracion\nlista!" }, "ResetOKMessage": { diff --git a/Translations/translation_FI.json b/Translations/translation_FI.json index 9bb4e90c..bc2ccc17 100644 --- a/Translations/translation_FI.json +++ b/Translations/translation_FI.json @@ -3,7 +3,7 @@ "languageLocalName": "Suomi", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_FR.json b/Translations/translation_FR.json index 1078b29a..04b15e64 100644 --- a/Translations/translation_FR.json +++ b/Translations/translation_FR.json @@ -3,7 +3,7 @@ "languageLocalName": "Français", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Étalonnage\nterminé!" }, "ResetOKMessage": { diff --git a/Translations/translation_HR.json b/Translations/translation_HR.json index 093e66f7..cf0aa447 100644 --- a/Translations/translation_HR.json +++ b/Translations/translation_HR.json @@ -3,7 +3,7 @@ "languageLocalName": "Hrvatski", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Kalibracija\ndovršena!" }, "ResetOKMessage": { diff --git a/Translations/translation_HU.json b/Translations/translation_HU.json index 449a28c3..cc55dd72 100644 --- a/Translations/translation_HU.json +++ b/Translations/translation_HU.json @@ -3,7 +3,7 @@ "languageLocalName": "Magyar", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Kalibráció\nkész!" }, "ResetOKMessage": { diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index e1b7d32b..52a631c0 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -3,7 +3,7 @@ "languageLocalName": "Italiano", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibrazione\ncompletata!" }, "ResetOKMessage": { diff --git a/Translations/translation_JA_JP.json b/Translations/translation_JA_JP.json index 74a3cd0c..df58ce79 100755 --- a/Translations/translation_JA_JP.json +++ b/Translations/translation_JA_JP.json @@ -3,7 +3,7 @@ "languageLocalName": "日本語", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration done!" }, "ResetOKMessage": { diff --git a/Translations/translation_LT.json b/Translations/translation_LT.json index 96387be6..b4c2b53f 100644 --- a/Translations/translation_LT.json +++ b/Translations/translation_LT.json @@ -3,7 +3,7 @@ "languageLocalName": "Lietuvių", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_NB.json b/Translations/translation_NB.json index f716171f..f8b4b9a7 100644 --- a/Translations/translation_NB.json +++ b/Translations/translation_NB.json @@ -3,7 +3,7 @@ "languageLocalName": "Norsk bokmål", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index 4a1d2d56..e775541e 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -3,7 +3,7 @@ "languageLocalName": "Nederlands", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_NL_BE.json b/Translations/translation_NL_BE.json index 29767d8e..8cfd64ef 100644 --- a/Translations/translation_NL_BE.json +++ b/Translations/translation_NL_BE.json @@ -3,7 +3,7 @@ "languageLocalName": "Vlaams", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index 604e8e29..0ca28f20 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -3,7 +3,7 @@ "languageLocalName": "Polski", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Kalibracja\nwykonana!" }, "ResetOKMessage": { diff --git a/Translations/translation_PT.json b/Translations/translation_PT.json index 13078f7f..feac8a17 100644 --- a/Translations/translation_PT.json +++ b/Translations/translation_PT.json @@ -3,7 +3,7 @@ "languageLocalName": "Português", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibração\nefetuada!" }, "ResetOKMessage": { diff --git a/Translations/translation_RO.json b/Translations/translation_RO.json index b40e8d16..857e9420 100644 --- a/Translations/translation_RO.json +++ b/Translations/translation_RO.json @@ -3,7 +3,7 @@ "languageLocalName": "Română", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 62650819..225afa6f 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -3,7 +3,7 @@ "languageLocalName": "Русский", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Калибровка\nзавершена!" }, "ResetOKMessage": { diff --git a/Translations/translation_SK.json b/Translations/translation_SK.json index b0b550ad..b8c50c94 100644 --- a/Translations/translation_SK.json +++ b/Translations/translation_SK.json @@ -3,7 +3,7 @@ "languageLocalName": "Slovenčina", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_SL.json b/Translations/translation_SL.json index 5e7d2d6d..6063abec 100644 --- a/Translations/translation_SL.json +++ b/Translations/translation_SL.json @@ -3,7 +3,7 @@ "languageLocalName": "Slovenščina", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_SR_CYRL.json b/Translations/translation_SR_CYRL.json index 6d8ab8a3..473fb3d2 100644 --- a/Translations/translation_SR_CYRL.json +++ b/Translations/translation_SR_CYRL.json @@ -3,7 +3,7 @@ "languageLocalName": "Српски", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_SR_LATN.json b/Translations/translation_SR_LATN.json index c3eedfcb..50f1b46b 100644 --- a/Translations/translation_SR_LATN.json +++ b/Translations/translation_SR_LATN.json @@ -3,7 +3,7 @@ "languageLocalName": "Srpski", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_SV.json b/Translations/translation_SV.json index 58d6f6d8..4d70fe90 100644 --- a/Translations/translation_SV.json +++ b/Translations/translation_SV.json @@ -3,7 +3,7 @@ "languageLocalName": "Svenska", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_TR.json b/Translations/translation_TR.json index 3a22cd19..e63b49bd 100644 --- a/Translations/translation_TR.json +++ b/Translations/translation_TR.json @@ -3,7 +3,7 @@ "languageLocalName": "Türkçe", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_UK.json b/Translations/translation_UK.json index 03a47057..48ea65e4 100644 --- a/Translations/translation_UK.json +++ b/Translations/translation_UK.json @@ -3,7 +3,7 @@ "languageLocalName": "Українська", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "КХС\nвідкалібровано!" }, "ResetOKMessage": { diff --git a/Translations/translation_VI.json b/Translations/translation_VI.json index 10c36e0b..9b5c8fa5 100644 --- a/Translations/translation_VI.json +++ b/Translations/translation_VI.json @@ -3,7 +3,7 @@ "languageLocalName": "Tieng Viet", "tempUnitFahrenheit": false, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration\ndone!" }, "ResetOKMessage": { diff --git a/Translations/translation_YUE_HK.json b/Translations/translation_YUE_HK.json index 745e6801..b02c9177 100644 --- a/Translations/translation_YUE_HK.json +++ b/Translations/translation_YUE_HK.json @@ -3,7 +3,7 @@ "languageLocalName": "廣東話 (香港)", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration done!" }, "ResetOKMessage": { diff --git a/Translations/translation_ZH_CN.json b/Translations/translation_ZH_CN.json index de08f696..b5180add 100644 --- a/Translations/translation_ZH_CN.json +++ b/Translations/translation_ZH_CN.json @@ -3,7 +3,7 @@ "languageLocalName": "简体中文", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration done!" }, "ResetOKMessage": { diff --git a/Translations/translation_ZH_TW.json b/Translations/translation_ZH_TW.json index 1094e3aa..9151fea8 100644 --- a/Translations/translation_ZH_TW.json +++ b/Translations/translation_ZH_TW.json @@ -3,7 +3,7 @@ "languageLocalName": "正體中文", "tempUnitFahrenheit": true, "messagesWarn": { - "CJCCalibrationDone": { + "CalibrationDone": { "message": "Calibration done!" }, "ResetOKMessage": { diff --git a/Translations/translations_definitions.json b/Translations/translations_definitions.json index 96d237b7..2a9a567e 100644 --- a/Translations/translations_definitions.json +++ b/Translations/translations_definitions.json @@ -1,7 +1,7 @@ { "messagesWarn": [{ - "id": "CJCCalibrationDone", - "description": "Confirmation message indicating CJC calibration is complete." + "id": "CalibrationDone", + "description": "Confirmation message indicating calibration is complete." }, { "id": "ResetOKMessage", diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 1f1f3964..45632eda 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -107,7 +107,7 @@ enum class SettingsItemIndex : uint8_t { }; struct TranslationIndexTable { - uint16_t CJCCalibrationDone; + uint16_t CalibrationDone; uint16_t ResetOKMessage; uint16_t SettingsResetMessage; uint16_t NoAccelerometerMessage; diff --git a/source/Core/Src/settingsGUI.cpp b/source/Core/Src/settingsGUI.cpp index 87a17b6a..9542b08c 100644 --- a/source/Core/Src/settingsGUI.cpp +++ b/source/Core/Src/settingsGUI.cpp @@ -884,19 +884,21 @@ static bool setCalibrateVIN(void) { OLED::clearScreen(); for (;;) { - OLED::setCursor(0, 0); + OLED::setCursor(25, 0); uint16_t voltage = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0); OLED::printNumber(voltage / 10, 2, FontStyle::LARGE); OLED::print(LargeSymbolDot, FontStyle::LARGE); OLED::printNumber(voltage % 10, 1, FontStyle::LARGE, false); OLED::print(LargeSymbolVolts, FontStyle::LARGE); + OLED::setCursor(0, 8); + OLED::printNumber(getSettingValue(SettingsOptions::VoltageDiv), 3, FontStyle::SMALL); switch (getButtonState()) { case BUTTON_F_SHORT: - nextSettingValue(SettingsOptions::VoltageDiv); + prevSettingValue(SettingsOptions::VoltageDiv); break; case BUTTON_B_SHORT: - prevSettingValue(SettingsOptions::VoltageDiv); + nextSettingValue(SettingsOptions::VoltageDiv); break; case BUTTON_BOTH: case BUTTON_F_LONG: @@ -904,9 +906,9 @@ static bool setCalibrateVIN(void) { saveSettings(); OLED::clearScreen(); OLED::setCursor(0, 0); - OLED::printNumber(getSettingValue(SettingsOptions::VoltageDiv), 3, FontStyle::LARGE); + warnUser(translatedString(Tr->CalibrationDone), 3 * TICKS_SECOND); OLED::refresh(); - waitForButtonPressOrTimeout(1 * TICKS_SECOND); + waitForButtonPressOrTimeout(0.5 * TICKS_SECOND); return false; case BUTTON_NONE: default: diff --git a/source/Core/Threads/OperatingModes/CJC.cpp b/source/Core/Threads/OperatingModes/CJC.cpp index 25fef8d8..4da688f9 100644 --- a/source/Core/Threads/OperatingModes/CJC.cpp +++ b/source/Core/Threads/OperatingModes/CJC.cpp @@ -30,7 +30,7 @@ void performCJCC(void) { } setSettingValue(SettingsOptions::CalibrationOffset, setoffset); OLED::clearScreen(); - warnUser(translatedString(Tr->CJCCalibrationDone), 3 * TICKS_SECOND); + warnUser(translatedString(Tr->CalibrationDone), 3 * TICKS_SECOND); OLED::refresh(); // Preventing to repeat calibration at boot automatically (only one shot). setSettingValue(SettingsOptions::CalibrateCJC, 0); From 9a3fef92c3a8482aa66204ba432b964716e4cfe3 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Fri, 28 Jul 2023 18:40:16 +1000 Subject: [PATCH 3/6] Allow S60 fallback to head if PD times out after 3 seconds --- source/Core/BSP/Sequre_S60/BSP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Core/BSP/Sequre_S60/BSP.cpp b/source/Core/BSP/Sequre_S60/BSP.cpp index 8a41d18b..a5eea65b 100644 --- a/source/Core/BSP/Sequre_S60/BSP.cpp +++ b/source/Core/BSP/Sequre_S60/BSP.cpp @@ -208,7 +208,7 @@ bool isTipDisconnected() { void setStatusLED(const enum StatusLED state) {} uint8_t preStartChecks() { - if (!hub238_has_run_selection()) { + if (!hub238_has_run_selection() && (xTaskGetTickCount() < TICKS_SECOND * 5)) { return 0; } // We check if we are in a "Limited" mode; where we have to run the PWM really fast From ea1906e499543b5c36e0da194e09ca8f89062764 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Fri, 28 Jul 2023 18:46:00 +1000 Subject: [PATCH 4/6] Enforce temp unit to C if F not in build Closes #1741 --- source/Core/Src/Settings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index db6ec0a0..5196f4a4 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -11,6 +11,7 @@ #include "Settings.h" #include "BSP.h" #include "Setup.h" +#include "Translation.h" #include "configuration.h" #include // for memset bool sanitiseSettings(); @@ -65,7 +66,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp {0, 1, 1, COOLING_TEMP_BLINK}, // CoolingTempBlink {0, 1, 1, DETAILED_IDLE}, // DetailedIDLE {0, 1, 1, DETAILED_SOLDERING}, // DetailedSoldering - {0, 1, 1, TEMPERATURE_INF}, // TemperatureInF + {0, (uint16_t)(HasFahrenheit ? 1 : 0), 1, TEMPERATURE_INF}, // TemperatureInF {0, 1, 1, DESCRIPTION_SCROLL_SPEED}, // DescriptionScrollSpeed {0, 2, 1, LOCKING_MODE}, // LockingMode {0, 99, 1, POWER_PULSE_DEFAULT}, // KeepAwakePulse From 65ac2e25a6c9515142100377b3009e6d7dcf9150 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Fri, 28 Jul 2023 12:39:01 +0300 Subject: [PATCH 5/6] Add Core/Drivers to the scope of style check by clang-format (#1754) * clang-format: add ./Core/Drivers (except usb-pd) to the scope of style check * Fix missed suggestion --------- Co-authored-by: discip <53649486+discip@users.noreply.github.com> Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com> --- source/Core/Drivers/HUB238.cpp | 2 +- source/Core/Drivers/OLED.cpp | 70 +++++++++++++++----------- source/Core/Drivers/TipThermoModel.cpp | 8 +-- source/Core/Drivers/USBPD.cpp | 17 ++++--- source/Makefile | 2 - 5 files changed, 58 insertions(+), 41 deletions(-) diff --git a/source/Core/Drivers/HUB238.cpp b/source/Core/Drivers/HUB238.cpp index 3a88c185..6d2940b0 100644 --- a/source/Core/Drivers/HUB238.cpp +++ b/source/Core/Drivers/HUB238.cpp @@ -215,6 +215,6 @@ uint8_t hub238_source_currentX100() { temp &= 0b1111; return pdo_slot_to_currentx100(temp); } - return 10;//Failsafe to 0.1 amp + return 10; // Failsafe to 0.1 amp } #endif diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp index c6e7ce67..27f103fc 100644 --- a/source/Core/Drivers/OLED.cpp +++ b/source/Core/Drivers/OLED.cpp @@ -33,19 +33,19 @@ uint32_t OLED::displayChecksum; */ I2C_CLASS::I2C_REG OLED_Setup_Array[] = { /**/ - {0x80, OLED_OFF, 0}, /* Display off */ - {0x80, OLED_DIVIDER, 0}, /* Set display clock divide ratio / osc freq */ - {0x80, 0x52, 0}, /* Divide ratios */ - {0x80, 0xA8, 0}, /* Set Multiplex Ratio */ - {0x80, OLED_HEIGHT - 1, 0}, /* Multiplex ratio adjusts how far down the matrix it scans */ - {0x80, 0xC0, 0}, /* Set COM Scan direction */ - {0x80, 0xD3, 0}, /* Set vertical Display offset */ - {0x80, 0x00, 0}, /* 0 Offset */ - {0x80, 0x40, 0}, /* Set Display start line to 0 */ + {0x80, OLED_OFF, 0}, /* Display off */ + {0x80, OLED_DIVIDER, 0}, /* Set display clock divide ratio / osc freq */ + {0x80, 0x52, 0}, /* Divide ratios */ + {0x80, 0xA8, 0}, /* Set Multiplex Ratio */ + {0x80, OLED_HEIGHT - 1, 0}, /* Multiplex ratio adjusts how far down the matrix it scans */ + {0x80, 0xC0, 0}, /* Set COM Scan direction */ + {0x80, 0xD3, 0}, /* Set vertical Display offset */ + {0x80, 0x00, 0}, /* 0 Offset */ + {0x80, 0x40, 0}, /* Set Display start line to 0 */ #ifdef OLED_SEGMENT_MAP_REVERSED - {0x80, 0xA1, 0}, /* Set Segment remap to normal */ + {0x80, 0xA1, 0}, /* Set Segment remap to normal */ #else - {0x80, 0xA0, 0}, /* Set Segment remap to normal */ + {0x80, 0xA0, 0}, /* Set Segment remap to normal */ #endif {0x80, 0x8D, 0}, /* Charge Pump */ {0x80, 0x14, 0}, /* Charge Pump settings */ @@ -547,8 +547,9 @@ void OLED::printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, boo } buffer[0] = 2 + number % 10; - if (noLeaderZeros) + if (noLeaderZeros) { stripLeaderZeros(buffer, places); + } print(buffer, fontStyle); } @@ -574,10 +575,12 @@ void OLED::drawSymbol(uint8_t symbolID) { // Draw an area, but y must be aligned on 0/8 offset void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr) { // Splat this from x->x+wide in two strides - if (x <= -wide) + if (x <= -wide) { return; // cutoffleft - if (x > 96) + } + if (x > 96) { return; // cutoff right + } uint8_t visibleStart = 0; uint8_t visibleEnd = wide; @@ -609,10 +612,12 @@ void OLED::drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uin // For data which has octets swapped in a 16-bit word. void OLED::drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr) { // Splat this from x->x+wide in two strides - if (x <= -wide) + if (x <= -wide) { return; // cutoffleft - if (x > 96) + } + if (x > 96) { return; // cutoff right + } uint8_t visibleStart = 0; uint8_t visibleEnd = wide; @@ -643,10 +648,12 @@ void OLED::drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, co void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t value) { // Splat this from x->x+wide in two strides - if (x <= -wide) + if (x <= -wide) { return; // cutoffleft - if (x > 96) + } + if (x > 96) { return; // cutoff right + } uint8_t visibleStart = 0; uint8_t visibleEnd = wide; @@ -682,30 +689,37 @@ void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool c uint8_t mask = 0xFF; if (y0) { mask = mask << (y0 % 8); - for (uint8_t col = x0; col < x1; col++) - if (clear) + for (uint8_t col = x0; col < x1; col++) { + if (clear) { stripPointers[0][(y0 / 8) * 96 + col] &= ~mask; - else + } else { stripPointers[0][(y0 / 8) * 96 + col] |= mask; + } + } } // Next loop down the line the total number of solids - if (y0 / 8 != y1 / 8) - for (uint8_t col = x0; col < x1; col++) + if (y0 / 8 != y1 / 8) { + for (uint8_t col = x0; col < x1; col++) { for (uint8_t r = (y0 / 8); r < (y1 / 8); r++) { // This gives us the row index r - if (clear) + if (clear) { stripPointers[0][(r * 96) + col] = 0; - else + } else { stripPointers[0][(r * 96) + col] = 0xFF; + } } + } + } // Finally draw the tail mask = ~(mask << (y1 % 8)); - for (uint8_t col = x0; col < x1; col++) - if (clear) + for (uint8_t col = x0; col < x1; col++) { + if (clear) { stripPointers[0][(y1 / 8) * 96 + col] &= ~mask; - else + } else { stripPointers[0][(y1 / 8) * 96 + col] |= mask; + } + } } void OLED::drawHeatSymbol(uint8_t state) { diff --git a/source/Core/Drivers/TipThermoModel.cpp b/source/Core/Drivers/TipThermoModel.cpp index c71f2332..ea6a0c74 100644 --- a/source/Core/Drivers/TipThermoModel.cpp +++ b/source/Core/Drivers/TipThermoModel.cpp @@ -44,10 +44,11 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC, bool ski if (getSettingValue(SettingsOptions::CalibrationOffset) && skipCalOffset == false) { // Remove uV tipOffset - if (valueuV > getSettingValue(SettingsOptions::CalibrationOffset)) + if (valueuV > getSettingValue(SettingsOptions::CalibrationOffset)) { valueuV -= getSettingValue(SettingsOptions::CalibrationOffset); - else + } else { valueuV = 0; + } } lastuv = valueuV; return valueuV; @@ -78,8 +79,9 @@ uint32_t TipThermoModel::getTipInC(bool sampleNow) { // I found a number that doesn't unbalance the existing PID, causing overshoot. // This could be tuned in concert with PID parameters... - if (currentTipTempInC < 0) + if (currentTipTempInC < 0) { return 0; + } return currentTipTempInC; } diff --git a/source/Core/Drivers/USBPD.cpp b/source/Core/Drivers/USBPD.cpp index b621ab2c..6613bb9d 100644 --- a/source/Core/Drivers/USBPD.cpp +++ b/source/Core/Drivers/USBPD.cpp @@ -46,7 +46,7 @@ void USBPowerDelivery::IRQOccured() { pe.IRQOccured(); } bool USBPowerDelivery::negotiationHasWorked() { return pe.pdHasNegotiated(); } uint8_t USBPowerDelivery::getStateNumber() { return pe.currentStateCode(true); } void USBPowerDelivery::step() { - while (pe.thread()) {} + while (pe.thread()) {} } void USBPowerDelivery::PPSTimerCallback() { pe.TimersCallback(); } @@ -93,18 +93,22 @@ uint32_t *USBPowerDelivery::getLastSeenCapabilities() { return lastCapabilities; static unsigned int sqrtI(unsigned long sqrtArg) { unsigned int answer, x; unsigned long temp; - if (sqrtArg == 0) + if (sqrtArg == 0) { return 0; // undefined result - if (sqrtArg == 1) - return 1; // identity + } + if (sqrtArg == 1) { + return 1; // identity + } answer = 0; // integer square root for (x = 0x8000; x > 0; x = x >> 1) { // 16 bit shift answer |= x; // possible bit in root temp = answer * answer; // - if (temp == sqrtArg) + if (temp == sqrtArg) { break; // exact, found it - if (temp > sqrtArg) + } + if (temp > sqrtArg) { answer ^= x; // too large, reverse bit + } } return answer; // approximate root } @@ -225,7 +229,6 @@ bool EPREvaluateCapabilityFunc(const epr_pd_msg *capabilities, pd_msg *request) request->hdr = PD_MSGTYPE_EPR_REQUEST | PD_NUMOBJ(2); request->obj[1] = lastCapabilities[bestIndex]; // Copy PDO into slot 2 - if (bestIsAVS) { request->obj[0] = PD_RDO_PROG_CURRENT_SET(PD_CA2PAI(bestIndexCurrent)) | PD_RDO_PROG_VOLTAGE_SET(PD_MV2APS(bestIndexVoltage)); } else if (bestIsPPS) { diff --git a/source/Makefile b/source/Makefile index 3726cce4..495c147f 100644 --- a/source/Makefile +++ b/source/Makefile @@ -178,7 +178,6 @@ PD_DRIVER_DIR=./Core/Drivers/usb-pd ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \ -o -path $(PD_DRIVER_DIR) \ -o -path $(PINECILV2_SDK_DIR) \ - -o -path $(DRIVER_INC_DIR) \ -o -path $(MINIWARE_HAL_INC_DIR) \ -o -path $(S60_HAL_INC_DIR) \ -o -path $(MHP30_HAL_INC_DIR) \ @@ -193,7 +192,6 @@ ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \ ALL_SOURCE_EXCEPT:=-path $(SOURCE_BRIEFLZ_DIR) \ -o -path $(PD_DRIVER_DIR) \ -o -path $(PINECILV2_SDK_DIR) \ - -o -path $(SOURCE_DRIVERS_DIR) \ -o -path $(MINIWARE_HAL_SRC_DIR) \ -o -path $(S60_HAL_SRC_DIR) \ -o -path $(MHP30_HAL_SRC_DIR) \ From 55d36c98f1bb1de2c0cdce9008f5c2de9e2630ef Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Fri, 28 Jul 2023 12:45:22 +0300 Subject: [PATCH 6/6] Simplify commands for jobs in push.yml (#1761) * Simplify commands for build steps * Fixing multi-lang builds for Pinecil & PinecilV2 * Makefile: fix multi-thread building support * source/Makefile: fix formatting --------- Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com> --- .github/workflows/push.yml | 25 ++++++++----------------- Makefile | 8 ++++---- source/Makefile | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 639ecc9c..f8145858 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -30,9 +30,7 @@ jobs: run: cd source && ./build.sh -m ${{ matrix.model }} - name: Copy license files - run: | - cp LICENSE source/Hexfile/LICENSE - cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md + run: cp LICENSE scripts/LICENSE_RELEASE.md source/Hexfile/ - name: Archive ${{ matrix.model }} artifacts uses: actions/upload-artifact@v3 @@ -47,7 +45,7 @@ jobs: if-no-files-found: error - name: Generate json index file - run: cd source && python3 metadata.py ${{ matrix.model }}.json + run: ./source/metadata.py ${{ matrix.model }}.json - name: Archive ${{ matrix.model }} index file uses: actions/upload-artifact@v3 @@ -79,12 +77,10 @@ jobs: run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" - name: Build ${{ matrix.model }} - run: cd source && make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese + run: make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese - name: Copy license files - run: | - cp LICENSE source/Hexfile/LICENSE - cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md + run: cp LICENSE scripts/LICENSE_RELEASE.md source/Hexfile/ - name: Archive ${{ matrix.model }} artifacts uses: actions/upload-artifact@v3 @@ -99,7 +95,7 @@ jobs: if-no-files-found: error - name: Generate json index file - run: cd source && python3 metadata.py ${{ matrix.model }}_multi-lang.json + run: ./source/metadata.py ${{ matrix.model }}_multi-lang.json - name: Archive ${{ matrix.model }} index file uses: actions/upload-artifact@v3 @@ -125,15 +121,10 @@ jobs: run: python3 -m pip install bdflib - name: Run python tests - run: cd Translations && chmod +x make_translation_test.py && ./make_translation_test.py + run: ./Translations/make_translation_test.py - name: Run BriefLZ tests - run: | - cd source - make Objects/host/brieflz/libbrieflz.so - cd ../Translations - chmod +x brieflz_test.py - ./brieflz_test.py + run: make -C source/ Objects/host/brieflz/libbrieflz.so && ./Translations/brieflz_test.py check_c-cpp: @@ -150,7 +141,7 @@ jobs: submodules: true - name: Check format style with clang-format - run: cd source && make clean && make check-style + run: make clean check-style check_python: diff --git a/Makefile b/Makefile index d7a4a0c5..3f9f7498 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ test-py: @echo "" flake8 Translations black --check Translations - @make -C source/ Objects/host/brieflz/libbrieflz.so + @$(MAKE) -C source/ Objects/host/brieflz/libbrieflz.so ./Translations/brieflz_test.py ./Translations/make_translation_test.py @@ -149,7 +149,7 @@ test-ccpp: @echo "" @echo "---- Checking C/C++ code... ----" @echo "" - make -C source/ clean check-style + $(MAKE) -C source/ clean check-style # meta target for tests & checks based on .github/workflows/push tests: test-md test-sh test-py test-ccpp @@ -159,11 +159,11 @@ tests: test-md test-sh test-py test-ccpp # pass-through target for Makefile inside source/ dir %: - make -C source/ $@ + $(MAKE) -C source/ $@ # global clean-up target for produced/generated files inside tree clean-build: - make -C source/ clean-all + $(MAKE) -C source/ clean-all rm -Rf site rm -Rf scripts/ci/artefacts diff --git a/source/Makefile b/source/Makefile index 495c147f..7ffa4b95 100644 --- a/source/Makefile +++ b/source/Makefile @@ -763,15 +763,15 @@ Core/Gen/Translation_brieflz.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.o @test -d $(@D) || mkdir -p $(@D) @echo Generating BriefLZ compressed translation for $* @OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \ - --macros $(PWD)/Core/Gen/macros.txt \ - -o $(PWD)/Core/Gen/Translation_brieflz.$*.cpp \ + --macros $(CURDIR)/Core/Gen/macros.txt \ + -o $(CURDIR)/Core/Gen/Translation_brieflz.$*.cpp \ --input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \ --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/$*.o \ $* Core/Gen/Translation_brieflz_font.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so Core/Gen/macros.txt @test -d $(@D) || mkdir -p $(@D) - @echo Generating BriefLZ compressed translation for $* + @echo Generating BriefLZ compressed translation font for $* @$(HOST_PYTHON) ../Translations/make_translation.py \ --macros $(PWD)/Core/Gen/macros.txt \ -o $(PWD)/Core/Gen/Translation_brieflz_font.$*.cpp \ @@ -818,8 +818,8 @@ Core/Gen/Translation_multi.$(1).cpp: $(patsubst %,../Translations/translation_%. @test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files @echo 'Generating translations for multi-language $(2)' @$(HOST_PYTHON) ../Translations/make_translation.py \ - --macros $(PWD)/Core/Gen/macros.txt \ - -o $(PWD)/Core/Gen/Translation_multi.$(1).cpp \ + --macros $(CURDIR)/Core/Gen/macros.txt \ + -o $(CURDIR)/Core/Gen/Translation_multi.$(1).cpp \ --output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \ $(3) @@ -829,8 +829,8 @@ Core/Gen/Translation_brieflz_multi.$(1).cpp: $(OUTPUT_DIR)/Core/Gen/translation. @test -d $$(@D) || mkdir -p $$(@D) @echo Generating BriefLZ compressed translation for multi-language $(2) @OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \ - --macros $(PWD)/Core/Gen/macros.txt \ - -o $(PWD)/Core/Gen/Translation_brieflz_multi.$(1).cpp \ + --macros $(CURDIR)/Core/Gen/macros.txt \ + -o $(CURDIR)/Core/Gen/Translation_brieflz_multi.$(1).cpp \ --input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \ --strings-obj $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).o \ --compress-font \ @@ -873,9 +873,9 @@ style: # * process STOP env variable check-style: @error=0; export LIST=$$LIST; for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \ - ../scripts/deploy.sh check_style_file "$$src" ; \ - test "$${?}" -eq 1 && export error=1 ; \ - test "$${error}" -eq 1 && test -n "$${STOP}" && break; \ + ../scripts/deploy.sh check_style_file "$$src" ; \ + test "$${?}" -eq 1 && export error=1 ; \ + test "$${error}" -eq 1 && test -n "$${STOP}" && break; \ done; \ if [ $$error -eq 0 ] ; then echo "" && echo "" && echo "Style check: PASS" && echo "" && echo "" && exit 0 ; \ else echo "" && echo "" && echo "Style check: FAIL! Please, check the log above for the details." && echo "If there is a false-negative trigger, please, report an issue attaching the log or link to the log!" && echo "" && echo "" && exit 1 ; \