From 22d0676a5c839dc95c2098cd20a083832d39f9c9 Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Sat, 1 Feb 2025 23:20:12 +0300 Subject: [PATCH 1/6] scripts/deploy.sh: add handmade linter for translation-related json files to check for tabs and odd spaces (#2064) * scripts/deploy.sh: add handmade linter for translation-related json files to check for tabs and odd spaces --- .github/workflows/push.yml | 4 ++-- Makefile | 2 +- Translations/translation_UZ.json | 2 +- scripts/deploy.sh | 33 +++++++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a8145070..bbd3949b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -215,7 +215,7 @@ jobs: steps: - name: Install dependencies (apk) - run: apk add --no-cache git + run: apk add --no-cache git bash grep - uses: actions/checkout@v4 with: @@ -227,4 +227,4 @@ jobs: run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" - name: Check and verify documentation - run: /bin/sh ./scripts/deploy.sh docs + run: ./scripts/deploy.sh docs diff --git a/Makefile b/Makefile index 20453f4c..c22f6718 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,7 @@ test-md: @echo "" @echo "---- Checking documentation... ----" @echo "" - @/bin/sh ./scripts/deploy.sh docs + @./scripts/deploy.sh docs # shell style & linter check (github CI version of shellcheck is more recent than alpine one so the latter may not catch some policies) test-sh: diff --git a/Translations/translation_UZ.json b/Translations/translation_UZ.json index 97f8b9d6..24406789 100644 --- a/Translations/translation_UZ.json +++ b/Translations/translation_UZ.json @@ -137,7 +137,7 @@ "menuOptions": { "DCInCutoff": { "displayText": "Quvvat\nmanbai", - "description": "Batareya haddan tashqari zaryadsizlanishini oldini olish uchun kuchlanish chegarasini o'rnatish (DC 10V) (S=3.3V har bir yacheyka uchun, quvvat PWR chegarasini o'chirish)" + "description": "Batareya haddan tashqari zaryadsizlanishini oldini olish uchun kuchlanish chegarasini o'rnatish (DC 10V) (S=3.3V har bir yacheyka uchun, quvvat PWR chegarasini o'chirish)" }, "MinVolCell": { "displayText": "Minimal\nkuchlanish", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 3f34e5b6..5ebd28df 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -95,9 +95,10 @@ docs_links() { ver_git="$(git tag -l | sort | grep -e "^v" | grep -v "rc" | tail -1)" md="README.md" + test -f "${md}" || (echo "deploy.sh: docs_links: ERROR with the project directory structure!" && exit 1) ver_md="$(grep -c "${ver_git}" "${md}")" ret=0 - if [ "${ver_md}" -ne 0 ]; then + if [ "${ver_md}" -eq 0 ]; then ret=1 echo "Please, update mention & links in ${md} inside Builds section for release builds with version ${ver_git}." fi; @@ -108,16 +109,38 @@ docs_links() build_langs() { mk="../source/Makefile" - cd Translations/ || exit 1 + cd Translations/ || (echo "deploy.sh: build_langs: ERROR with the project directory structure!" && exit 1) langs="$(echo "$(find ./*.json | sed -ne 's,^\./translation_,,; s,\.json$,,; /[A-Z]/p' ; sed -ne 's/^ALL_LANGUAGES=//p;' "${mk}")" | sed 's, ,\n,g; s,\r,,g' | sort | uniq -u)" - ret=0 if [ -n "${langs}" ]; then - ret=1 echo "It seems there is mismatch between supported languages and enabled builds." echo "Please, check files in Translations/ and ALL_LANGUAGES variable in source/Makefile for:" echo "${langs}" + return 1 fi; - return "${ret}" + cd .. + + echo -ne "\n" + grep -nH $'\11' Translations/translation*.json + ret="${?}" + if [ "${ret}" -eq 0 ]; then + echo -ne "\t^^^^\t^^^^\n" + echo "Please, remove any tabs as indention from json file(s) in Translations/ directory (see the exact files & lines in the list above)." + echo "Use spaces only to indent in the future, please." + echo -ne "\n" + return 1 + fi; + + grep -nEH -e "^( {1}| {3}| {5}| {7}| {9}| {11})[^ ]" Translations/translation*.json + ret="${?}" + if [ "${ret}" -eq 0 ]; then + echo -ne "\t^^^^\t^^^^\n" + echo "Please, remove any odd amount of extra spaces as indention from json file(s) in Translations/ directory (see the exact files & lines in the list above)." + echo "Use even amount of spaces to indent in the future, please (two actual spaces per one indent, not tab)." + echo -ne "\n" + return 1 + fi; + + return 0 } # Helper function to check code style using clang-format & grep/sed custom parsers: From ab1fa2486355f7dd4bfd047ac30832439067adfd Mon Sep 17 00:00:00 2001 From: safocl Date: Sun, 2 Feb 2025 09:45:17 +0400 Subject: [PATCH 2/6] settingsGUI.cpp: remove duplicated calls (#2065) settingsGUI.cpp: remove duplicated calls from if-else blocks --- source/Core/Src/settingsGUI.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source/Core/Src/settingsGUI.cpp b/source/Core/Src/settingsGUI.cpp index d26b26bb..cba9853e 100644 --- a/source/Core/Src/settingsGUI.cpp +++ b/source/Core/Src/settingsGUI.cpp @@ -579,7 +579,6 @@ static void setBoostTemp(void) { if (value >= MAX_TEMP_F) { value = 0; // jump to off } - setSettingValue(SettingsOptions::BoostTemp, value); } else { if (value == 0) { value = MIN_BOOST_TEMP_C; // loop back at 250 @@ -654,14 +653,13 @@ static void setProfileTemp(const enum SettingsOptions option) { if (temp > MAX_TEMP_F) { temp = MIN_TEMP_F; } - setSettingValue(option, temp); } else { temp += 5; if (temp > MAX_TEMP_C) { temp = MIN_TEMP_C; } - setSettingValue(option, temp); } + setSettingValue(option, temp); } static void setProfilePreheatTemp(void) { return setProfileTemp(SettingsOptions::ProfilePreheatTemp); } @@ -712,14 +710,13 @@ static void setSleepTemp(void) { if (temp > 580) { temp = 60; } - setSettingValue(SettingsOptions::SleepTemp, temp); } else { temp += 10; if (temp > 300) { temp = 10; } - setSettingValue(SettingsOptions::SleepTemp, temp); } + setSettingValue(SettingsOptions::SleepTemp, temp); } static void displaySleepTemp(void) { OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE); } @@ -759,12 +756,11 @@ static bool showHallEffect(void) { return getHallSensorFitted(); } static void displayHallEffectSleepTime(void) { if (getSettingValue(SettingsOptions::HallEffectSleepTime)) { OLED::printNumber(getSettingValue(SettingsOptions::HallEffectSleepTime) * 5, 2, FontStyle::LARGE, false); - OLED::print(LargeSymbolSeconds, FontStyle::LARGE); } else { // When sleep time is set to zero, we sleep for 1 second anyways. This is the default. OLED::printNumber(1, 2, FontStyle::LARGE, false); - OLED::print(LargeSymbolSeconds, FontStyle::LARGE); } + OLED::print(LargeSymbolSeconds, FontStyle::LARGE); } #endif /* HALL_SENSOR */ From 5797d5a68bc0c52fc2ba765b00afd00d6bbd4f96 Mon Sep 17 00:00:00 2001 From: safocl Date: Sun, 2 Feb 2025 12:35:43 +0400 Subject: [PATCH 3/6] fix: accessing inactive union members Access to the inactive union members is an undefined behavior. `column.whole = (1 << height) - 1;` -- 'whole' is active member here, `fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]);` -- but the 'strips' member accessed here. Same issue: https://gitlab.com/libeigen/eigen/-/issues/2898 --- source/Core/Drivers/OLED.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp index adde9d2b..542b6dc6 100644 --- a/source/Core/Drivers/OLED.cpp +++ b/source/Core/Drivers/OLED.cpp @@ -11,6 +11,7 @@ #include "cmsis_os.h" #include "configuration.h" #include +#include #include #include @@ -209,21 +210,18 @@ void OLED::drawChar(const uint16_t charCode, const FontStyle fontStyle, const ui * of the indicator in pixels (0..<16). */ void OLED::drawScrollIndicator(uint8_t y, uint8_t height) { - union u_type { - uint32_t whole; - uint8_t strips[4]; - } column; - - column.whole = (1 << height) - 1; // preload a set of set bits of height - column.whole <<= y; // Shift down by the y value + const uint32_t whole = ((1 << height) - 1) << y; // preload a set of set bits of height + // Shift down by the y value + const uint8_t strips[4] = {static_cast(whole & 0xff), static_cast((whole & 0xff00) >> 8 * 1), static_cast((whole & 0xff0000) >> 8 * 2), + static_cast((whole & 0xff000000) >> 8 * 3)}; // Draw a one pixel wide bar to the left with a single pixel as // the scroll indicator. - fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]); - fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]); + fillArea(OLED_WIDTH - 1, 0, 1, 8, strips[0]); + fillArea(OLED_WIDTH - 1, 8, 1, 8, strips[1]); #if OLED_HEIGHT == 32 - fillArea(OLED_WIDTH - 1, 16, 1, 8, column.strips[2]); - fillArea(OLED_WIDTH - 1, 24, 1, 8, column.strips[3]); + fillArea(OLED_WIDTH - 1, 16, 1, 8, strips[2]); + fillArea(OLED_WIDTH - 1, 24, 1, 8, strips[3]); #endif } From c7b029482e1e0586a6e14add04fa2e33432cc5be Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Sun, 2 Feb 2025 21:18:56 +0300 Subject: [PATCH 4/6] README.md: add BLE notice --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 6d4fee8d..e1b74077 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,19 @@ After powering on the device for the first time with _IronOS_ installed and havi Additional details are described in the [menu information](https://ralim.github.io/IronOS/Menu/). +# Remote Control + +## Pinecil V2 only + +Pinecil V2 has [_Bluetooth Low Energy_ module](https://ralim.github.io/IronOS/Bluetooth), which is supported by _IronOS_ since `2.21` release to control some of the settings using additional tools like [PineSAM](https://github.com/builder555/PineSAM) or [PineTool](https://github.com/lachlanbell/PineTool). In `2.21` and `2.22` releases the module was _on_ by default. However, **_Bluetooth_ is turned off in the settings by default on current `dev` builds and for the next releases** [due to security concerns](#1856). But this is related only to situations when a user restores default settings using menu, or when the _IronOS_ update is taking place on a new device or on a device with a previous firmware version. + +To enable _Bluetooth_ back: +- go to _Settings_ menu; +- press `-/B` button four times to scroll the menu for `Advanced settings`; +- press `+/A` button to open submenu; +- press `+/A` button to toggle/enable _Bluetooth_ feature; +- press `-/B` **and hold it** for just more than five seconds to exit from the _Settings_ menu. + ## Translations Is your preferred language missing localisation of some of the text? From f01ab47647f820bc318b87992659624ffebf1c8e Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Sun, 2 Feb 2025 21:25:07 +0300 Subject: [PATCH 5/6] README.md: update formatting --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1b74077..17aa037b 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Additional details are described in the [menu information](https://ralim.github. ## Pinecil V2 only -Pinecil V2 has [_Bluetooth Low Energy_ module](https://ralim.github.io/IronOS/Bluetooth), which is supported by _IronOS_ since `2.21` release to control some of the settings using additional tools like [PineSAM](https://github.com/builder555/PineSAM) or [PineTool](https://github.com/lachlanbell/PineTool). In `2.21` and `2.22` releases the module was _on_ by default. However, **_Bluetooth_ is turned off in the settings by default on current `dev` builds and for the next releases** [due to security concerns](#1856). But this is related only to situations when a user restores default settings using menu, or when the _IronOS_ update is taking place on a new device or on a device with a previous firmware version. +Pinecil V2 has [_Bluetooth Low Energy_ module](https://ralim.github.io/IronOS/Bluetooth), which is supported by _IronOS_ since `2.21` release to control some of the settings using additional tools like [PineSAM](https://github.com/builder555/PineSAM) or [PineTool](https://github.com/lachlanbell/PineTool). In `2.21` and `2.22` releases the module was _on_ by default. However, **_Bluetooth_ is turned off in the settings by default in current `dev` builds and for the next releases** [due to security concerns](#1856).[^ble] To enable _Bluetooth_ back: - go to _Settings_ menu; @@ -152,6 +152,9 @@ To enable _Bluetooth_ back: - press `+/A` button to toggle/enable _Bluetooth_ feature; - press `-/B` **and hold it** for just more than five seconds to exit from the _Settings_ menu. +[^ble]: + This is related only to situations when a user restores default settings using menu, or when _IronOS_ update is taking place on a new device or on a device with a previous firmware version. + ## Translations Is your preferred language missing localisation of some of the text? From 4ce63fab47fae2b2f76eab366edd4d449053188f Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Mon, 3 Feb 2025 01:14:51 +0300 Subject: [PATCH 6/6] README.md: fix formatting of heading levels for BLE section (#2068) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17aa037b..fa6e30df 100644 --- a/README.md +++ b/README.md @@ -139,9 +139,9 @@ After powering on the device for the first time with _IronOS_ installed and havi Additional details are described in the [menu information](https://ralim.github.io/IronOS/Menu/). -# Remote Control +## Remote Control -## Pinecil V2 only +### Pinecil V2 only Pinecil V2 has [_Bluetooth Low Energy_ module](https://ralim.github.io/IronOS/Bluetooth), which is supported by _IronOS_ since `2.21` release to control some of the settings using additional tools like [PineSAM](https://github.com/builder555/PineSAM) or [PineTool](https://github.com/lachlanbell/PineTool). In `2.21` and `2.22` releases the module was _on_ by default. However, **_Bluetooth_ is turned off in the settings by default in current `dev` builds and for the next releases** [due to security concerns](#1856).[^ble] @@ -191,6 +191,6 @@ Other components such as _FreeRTOS_ and _USB-PD_ have their own licenses. ## Commercial Use -This software is provided "AS IS", so I cannot provide any commercial support for the firmware. +This software is provided _**"AS IS"**_, so I cannot provide any commercial support for the firmware. However, you are more than welcome to distribute links to the firmware or provide hardware with this firmware. **Please do not re-host the files, but rather link to this page, so that there are no old versions of the firmware scattered around**.