From fd03bb800c6b25a51112f0c57f44da13578c2bc6 Mon Sep 17 00:00:00 2001 From: "E.T" Date: Thu, 8 Feb 2024 18:28:49 +0100 Subject: [PATCH] Brightness settings fixes 2.0 (#1870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Format * Fix startup crash 🙈 * Revert "Revert "Brightness settings fixes" (#1865)" Had to rebase then revert the revert to make git recognise and merge the change :) This reverts commit b7e5bedf4ba9ceee104330779210c35dbd46dfd9. # Conflicts: # firmware/application/ui_navigation.cpp * Add zxkmm to header too --- firmware/application/apps/ui_settings.cpp | 6 ++---- firmware/application/ui_navigation.cpp | 22 ++++++++-------------- firmware/application/ui_navigation.hpp | 2 ++ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index 7d8dfc53..d0668342 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -763,12 +763,10 @@ SetFakeBrightnessView::SetFakeBrightnessView(NavigationView& nav) { field_fake_brightness.set_by_value(pmem::fake_brightness_level()); checkbox_brightness_switch.set_value(pmem::apply_fake_brightness()); - checkbox_brightness_switch.on_select = [this](Checkbox&, bool v) { - pmem::set_apply_fake_brightness(v); - }; - button_save.on_select = [&nav, this](Button&) { + pmem::set_apply_fake_brightness(checkbox_brightness_switch.value()); pmem::set_fake_brightness_level(field_fake_brightness.selected_index_value()); + send_system_refresh(); nav.pop(); }; diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index d517ba10..929a2d02 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -1,6 +1,8 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2016 Furrtek + * Copyright (C) 2024 u-foka + * Copyleft (ɔ) 2024 zxkmm under GPL license * * This file is part of PortaPack. * @@ -330,21 +332,10 @@ SystemStatusView::SystemStatusView( toggle_fake_brightness.on_change = [this, &nav](bool v) { set_dirty(); pmem::set_apply_fake_brightness(v); - if (nav.is_valid() && v) { - nav.display_modal( - "Brightness", - "You have enabled brightness\n" - "adjustment. Performance\n" - "will be impacted slightly."); - - // TODO: refresh interface to prevent reboot requirement - // TODO: increase performance - } else if (!v) { - nav.display_modal( - "Brightness", - "Brightness adjust disabled."); - } refresh(); + if (nullptr != parent()) { + parent()->set_dirty(); // The parent of NavigationView shal be the SystemView + } }; button_bias_tee.on_select = [this](ImageButton&) { @@ -413,6 +404,9 @@ void SystemStatusView::refresh() { button_converter.set_bitmap(pmem::config_updown_converter() ? &bitmap_icon_downconvert : &bitmap_icon_upconvert); button_converter.set_foreground(pmem::config_converter() ? Color::red() : Color::light_grey()); + // Brightness + toggle_fake_brightness.set_value(pmem::apply_fake_brightness()); + set_dirty(); } diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index 66f1d41a..60e485b6 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -1,6 +1,8 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2016 Furrtek + * Copyright (C) 2024 u-foka + * Copyleft (ɔ) 2024 zxkmm under GPL license * * This file is part of PortaPack. *