mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-09-25 14:13:36 +00:00
Address the three P1 findings from the Greptile review of PR #96: 1. Network LoRa toggle reverted on save. on_interface_switch_changed saved without propagating the Network switch state, so the save path read the stale Radio-page twin and wrote it back over the mirror. The handler now mirrors the flipped switch to its twin (and toggles the LoRa params visibility) before saving, mirroring on_lora_enabled_changed in the other direction. 2. Immediate controls committed unsaved drafts from other sub-views. Every immediate handler ran the full-screen update_settings_from_ui, so typing a TCP host and then adjusting brightness silently persisted the host. update_settings_from_ui is now view-scoped: save_settings reads only the sub-view that just changed (LVGL events only fire for visible widgets, so _view is always the touched view). The lora handle merges as Radio-page switch wins, Network mirror when the Radio page is unbuilt. 3. Hidden controls retained focus. hide() removed only the header buttons and hub cards, and the focus_group_for cleanup list was missing the three Radio dropdowns — so hidden sub-view controls stayed in the default group (and Radio dropdowns lingered after leaving the Radio view). Extracted the full removal list into remove_all_from_focus_group (now including _dropdown_lora_bandwidth/ _sf/_cr) and use it from both focus_group_for and hide. Verification: tdeck build SUCCESS (RAM 23.1%, Flash 92.7%), tests/build_scripts 170/170. All save_settings() call sites confirmed event-driven so _view always matches the touched control. Signed-off-by: Torlando <tyler@torlando.tech>