diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index a583678f..3edab611 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -798,6 +798,13 @@ SetDisplayView::SetDisplayView(NavigationView& nav) { send_system_refresh(); nav.pop(); }; + // only enable invert OR fake brightness + checkbox_invert_switch.on_select = [this](Checkbox&, bool v) { + if (v) checkbox_brightness_switch.set_value(false); + }; + checkbox_brightness_switch.on_select = [this](Checkbox&, bool v) { + if (v) checkbox_invert_switch.set_value(false); + }; button_cancel.on_select = [&nav, this](Button&) { nav.pop(); diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 4dc29d53..964f1208 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -450,7 +450,7 @@ void SystemStatusView::refresh() { button_converter.set_foreground(pmem::config_converter() ? Theme::getInstance()->fg_red->foreground : Theme::getInstance()->fg_light->foreground); // Fake Brightness - button_fake_brightness.set_foreground(pmem::apply_fake_brightness() ? *Theme::getInstance()->status_active : Theme::getInstance()->fg_light->foreground); + button_fake_brightness.set_foreground((pmem::apply_fake_brightness() & (!pmem::config_lcd_inverted_mode())) ? *Theme::getInstance()->status_active : Theme::getInstance()->fg_light->foreground); set_dirty(); } diff --git a/firmware/common/portapack_io.cpp b/firmware/common/portapack_io.cpp index f53c6ed5..25a725cd 100644 --- a/firmware/common/portapack_io.cpp +++ b/firmware/common/portapack_io.cpp @@ -78,7 +78,7 @@ void IO::reference_oscillator(const bool enable) { } bool IO::get_dark_cover() { - return portapack::persistent_memory::apply_fake_brightness(); + return portapack::persistent_memory::apply_fake_brightness() & (!portapack::persistent_memory::config_lcd_inverted_mode()); } bool IO::get_is_inverted() { diff --git a/firmware/common/portapack_io.hpp b/firmware/common/portapack_io.hpp index 2c614a2f..b25cdb7f 100644 --- a/firmware/common/portapack_io.hpp +++ b/firmware/common/portapack_io.hpp @@ -163,10 +163,7 @@ class IO { void lcd_write_pixel(ui::Color pixel) { if (get_dark_cover()) { - if (!get_is_inverted()) - pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); - else - pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness()); + pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); } lcd_write_data(pixel.v); } @@ -177,10 +174,7 @@ class IO { void lcd_write_pixels(ui::Color pixel, size_t n) { if (get_dark_cover()) { - if (!get_is_inverted()) - pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); - else - pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness()); + pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); } while (n--) { lcd_write_data(pixel.v); @@ -189,10 +183,7 @@ class IO { void lcd_write_pixels_unrolled8(ui::Color pixel, size_t n) { if (get_dark_cover()) { - if (!get_is_inverted()) - pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); - else - pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness()); + pixel.v = DARKENED_PIXEL(pixel.v, get_brightness()); } auto v = pixel.v; n >>= 3; @@ -426,10 +417,7 @@ class IO { uint32_t original_value = (value_high << 8) | value_low; if (get_dark_cover()) { - if (!get_is_inverted()) - original_value = DARKENED_PIXEL(original_value, get_brightness()); - else - original_value = UNDARKENED_PIXEL(original_value, get_brightness()); + original_value = DARKENED_PIXEL(original_value, get_brightness()); } return original_value; } diff --git a/firmware/common/portapack_persistent_memory.cpp b/firmware/common/portapack_persistent_memory.cpp index 52efe710..b4546212 100644 --- a/firmware/common/portapack_persistent_memory.cpp +++ b/firmware/common/portapack_persistent_memory.cpp @@ -1129,7 +1129,7 @@ void set_fake_brightness_level(uint8_t v) { // Cycle through 4 brightness options: disabled -> enabled/50% -> enabled/25% -> enabled/12.5% -> disabled void toggle_fake_brightness_level() { bool fbe = apply_fake_brightness(); - + if (config_lcd_inverted_mode()) return; // for now only inverted mode OR fake brightness if ((!fbe) || (data->fake_brightness_level >= BRIGHTNESS_12p5)) { set_apply_fake_brightness(!fbe); data->fake_brightness_level = BRIGHTNESS_50;