From 2796f095af69fcd0b7900cf2646c4a48d2f574ca Mon Sep 17 00:00:00 2001 From: PlayDay <18056374+playday3008@users.noreply.github.com> Date: Mon, 15 Mar 2021 08:01:12 +0100 Subject: [PATCH] Animated icons (#866) * Add animation Icons * 2D dimensional array * Added animation to GUI * Added Adnimation Speed setting * Added loop * Added Loop switch * Use Checkbox instead of +/- * Animations can now be turned off * Optimize animation code * Move animation options to UI settings --- Translations/translation_BG.json | 16 +- Translations/translation_CS.json | 16 +- Translations/translation_DA.json | 16 +- Translations/translation_DE.json | 14 + Translations/translation_EN.json | 14 + Translations/translation_ES.json | 16 +- Translations/translation_FI.json | 16 +- Translations/translation_FR.json | 14 + Translations/translation_HR.json | 16 +- Translations/translation_HU.json | 14 + Translations/translation_IT.json | 14 + Translations/translation_LT.json | 16 +- Translations/translation_NL.json | 16 +- Translations/translation_NL_BE.json | 16 +- Translations/translation_NO.json | 16 +- Translations/translation_PL.json | 14 + Translations/translation_PT.json | 16 +- Translations/translation_RU.json | 14 + Translations/translation_SK.json | 14 + Translations/translation_SL.json | 16 +- Translations/translation_SR_CYRL.json | 16 +- Translations/translation_SR_LATN.json | 16 +- Translations/translation_SV.json | 16 +- Translations/translation_TR.json | 16 +- Translations/translation_UK.json | 14 + Translations/translation_YUE_HK.json | 14 + Translations/translation_ZH_TW.json | 14 + Translations/translations_def.js | 10 + source/Core/Drivers/Font.h | 856 ++++++++++++++++++++------ source/Core/Inc/Settings.h | 4 +- source/Core/Inc/Translation.h | 4 +- source/Core/Src/Settings.cpp | 2 + source/Core/Src/gui.cpp | 117 +++- source/configuration.h | 10 +- 34 files changed, 1174 insertions(+), 239 deletions(-) diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index ffc2e322..2e3ee512 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index d3be7f4e..8640b56c 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_DA.json b/Translations/translation_DA.json index e9047e10..c1fe7fee 100644 --- a/Translations/translation_DA.json +++ b/Translations/translation_DA.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index f45de078..4a9d8cfd 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -290,6 +290,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_EN.json b/Translations/translation_EN.json index ba96bfe6..93d1e86b 100644 --- a/Translations/translation_EN.json +++ b/Translations/translation_EN.json @@ -290,6 +290,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_ES.json b/Translations/translation_ES.json index ebce2ec5..bf182b54 100644 --- a/Translations/translation_ES.json +++ b/Translations/translation_ES.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_FI.json b/Translations/translation_FI.json index b2d8914a..b608aea0 100644 --- a/Translations/translation_FI.json +++ b/Translations/translation_FI.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_FR.json b/Translations/translation_FR.json index abc7fa8a..ba00f9c4 100644 --- a/Translations/translation_FR.json +++ b/Translations/translation_FR.json @@ -289,6 +289,20 @@ "minimale" ], "desc": "Tension minimale autorisée par cellule <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_HR.json b/Translations/translation_HR.json index 84cc8a58..ff77803f 100644 --- a/Translations/translation_HR.json +++ b/Translations/translation_HR.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_HU.json b/Translations/translation_HU.json index 22ac5a8e..dd13c803 100644 --- a/Translations/translation_HU.json +++ b/Translations/translation_HU.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 86159bdd..1a5ea89c 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_LT.json b/Translations/translation_LT.json index 8b07a2d9..2f3e7d00 100644 --- a/Translations/translation_LT.json +++ b/Translations/translation_LT.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index bb92b3cf..4762f58e 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_NL_BE.json b/Translations/translation_NL_BE.json index 452dd6ef..a0ac4141 100644 --- a/Translations/translation_NL_BE.json +++ b/Translations/translation_NL_BE.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_NO.json b/Translations/translation_NO.json index a4e231d0..09caf348 100644 --- a/Translations/translation_NO.json +++ b/Translations/translation_NO.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index 2e4c5b96..56608867 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -290,6 +290,20 @@ "napięcie" ], "desc": "Minimalne dozwolone napięcie na komórkę <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_PT.json b/Translations/translation_PT.json index f27f7817..589d0c85 100644 --- a/Translations/translation_PT.json +++ b/Translations/translation_PT.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 29621499..5f020f8f 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -289,6 +289,20 @@ "напр." ], "desc": "Минимальное разрешенное напряжение на ячейку <В вольтах> <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Зацикленная", + "анимация" + ], + "desc": "Зацикленная анимация иконок в главном меню" + }, + "AnimSpeed": { + "text2": [ + "Скорость", + "анимации" + ], + "desc": "Скорость анимации иконок в главном меню <Милисекунды> <О=Отключено, Н=Низкий, С=Средний, В=Высокий>" } } } diff --git a/Translations/translation_SK.json b/Translations/translation_SK.json index 21dbf0d4..da9322f7 100644 --- a/Translations/translation_SK.json +++ b/Translations/translation_SK.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_SL.json b/Translations/translation_SL.json index 1b24becd..cee4fe3e 100644 --- a/Translations/translation_SL.json +++ b/Translations/translation_SL.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_SR_CYRL.json b/Translations/translation_SR_CYRL.json index 1fc7b4bf..6313191e 100644 --- a/Translations/translation_SR_CYRL.json +++ b/Translations/translation_SR_CYRL.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_SR_LATN.json b/Translations/translation_SR_LATN.json index 9be516ad..33c7c2a3 100644 --- a/Translations/translation_SR_LATN.json +++ b/Translations/translation_SR_LATN.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_SV.json b/Translations/translation_SV.json index 4f011411..2fefe9d1 100644 --- a/Translations/translation_SV.json +++ b/Translations/translation_SV.json @@ -289,6 +289,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_TR.json b/Translations/translation_TR.json index a4b443d2..2af0ea91 100644 --- a/Translations/translation_TR.json +++ b/Translations/translation_TR.json @@ -307,6 +307,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } -} \ No newline at end of file +} diff --git a/Translations/translation_UK.json b/Translations/translation_UK.json index 38a7c6eb..c606f396 100644 --- a/Translations/translation_UK.json +++ b/Translations/translation_UK.json @@ -289,6 +289,20 @@ "напруга" ], "desc": "Мінімальна дозволена напруга на комірку <В вольтах> <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Зациклена", + "анімація" + ], + "desc": "Зациклена анімація іконок в головному меню" + }, + "AnimSpeed": { + "text2": [ + "Швидкість", + "анімації" + ], + "desc": "Швидкість анімації іконок у головному меню <Мілісекунди> <В=Вимк, Н=Низькa, С=Середня, М=Макс>" } } } diff --git a/Translations/translation_YUE_HK.json b/Translations/translation_YUE_HK.json index 7ea5aa76..173fdd67 100644 --- a/Translations/translation_YUE_HK.json +++ b/Translations/translation_YUE_HK.json @@ -290,6 +290,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translation_ZH_TW.json b/Translations/translation_ZH_TW.json index 45fe6904..b5794a52 100644 --- a/Translations/translation_ZH_TW.json +++ b/Translations/translation_ZH_TW.json @@ -290,6 +290,20 @@ "voltage" ], "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "loop" + ], + "desc": "Loop icon animations in root menu" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "speed" + ], + "desc": "Speed of icon animations in root menu " } } } diff --git a/Translations/translations_def.js b/Translations/translations_def.js index c9a5961a..22d214a7 100644 --- a/Translations/translations_def.js +++ b/Translations/translations_def.js @@ -362,6 +362,16 @@ var def = "id": "MinVolCell", "maxLen": 4, "maxLen2": 9 + }, + { + "id": "AnimLoop", + "maxLen": 6, + "maxLen2": 13 + }, + { + "id": "AnimSpeed", + "maxLen": 6, + "maxLen2": 13 } ] } diff --git a/source/Core/Drivers/Font.h b/source/Core/Drivers/Font.h index c6b5180e..9a752bce 100644 --- a/source/Core/Drivers/Font.h +++ b/source/Core/Drivers/Font.h @@ -147,224 +147,694 @@ const uint8_t disconnectedTipIcon[] = { /* * 16x16 icons + * 32 * 3 = Frame size * Frame count * */ -const uint8_t SettingsMenuIcons[] = { +const uint8_t SettingsMenuIcons[][32 * 3] = { // Power + // 3 frames // width = 16 // height = 16 - 0xC0, - 0xB0, - 0x8C, - 0x83, - 0x01, - 0x01, - 0x21, - 0x31, - 0xA9, - 0x65, - 0x03, - 0x42, - 0x62, - 0x52, - 0xCA, - 0x06, - 0x60, - 0x58, - 0x26, - 0x11, - 0x08, - 0xC4, - 0xB2, - 0x4D, - 0x23, - 0x10, - 0x08, - 0x04, - 0x02, - 0x01, - 0x00, - 0x00, + { + // Power 1 frame + // width = 16 + // height = 16 + 0xC0, + 0xB0, + 0x8C, + 0x83, + 0x01, + 0x01, + 0x21, + 0x31, + 0xB9, + 0xFD, + 0xFF, + 0xFE, + 0xFE, + 0xDE, + 0xCE, + 0x06, + 0x60, + 0x58, + 0x26, + 0x11, + 0x08, + 0xC4, + 0xF2, + 0x7D, + 0x3F, + 0x1F, + 0x0F, + 0x07, + 0x03, + 0x01, + 0x00, + 0x00, + + // Power 2 frame + // width = 16 + // height = 16 + 0xC0, + 0xF0, + 0xFC, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xEF, + 0x67, + 0x03, + 0x42, + 0x62, + 0x52, + 0xCA, + 0x06, + 0x60, + 0x78, + 0x3E, + 0x1F, + 0x0F, + 0xC7, + 0xB3, + 0x4D, + 0x23, + 0x10, + 0x08, + 0x04, + 0x02, + 0x01, + 0x00, + 0x00, + + // Power final frame + // width = 16 + // height = 16 + 0xC0, + 0xB0, + 0x8C, + 0x83, + 0x01, + 0x01, + 0x21, + 0x31, + 0xA9, + 0x65, + 0x03, + 0x42, + 0x62, + 0x52, + 0xCA, + 0x06, + 0x60, + 0x58, + 0x26, + 0x11, + 0x08, + 0xC4, + 0xB2, + 0x4D, + 0x23, + 0x10, + 0x08, + 0x04, + 0x02, + 0x01, + 0x00, + 0x00, + }, // Soldering + // 3 frames // width = 16 // height = 16 - 0x00, - 0x02, - 0x04, - 0x08, - 0x12, - 0x24, - 0xC4, - 0x42, - 0x82, - 0x04, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x02, - 0x07, - 0x0A, - 0x14, - 0x28, - 0x50, - 0x60, - 0x00, + { + // Soldering 1 frame + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0x40, + 0xE0, + 0x50, + 0x28, + 0x14, + 0x0A, + 0x06, + 0x00, + 0x00, + 0x40, + 0x20, + 0x10, + 0x08, + 0x04, + 0x03, + 0x02, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + // Soldering 2 frame + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0x40, + 0xE0, + 0x50, + 0x28, + 0x14, + 0x0A, + 0x06, + 0x00, + 0x00, + 0x48, + 0x26, + 0x10, + 0x08, + 0x04, + 0x03, + 0x02, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + // Soldering final frame + // width = 16 + // height = 16 + 0x00, + 0x80, + 0x40, + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0x40, + 0xE0, + 0x50, + 0x28, + 0x14, + 0x0A, + 0x06, + 0x00, + 0x00, + 0x49, + 0x26, + 0x10, + 0x08, + 0x04, + 0x03, + 0x02, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + }, // Sleep + // 3 frames // width = 16 // height = 16 - 0x00, - 0xC6, - 0xE6, - 0xF6, - 0xBE, - 0x9E, - 0x8E, - 0x86, - 0x00, - 0x00, - 0x40, - 0x40, - 0xC0, - 0xC0, - 0xC0, - 0x00, - 0x00, - 0x01, - 0x01, - 0x01, - 0x45, - 0x65, - 0x75, - 0x5D, - 0x4C, - 0x00, - 0x06, - 0x07, - 0x07, - 0x05, - 0x04, - 0x00, + { + // Sleep 1 frame + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x44, + 0x64, + 0x74, + 0x5C, + 0x4C, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + // Sleep 2 frame + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x40, + 0xC0, + 0xC0, + 0xC0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x44, + 0x64, + 0x74, + 0x5C, + 0x4C, + 0x00, + 0x06, + 0x07, + 0x07, + 0x05, + 0x04, + 0x00, + + // Sleep final frame + // width = 16 + // height = 16 + 0x00, + 0xC6, + 0xE6, + 0xF6, + 0xBE, + 0x9E, + 0x8E, + 0x86, + 0x00, + 0x00, + 0x40, + 0x40, + 0xC0, + 0xC0, + 0xC0, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x45, + 0x65, + 0x75, + 0x5D, + 0x4C, + 0x00, + 0x06, + 0x07, + 0x07, + 0x05, + 0x04, + 0x00, + }, // Menu + // 3 frames // width = 16 // height = 16 - 0x00, - 0x80, - 0x06, - 0x86, - 0x46, - 0x06, - 0x86, - 0x86, - 0x86, - 0x86, - 0x86, - 0x86, - 0x86, - 0x86, - 0x86, - 0x00, - 0x00, - 0x00, - 0x61, - 0x60, - 0x00, - 0x00, - 0x61, - 0x61, - 0x61, - 0x61, - 0x61, - 0x61, - 0x61, - 0x61, - 0x61, - 0x00, + { + // Menu 1 frame + // width = 16 + // height = 16 + 0x00, + 0x80, + 0x06, + 0x06, + 0x06, + 0x06, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x00, + 0x00, + 0x00, + 0x60, + 0x60, + 0x00, + 0x00, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x00, + + // Menu 2 frame + // width = 16 + // height = 16 + 0x00, + 0x80, + 0x06, + 0x06, + 0x06, + 0x06, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x00, + 0x00, + 0x00, + 0x61, + 0x60, + 0x00, + 0x00, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x00, + + // Menu final frame + // width = 16 + // height = 16 + 0x00, + 0x80, + 0x06, + 0x86, + 0x46, + 0x06, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x86, + 0x00, + 0x00, + 0x00, + 0x61, + 0x60, + 0x00, + 0x00, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x61, + 0x00, + }, // Wrench + // 3 frames /// width = 16 // height = 16 - 0x00, - 0x18, - 0x30, - 0x32, - 0x7E, - 0x7C, - 0xF0, - 0xC0, - 0x80, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x03, - 0x0F, - 0x3E, - 0x7E, - 0x4C, - 0x0C, - 0x18, - 0x00, + { + // Wrench 1 frame + /// width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x18, + 0x30, + 0x32, + 0x7E, + 0x7C, + 0xF0, + 0xC0, + + // Wrench 2 frame + /// width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0xC0, + 0x80, + 0x90, + 0xF0, + 0xE0, + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x01, + 0x03, + 0x03, + 0x07, + 0x0E, + 0x1C, + 0x78, + 0xF0, + 0xF0, + 0x60, + + // Wrench final frame + /// width = 16 + // height = 16 + 0x00, + 0x18, + 0x30, + 0x32, + 0x7E, + 0x7C, + 0xF0, + 0xC0, + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x01, + 0x03, + 0x0F, + 0x3E, + 0x7E, + 0x4C, + 0x0C, + 0x18, + 0x00, + }, #ifdef NOTUSED + // Calibration (Not used, kept for future menu layouts) + // 3 frames // width = 16 // height = 16 - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x80, - 0xC0, - 0xE8, - 0x70, - 0x7A, - 0x5E, - 0x8E, - 0x1C, - 0x30, - 0x00, - 0x00, - 0x10, - 0x38, - 0x1C, - 0x0E, - 0x07, - 0x03, - 0x01, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, + { + // Calibration 1 frame (Not used, kept for future menu layouts) + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0xC0, + 0xE0, + 0x70, + 0x3A, + 0x1E, + 0x0E, + 0x1C, + 0x30, + 0x00, + 0x00, + 0x10, + 0x3A, + 0x1C, + 0x1E, + 0x17, + 0x23, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + // Calibration 2 frame (Not used, kept for future menu layouts) + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x80, + 0xC0, + 0xE0, + 0x70, + 0x3A, + 0x1E, + 0x0E, + 0x1C, + 0x30, + 0x00, + 0x00, + 0x10, + 0x38, + 0x1C, + 0x0E, + 0x07, + 0x03, + 0x03, + 0x02, + 0x04, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + // Calibration final frame (Not used, kept for future menu layouts) + // width = 16 + // height = 16 + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x80, + 0xC0, + 0xE8, + 0x70, + 0x7A, + 0x5E, + 0x8E, + 0x1C, + 0x30, + 0x00, + 0x00, + 0x10, + 0x38, + 0x1C, + 0x0E, + 0x07, + 0x03, + 0x01, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + } #endif }; diff --git a/source/Core/Inc/Settings.h b/source/Core/Inc/Settings.h index 828fa334..d69e3b04 100644 --- a/source/Core/Inc/Settings.h +++ b/source/Core/Inc/Settings.h @@ -10,7 +10,7 @@ #ifndef SETTINGS_H_ #define SETTINGS_H_ #include -#define SETTINGSVERSION (0x26) +#define SETTINGSVERSION (0x28) /*Change this if you change the struct below to prevent people getting \ out of sync*/ @@ -29,6 +29,8 @@ typedef struct { uint8_t QCIdealVoltage; // Desired QC3.0 voltage (9,12,20V) uint8_t OrientationMode : 2; // Selects between Auto,Right and left handed layouts uint8_t sensitivity : 4; // Sensitivity of accelerometer (5 bits) + uint8_t animationLoop : 1; // Animation loop switch + uint16_t animationSpeed; // Animation speed (in miliseconds) uint8_t autoStartMode : 2; // Should the unit automatically jump straight // into soldering mode when power is applied uint8_t ShutdownTime; // Time until unit shuts down if left alone diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 21507b8c..0944a04d 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -12,8 +12,8 @@ extern const uint8_t USER_FONT_12[]; extern const uint8_t USER_FONT_6x8[]; extern const bool HasFahrenheit; -extern const char *SettingsShortNames[29][2]; -extern const char *SettingsDescriptions[29]; +extern const char *SettingsShortNames[31][2]; +extern const char *SettingsDescriptions[31]; extern const char *SettingsMenuEntries[5]; extern const char *SettingsCalibrationDone; diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index 3cdc8296..81d59ec5 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -70,6 +70,8 @@ void resetSettings() { systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0 systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow + systemSettings.animationLoop = ANIMATION_LOOP; // Default false + systemSettings.animationSpeed = ANIMATION_SPEED; // Default 400 ms (Medium) systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV systemSettings.powerLimit = POWER_LIMIT; // 30 watts default limit systemSettings.ReverseButtonTempChangeEnabled = REVERSE_BUTTON_TEMP_CHANGE; // diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index 9b9f254f..6d37dbf1 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -70,6 +70,10 @@ static void settings_displayTempChangeLongStep(void); static bool settings_setTempChangeLongStep(void); static void settings_displayPowerPulse(void); static bool settings_setPowerPulse(void); +static void settings_displayAnimationSpeed(void); +static bool settings_setAnimationSpeed(void); +static void settings_displayAnimationLoop(void); +static bool settings_setAnimationLoop(void); #ifdef HALL_SENSOR static void settings_displayHallEffect(void); static bool settings_setHallEffect(void); @@ -126,34 +130,34 @@ static bool settings_enterAdvancedMenu(void); * */ const menuitem rootSettingsMenu[]{ -/* - * Power Menu - * Soldering Menu - * Power Saving Menu - * UI Menu - * Advanced Menu - * Exit - */ - {(const char *)NULL, settings_enterPowerMenu, settings_displayPowerMenu}, /*Power*/ - {(const char *)NULL, settings_enterSolderingMenu, settings_displaySolderingMenu}, /*Soldering*/ - {(const char *)NULL, settings_enterPowerSavingMenu, settings_displayPowerSavingMenu}, /*Sleep Options Menu*/ - {(const char *)NULL, settings_enterUIMenu, settings_displayUIMenu}, /*UI Menu*/ - {(const char *)NULL, settings_enterAdvancedMenu, settings_displayAdvancedMenu}, /*Advanced Menu*/ - {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE + /* + * Power Menu + * Soldering Menu + * Power Saving Menu + * UI Menu + * Advanced Menu + * Exit + */ + {(const char *)NULL, settings_enterPowerMenu, settings_displayPowerMenu}, /*Power*/ + {(const char *)NULL, settings_enterSolderingMenu, settings_displaySolderingMenu}, /*Soldering*/ + {(const char *)NULL, settings_enterPowerSavingMenu, settings_displayPowerSavingMenu}, /*Sleep Options Menu*/ + {(const char *)NULL, settings_enterUIMenu, settings_displayUIMenu}, /*UI Menu*/ + {(const char *)NULL, settings_enterAdvancedMenu, settings_displayAdvancedMenu}, /*Advanced Menu*/ + {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; const menuitem powerMenu[] = { - /* - * Power Source - */ +/* + * Power Source + */ #ifdef POW_DC - {(const char *)SettingsDescriptions[0], settings_setInputVRange, settings_displayInputVRange}, /*Voltage input*/ - {(const char *)SettingsDescriptions[28], settings_setInputMinVRange, settings_displayInputMinVRange}, /*Minimum voltage input*/ + {(const char *)SettingsDescriptions[0], settings_setInputVRange, settings_displayInputVRange}, /*Voltage input*/ + {(const char *)SettingsDescriptions[28], settings_setInputMinVRange, settings_displayInputMinVRange}, /*Minimum voltage input*/ #endif #ifdef POW_QC - {(const char *)SettingsDescriptions[19], settings_setQCInputV, settings_displayQCInputV}, /*Voltage input*/ + {(const char *)SettingsDescriptions[19], settings_setQCInputV, settings_displayQCInputV}, /*Voltage input*/ #endif - {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE + {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; const menuitem solderingMenu[] = { /* @@ -185,6 +189,8 @@ const menuitem UIMenu[] = { {(const char *)SettingsDescriptions[10], settings_setCoolingBlinkEnabled, settings_displayCoolingBlinkEnabled}, /*Cooling blink warning*/ {(const char *)SettingsDescriptions[15], settings_setScrollSpeed, settings_displayScrollSpeed}, /*Scroll Speed for descriptions*/ {(const char *)SettingsDescriptions[21], settings_setReverseButtonTempChangeEnabled, settings_displayReverseButtonTempChangeEnabled}, /* Reverse Temp change buttons + - */ + {(const char *)SettingsDescriptions[30], settings_setAnimationSpeed, settings_displayAnimationSpeed}, /*Animation Speed adjustment */ + {(const char *)SettingsDescriptions[29], settings_setAnimationLoop, settings_displayAnimationLoop}, /*Animation Loop switch */ {NULL, NULL, NULL} // end of menu marker. DO NOT REMOVE }; const menuitem PowerSavingMenu[] = { @@ -213,6 +219,8 @@ const menuitem advancedMenu[] = { * Calibrate Input V * Reset Settings * Power Pulse + * Animation Loop + * Animation Speed */ {(const char *)SettingsDescriptions[20], settings_setPowerLimit, settings_displayPowerLimit}, /*Power limit*/ {(const char *)SettingsDescriptions[6], settings_setAdvancedIDLEScreens, settings_displayAdvancedIDLEScreens}, /* Advanced idle screen*/ @@ -328,7 +336,7 @@ static bool settings_setInputMinVRange(void) { systemSettings.minVoltageCells = (systemSettings.minVoltageCells + 1) % 38; if (systemSettings.minDCVoltageCells == 1 && systemSettings.minVoltageCells < 30) systemSettings.minVoltageCells = 30; - else if(systemSettings.minVoltageCells < 24) + else if (systemSettings.minVoltageCells < 24) systemSettings.minVoltageCells = 24; return systemSettings.minVoltageCells == 37; } @@ -894,6 +902,52 @@ static void settings_displayPowerPulse(void) { OLED::print(OffString); } } + +static bool settings_setAnimationLoop(void) { + systemSettings.animationLoop = !systemSettings.animationLoop; + return false; +} + +static void settings_displayAnimationLoop(void) { + printShortDescription(29, 7); + OLED::drawCheckbox(systemSettings.animationLoop); +} + +static bool settings_setAnimationSpeed(void) { + switch (systemSettings.animationSpeed) { + case 0: + systemSettings.animationSpeed = TICKS_100MS * 5; + break; + case TICKS_100MS * 5: + systemSettings.animationSpeed = TICKS_100MS * 4; + break; + case TICKS_100MS * 4: + systemSettings.animationSpeed = TICKS_100MS * 3; + break; + default: + systemSettings.animationSpeed = 0; + break; + } + return systemSettings.animationSpeed == TICKS_100MS * 3; +} + +static void settings_displayAnimationSpeed(void) { + printShortDescription(30, 7); + switch (systemSettings.animationSpeed) { + case TICKS_100MS * 5: + OLED::print(SettingSensitivityLow); + break; + case TICKS_100MS * 4: + OLED::print(SettingSensitivityMedium); + break; + case TICKS_100MS * 3: + OLED::print(SettingSensitivityHigh); + break; + default: + OLED::print(SettingSensitivityOff); + break; + } +} #ifdef HALL_SENSOR static void settings_displayHallEffect(void) { printShortDescription(26, 7); @@ -921,6 +975,9 @@ static bool settings_setHallEffect(void) { return systemSettings.hallEffectSensitivity == 3; } #endif + +static bool animOpenState = false; + static void displayMenu(size_t index) { // Call into the menu const char *textPtr = SettingsMenuEntries[index]; @@ -937,7 +994,19 @@ static void displayMenu(size_t index) { // Draw symbol // 16 pixel wide image // 2 pixel wide scrolling indicator - OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index])); + static TickType_t menuSwitchLoopTick = 0; + static size_t menuCurrentIndex = sizeof(rootSettingsMenu) + 1; + static size_t currentFrame = 0; + if (!animOpenState) { + if (menuCurrentIndex != index) { + menuCurrentIndex = index; + currentFrame = systemSettings.animationSpeed ? 0 : 2; + menuSwitchLoopTick = xTaskGetTickCount(); + } + if (systemSettings.animationSpeed && (systemSettings.animationLoop || currentFrame != 2)) + currentFrame = ((xTaskGetTickCount() - menuSwitchLoopTick) / systemSettings.animationSpeed) % 3; + OLED::drawArea(OLED_WIDTH - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[index][(16 * 2) * currentFrame])); + } } static void settings_displayCalibrateVIN(void) { printShortDescription(13, 5); } @@ -993,6 +1062,7 @@ void gui_Menu(const menuitem *menu) { // Then we play a transition from the current primary // framebuffer to the new buffer. // The extra buffer is discarded at the end of the transition. + animOpenState = true; OLED::useSecondaryFramebuffer(true); OLED::setFont(0); OLED::setCursor(0, 0); @@ -1000,6 +1070,7 @@ void gui_Menu(const menuitem *menu) { menu[currentScreen].draw(); OLED::useSecondaryFramebuffer(false); OLED::transitionSecondaryFramebuffer(true); + animOpenState = false; } while ((menu[currentScreen].draw != NULL) && earlyExit == false) { diff --git a/source/configuration.h b/source/configuration.h index a326dfc8..087ce0f3 100644 --- a/source/configuration.h +++ b/source/configuration.h @@ -88,10 +88,12 @@ #define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 -#define CUT_OUT_SETTING 0 // default to no cut-off voltage -#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) -#define TEMPERATURE_INF 0 // default to 0 -#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow +#define CUT_OUT_SETTING 0 // default to no cut-off voltage +#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) +#define TEMPERATURE_INF 0 // default to 0 +#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow +#define ANIMATION_LOOP 0 // 0: off 1: on +#define ANIMATION_SPEED 400 // 0: off, 300: High, 400: Medium, 500: Low #define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 #define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2