Keep a slider's value when you let go, and stop needless full resends (0.2.55)
A light's colour slider on Studio 1 sometimes sent red on release. Measured live: an automation with a state trigger on a six-lamp group (no `to:`) set "Standby after" to its current value after every colour change. The screen reported the setting, ESP Screen Manager saved the layout and resent layout, header and every tile state, and the screen drew its whole page again, reading no touch input meanwhile. The GT911's stray (0, 0) contact then became the finger's last position, and LVGL 9.5 set the slider from it on release. Both red commits left 75-85 ms after such a resync. The app no longer saves or resends a setting event whose value the layout already has. The four setting numbers return before the preference write and the event when nothing changed. A layout message that changes nothing on the screen no longer runs layout_changed() and refresh_all(); the tile states after it redraw their own tiles. The Guition wraps the LVGL touch read callback with cyd::GhostTouch, which repeats the previous read for a pressed (0, 0), and the edge swipe skips that sample too. Both slider handlers log a jump to an end on release. Checked with 214 Python and 14 C++ tests, generate_packages --check, and ESP32 builds of both Easy profiles. Firmware 0.2.47. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -18,7 +18,7 @@
|
||||
############################################################
|
||||
|
||||
substitutions:
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.46"
|
||||
SCREEN_FIRMWARE_VERSION: "0.2.47"
|
||||
# A tap survives a finger that drifts up to this far (320 px over 58 mm: 1 cm); further is a swipe.
|
||||
TOUCH_MOVE_LIMIT_PX: "56"
|
||||
# Shortest contact that counts as a tap; a resistive panel bounces, a capacitive one does not.
|
||||
@@ -4537,9 +4537,13 @@ number:
|
||||
set_action:
|
||||
- lambda: |-
|
||||
auto &s = screen_settings::current;
|
||||
const auto before = s;
|
||||
s.brightness = (int)x;
|
||||
s.standby_brightness = std::min(s.standby_brightness,s.brightness);
|
||||
s.night_brightness = std::min(s.night_brightness,s.brightness);
|
||||
// The value the screen already has (an automation that sets it on every light change):
|
||||
// no flash write, no event, so ESP Screen Manager does not resend the whole screen.
|
||||
if (s == before) return;
|
||||
if (runtime_tiles::enabled) runtime_tiles::settings_preference.save(&s);
|
||||
runtime_tiles::setting_event("brightness",s.brightness);
|
||||
id(apply_screen_settings).execute();
|
||||
@@ -4556,9 +4560,11 @@ number:
|
||||
set_action:
|
||||
- lambda: |-
|
||||
auto &s = screen_settings::current;
|
||||
const auto before = s;
|
||||
s.standby_brightness = (int)x;
|
||||
s.standby_brightness = std::min(s.standby_brightness,s.brightness);
|
||||
s.night_brightness = std::min(s.night_brightness,s.brightness);
|
||||
if (s == before) return;
|
||||
if (runtime_tiles::enabled) runtime_tiles::settings_preference.save(&s);
|
||||
runtime_tiles::setting_event("standby_brightness",s.standby_brightness);
|
||||
id(apply_screen_settings).execute();
|
||||
@@ -4575,9 +4581,11 @@ number:
|
||||
set_action:
|
||||
- lambda: |-
|
||||
auto &s = screen_settings::current;
|
||||
const auto before = s;
|
||||
s.night_brightness = (int)x;
|
||||
s.standby_brightness = std::min(s.standby_brightness,s.brightness);
|
||||
s.night_brightness = std::min(s.night_brightness,s.brightness);
|
||||
if (s == before) return;
|
||||
if (runtime_tiles::enabled) runtime_tiles::settings_preference.save(&s);
|
||||
runtime_tiles::setting_event("night_brightness",s.night_brightness);
|
||||
id(apply_screen_settings).execute();
|
||||
@@ -4594,9 +4602,11 @@ number:
|
||||
set_action:
|
||||
- lambda: |-
|
||||
auto &s = screen_settings::current;
|
||||
const auto before = s;
|
||||
s.standby_seconds = (int)x;
|
||||
s.standby_brightness = std::min(s.standby_brightness,s.brightness);
|
||||
s.night_brightness = std::min(s.night_brightness,s.brightness);
|
||||
if (s == before) return;
|
||||
if (runtime_tiles::enabled) runtime_tiles::settings_preference.save(&s);
|
||||
runtime_tiles::setting_event("standby_seconds",s.standby_seconds);
|
||||
id(apply_screen_settings).execute();
|
||||
|
||||
Reference in New Issue
Block a user