From 42824e4aec331382c21b0cae67f49e5556448d89 Mon Sep 17 00:00:00 2001 From: jLynx Date: Wed, 7 Feb 2024 20:40:56 +1300 Subject: [PATCH] WIP screem backlight brightness --- firmware/application/event_m0.cpp | 3 ++- firmware/application/portapack.cpp | 10 +++++++--- firmware/common/backlight.cpp | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index 3225ce47..74f01e0e 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -329,7 +329,8 @@ void EventDispatcher::handle_lcd_frame_sync() { static_cast(top_widget)->paint_overlay(); painter.paint_widget_tree(top_widget); - portapack::backlight()->on(); + // portapack::backlight()->on(); + portapack::backlight()->set_level(28); if (waiting_for_frame) this->waiting_for_frame = false; diff --git a/firmware/application/portapack.cpp b/firmware/application/portapack.cpp index 7bf32d17..3ae6342c 100644 --- a/firmware/application/portapack.cpp +++ b/firmware/application/portapack.cpp @@ -280,10 +280,14 @@ static const portapack::cpld::Config& portapack_cpld_config() { : portapack::cpld::rev_20150901::config; } +// Backlight* backlight() { +// return (portapack_model() == PortaPackModel::R2_20170522) +// ? static_cast(&backlight_cat4004) // R2_20170522 +// : static_cast(&backlight_on_off); // R1_20150901 +// } + Backlight* backlight() { - return (portapack_model() == PortaPackModel::R2_20170522) - ? static_cast(&backlight_cat4004) // R2_20170522 - : static_cast(&backlight_on_off); // R1_20150901 + return static_cast(&backlight_cat4004); // R1_20150901 } #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) diff --git a/firmware/common/backlight.cpp b/firmware/common/backlight.cpp index 5fdf8fb2..b9cf77dc 100644 --- a/firmware/common/backlight.cpp +++ b/firmware/common/backlight.cpp @@ -29,6 +29,7 @@ void BacklightOnOff::on() { if (!is_on()) { io.lcd_backlight(true); on_ = true; + } } @@ -40,6 +41,7 @@ void BacklightOnOff::off() { } void BacklightCAT4004::set_level(const value_t value) { + on_ = true; auto target = value; // Clip target value to valid range.