only inv or fakebrightness (#2240)

This commit is contained in:
Totoo 2024-09-08 09:35:09 +02:00 committed by GitHub
parent 31c844b48e
commit 1f78646054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 19 deletions

View File

@ -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();

View File

@ -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();
}

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;