diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index 22b8a5a1..03740457 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -202,8 +202,8 @@ "text2": ["Език:", " BG Български"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index 56dbd53d..848acdc6 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -201,8 +201,8 @@ "text2": ["Řeč:", " CS Český"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_DA.json b/Translations/translation_DA.json index d1647123..d46793c6 100644 --- a/Translations/translation_DA.json +++ b/Translations/translation_DA.json @@ -201,8 +201,8 @@ "text2": ["Sprog :", " DA Dansk"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 3469f1d6..e514cbb5 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -202,8 +202,8 @@ "text2": ["Sprache:", " DE Deutsch"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_EN.json b/Translations/translation_EN.json index 45cb7e33..6fe28e2d 100644 --- a/Translations/translation_EN.json +++ b/Translations/translation_EN.json @@ -202,8 +202,8 @@ "text2": ["Language:", " EN English"], "desc": "Current firmware language" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_ES.json b/Translations/translation_ES.json index c0d7a624..0eef5576 100644 --- a/Translations/translation_ES.json +++ b/Translations/translation_ES.json @@ -202,8 +202,8 @@ "text2": ["Language:", " ES Castellano"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_FI.json b/Translations/translation_FI.json index 544ea27a..c819c593 100644 --- a/Translations/translation_FI.json +++ b/Translations/translation_FI.json @@ -200,8 +200,8 @@ "text2": ["Kieli:", " FI Suomi"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_FR.json b/Translations/translation_FR.json index fca5cbb9..b42a1b0b 100644 --- a/Translations/translation_FR.json +++ b/Translations/translation_FR.json @@ -201,8 +201,8 @@ "text2": ["Langue :", " FR Français"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_HR.json b/Translations/translation_HR.json index 4120ac62..02315219 100644 --- a/Translations/translation_HR.json +++ b/Translations/translation_HR.json @@ -201,8 +201,8 @@ "text2": ["Jezik:", " HR Hrvatski"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_HU.json b/Translations/translation_HU.json index 330cad86..8ebcd03c 100644 --- a/Translations/translation_HU.json +++ b/Translations/translation_HU.json @@ -201,8 +201,8 @@ "text2": ["Nyelv:", " HU Magyar"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 2c353e20..3ff2bc2c 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -201,8 +201,8 @@ "text2": ["Lingua:", " IT Italiano"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_JA_JP.json b/Translations/translation_JA_JP.json index ee6feab9..085df3ec 100644 --- a/Translations/translation_JA_JP.json +++ b/Translations/translation_JA_JP.json @@ -202,8 +202,8 @@ "text2": "言語: 日本語", "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_LT.json b/Translations/translation_LT.json index 2ad4d181..1efbd22d 100644 --- a/Translations/translation_LT.json +++ b/Translations/translation_LT.json @@ -201,8 +201,8 @@ "text2": ["Kalba:", " LT Lietuvių"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index 2d7834ce..6bab2952 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -201,8 +201,8 @@ "text2": ["Spraak :", " NL Nederlands"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_NL_BE.json b/Translations/translation_NL_BE.json index 87edfcd2..f8e97e40 100644 --- a/Translations/translation_NL_BE.json +++ b/Translations/translation_NL_BE.json @@ -201,8 +201,8 @@ "text2": ["Spraak:", " NL_BE Vlaams"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_NO.json b/Translations/translation_NO.json index 9e59ab37..28d131c8 100644 --- a/Translations/translation_NO.json +++ b/Translations/translation_NO.json @@ -201,8 +201,8 @@ "text2": ["Språk:", " NO Norsk"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index cac18455..dc544d52 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -202,8 +202,8 @@ "text2": ["Język :", " PL Polski"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_PT.json b/Translations/translation_PT.json index 66fdacc1..6ab273a5 100644 --- a/Translations/translation_PT.json +++ b/Translations/translation_PT.json @@ -201,8 +201,8 @@ "text2": ["Idioma :", " PT Português"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 7e1a7ce8..9519b1ce 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -201,8 +201,8 @@ "text2": ["Язык:", " RU Русский"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_SK.json b/Translations/translation_SK.json index ba0184bb..ea944b95 100644 --- a/Translations/translation_SK.json +++ b/Translations/translation_SK.json @@ -201,8 +201,8 @@ "text2": ["Jazyk:", " SK Slovenčina"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_SL.json b/Translations/translation_SL.json index b2d863d4..92174b49 100644 --- a/Translations/translation_SL.json +++ b/Translations/translation_SL.json @@ -201,8 +201,8 @@ "text2": ["Jezik:", " SL Slovenščina"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_SR_CYRL.json b/Translations/translation_SR_CYRL.json index 61883c28..dcd1e317 100644 --- a/Translations/translation_SR_CYRL.json +++ b/Translations/translation_SR_CYRL.json @@ -201,8 +201,8 @@ "text2": ["Jезик:", " SR Српски"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_SR_LATN.json b/Translations/translation_SR_LATN.json index db3f5ccd..37cf28f8 100644 --- a/Translations/translation_SR_LATN.json +++ b/Translations/translation_SR_LATN.json @@ -201,8 +201,8 @@ "text2": ["Jezik:", " SR Srpski"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_SV.json b/Translations/translation_SV.json index d8c02762..eca4c3c7 100644 --- a/Translations/translation_SV.json +++ b/Translations/translation_SV.json @@ -195,8 +195,8 @@ "text2": ["Språk:", " SV Svenska"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_TR.json b/Translations/translation_TR.json index 400b87ff..fbc70108 100644 --- a/Translations/translation_TR.json +++ b/Translations/translation_TR.json @@ -213,8 +213,8 @@ "text2": ["Dil:", " TR Türkçe"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_UK.json b/Translations/translation_UK.json index 6e4c7be5..cf77f3a6 100644 --- a/Translations/translation_UK.json +++ b/Translations/translation_UK.json @@ -201,8 +201,8 @@ "text2": ["Мова:", " UK Українська"], "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_YUE_HK.json b/Translations/translation_YUE_HK.json index fbaabc56..e7c9c1a5 100644 --- a/Translations/translation_YUE_HK.json +++ b/Translations/translation_YUE_HK.json @@ -202,8 +202,8 @@ "text2": "語言: 廣東話", "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_ZH_CN.json b/Translations/translation_ZH_CN.json index 81b9f447..022a08d4 100644 --- a/Translations/translation_ZH_CN.json +++ b/Translations/translation_ZH_CN.json @@ -202,8 +202,8 @@ "text2": "语言:简体中文", "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translation_ZH_TW.json b/Translations/translation_ZH_TW.json index 299f54c2..cdb013ff 100644 --- a/Translations/translation_ZH_TW.json +++ b/Translations/translation_ZH_TW.json @@ -203,8 +203,8 @@ "text2": "語言:正體中文", "desc": "" }, - "Contrast": { - "text2": ["Screen", "Contrast"], + "Brightness": { + "text2": ["Screen", "Brightness"], "desc": "Adjust the contrast/brightness of the OLED screen" }, "ColourInversion": { diff --git a/Translations/translations_def.js b/Translations/translations_def.js index cad58a7f..b5027678 100644 --- a/Translations/translations_def.js +++ b/Translations/translations_def.js @@ -355,7 +355,7 @@ var def = "maxLen2": 15 }, { - "id": "Contrast", + "id": "Brightness", "maxLen": 7, "maxLen2": 15 }, diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp index 85ed90a8..8340610c 100644 --- a/source/Core/Drivers/OLED.cpp +++ b/source/Core/Drivers/OLED.cpp @@ -45,7 +45,7 @@ I2C_CLASS::I2C_REG OLED_Setup_Array[] = { {0x80, 0x14, 0}, /*Charge Pump settings*/ {0x80, 0xDA, 0}, /*Set VCOM Pins hardware config*/ {0x80, 0x02, 0}, /*Combination 2*/ - {0x80, 0x81, 0}, /*Contrast*/ + {0x80, 0x81, 0}, /*Brightness*/ {0x80, 0x00, 0}, /*^0*/ {0x80, 0xD9, 0}, /*Set pre-charge period*/ {0x80, 0xF1, 0}, /*Pre charge period*/ @@ -362,7 +362,7 @@ void OLED::setRotation(bool leftHanded) { screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0; } -void OLED::setContrast(uint8_t contrast) { +void OLED::setBrightness(uint8_t contrast) { OLED_Setup_Array[15].val = contrast; I2C_CLASS::writeRegistersBulk(DEVICEADDR_OLED, &OLED_Setup_Array[14], 2); } diff --git a/source/Core/Drivers/OLED.hpp b/source/Core/Drivers/OLED.hpp index b1568b6b..f9d63a5a 100644 --- a/source/Core/Drivers/OLED.hpp +++ b/source/Core/Drivers/OLED.hpp @@ -62,7 +62,7 @@ public: static void setRotation(bool leftHanded); // Set the rotation for the screen // Get the current rotation of the LCD static bool getRotation() { return inLeftHandedMode; } - static void setContrast(uint8_t contrast); + static void setBrightness(uint8_t contrast); static void setInverseDisplay(bool inverted); static int16_t getCursorX() { return cursor_x; } static void print(const char *string, FontStyle fontStyle); // Draw a string to the current location, with selected font diff --git a/source/Core/Inc/Settings.h b/source/Core/Inc/Settings.h index 92397980..cf30ced4 100644 --- a/source/Core/Inc/Settings.h +++ b/source/Core/Inc/Settings.h @@ -48,7 +48,7 @@ enum SettingsOptions { UILanguage = 31, // Selected UI Language code, null-terminated *only if* the length is less than 8 chars PDNegTimeout = 32, // PD timeout in 100ms steps OLEDInversion = 33, // Invert the colours on the display - OLEDContrast = 34, // Contrast for the OLED display + OLEDBrightness = 34, // Brightness for the OLED display // SettingsOptionsLength = 35, // diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 0fc0cfff..4f601fb8 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -59,7 +59,7 @@ enum class SettingsItemIndex : uint8_t { PowerPulseWait, PowerPulseDuration, LanguageSwitch, - Contrast, + Brightness, ColourInversion, NUM_ITEMS, }; diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index 2449930c..fddc3de6 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -76,7 +76,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp {0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage {0, 51, 1, 0}, // PDNegTimeout {0, 2, 1, 0}, // OLEDInversion - {7, 256, 0x08, 51}, // OLEDContrast + {7, 256, 0x08, 51}, // OLEDBrightness }; static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength)); @@ -144,7 +144,7 @@ bool nextSettingValue(const enum SettingsOptions option) { } else { systemSettings.settingsValues[(int)option] += constants.increment; } - return systemSettings.settingsValues[(int)option] == constants.max - constants.increment; + return (constants.max - systemSettings.settingsValues[(int)option]) < constants.increment; } bool prevSettingValue(const enum SettingsOptions option) { diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index 6a198790..1d5c2821 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -199,7 +199,7 @@ const menuitem UIMenu[] = { 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::Contrast), nullptr, settings_displayBrightnessLevel, SettingsOptions::OLEDContrast}, /*Brightness Level*/ + {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, settings_displayBrightnessLevel, SettingsOptions::OLEDBrightness}, /*Brightness Level*/ {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, settings_displayInvertColor, SettingsOptions::OLEDInversion}, /*Invert screen colour*/ {0, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE }; @@ -786,15 +786,20 @@ static bool settings_displayPowerPulseDuration(void) { static bool settings_displayBrightnessLevel(void) { OLED::drawArea(0, 0, 16, 16, brightnessIcon); OLED::setCursor(5 * FONT_12_WIDTH - 2, 0); - OLED::printNumber(getSettingValue(SettingsOptions::OLEDContrast), 3, FontStyle::LARGE); - OLED::setContrast(getSettingValue(SettingsOptions::OLEDContrast)); + // 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) { OLED::drawArea(0, 0, 24, 16, invertDisplayIcon); OLED::setCursor(7 * FONT_12_WIDTH - 2, 0); + // printShortDescription(SettingsItemIndex::ColourInversion, 7); + OLED::drawCheckbox(getSettingValue(SettingsOptions::OLEDInversion)); + // While not optimal to apply this here, it is _very_ convienient OLED::setInverseDisplay(getSettingValue(SettingsOptions::OLEDInversion)); return false; } diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index e5405020..075f4984 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -799,6 +799,8 @@ void startGUITask(void const *argument) { prepareTranslations(); OLED::initialize(); // start up the LCD + OLED::setBrightness(getSettingValue(SettingsOptions::OLEDBrightness)); + OLED::setInverseDisplay(getSettingValue(SettingsOptions::OLEDInversion)); uint8_t tempWarningState = 0; bool buttonLockout = false;