Aller au contenu

ADR-0079: The « Voitures » popup, « Aperçu » page

Page en anglais

Cette page n'existe qu'en anglais.

Status: Accepted (2026-11-09). Date: 2026-11-09

Context

ADR-0076 draws the electric cars as two circles on the Flux page of the Energy popup, ADR-0077 lists their last charges on a fifth page. Neither shows a car as a car: its name, its battery, its range and its state take the room of a circle of 200 px. Lot 6 of the author's plan for the cars (sketch C1, « Aperçu ») is a popup of their own, one large card per car. The plan then adds three pages to it (Charge, Trajets, État, lots 7 to 9): this lot builds the popup and its first page only.

Decision

  • A popup of its own, in new files. Tab5/ecran/tab5_voitures.{h,cpp} (VoituresUI, voitures_recu(), voitures_ouvrir(), voitures_rejouer_theme()), ui_components/voitures_popup.yaml and voitures_carte.yaml (×2), paquets/tab5-voitures.yaml (the two scripts that bind the widgets and open it). Shared chrome (ADR-0009: modal_scrim.yaml + modal_header.yaml, title « Voitures » with the car-electric glyph), one ModalRegistry::add(…, "Cars", …) line and the matching « Cars » option of « Go to screen » (ADR-0013, checked by tools/check_tab5_registry.py), opened only through tab5_ecran_ouvrir (Ecran::VOITURES, between SERVEUR_IA and ARCADE: the index of an option is its enum value). No new service: the popup reads tab5_maj_voiture (contract 1.5.0, unchanged). One page, so no tabs (ADR-0046 wants two at least); the PagesPopup wiring is described in the file headers, not switched on.
  • One card per car received, two at most. Two cars: two cards of the same shape side by side; one car: one card, full width (its content keeps the column of a half card, centred); no car: the popup still opens and says so — « Aucune voiture reçue » and under it where to choose them (« Choisissez-les dans le blueprint, section « Énergie : voitures ». »). Refusing to open would leave « Go to screen → Cars » silent; a message answers. At every opening the tablet asks Home Assistant for a push (the same event as the Energy popup, tab5_energie_demande, whose script restarts instead of piling up): Home Assistant pushes only while the screen is « Energy » or « Cars », so what the tablet kept after a long absence would be stale. The cars appear or refresh as soon as it answers.
  • What a card shows — exactly the fields of Voiture (ADR-0076): the name; a silhouette (decision D5 of the plan: the car-side glyph of a dedicated 240 px MDI font, 1 bit, one glyph — no image in flash — tinted by the state: green charging, blue plugged, dim otherwise); the battery in a ring with its percentage; the range with its unit; a one-line state (icon + « En charge · 7.20 kW », « Branchée », « Débranchée », « Hors ligne ») and under it the detail (« +12.4 kWh ajoutés », « Prête dans 1 h 20 » while charging, « Pas en charge » when plugged) and the limit (« Limite 80 % »). Every text is 22 px or more.
  • Nothing is invented. The plan's sketch draws a lock, a sentinel, a cable and an « Aujourd'hui » band: no field carries them yet, so none is drawn. They come with their data (lot 7 for the car's own state, lot 4 for the day). A car with state 0 (asleep, unavailable, no state) shows its last known values marked « Hors ligne » (decision D6: the tablet never wakes a car, Home Assistant only reads states).
  • Opening from the Flux page (D4). A short tap on a car circle (energie_flux_noeud.yaml, nodes 4 and 5 — the cars; the four others do not react, as before) opens the popup. ui_appui_glisse() keeps the end of a page swipe out of it, and the long press is not a short click, so the swipe of the pages (ADR-0046) and the long press stay as they were. tab5_energie.cpp is untouched (lot 4 works there): the gesture is a line of YAML. Like any « Go to screen », the opening closes what is open (ModalRegistry::close_all() in tab5_ecran_ouvrir): the Energy popup is closed, and closing the cars goes back to the home screen, not to the Flux page (a way back is left open, see the consequences). On the 7B the Flux page draws no car (ADR-0076: its page is too short), so there is no circle to tap: the popup is reached by « Go to screen → Cars » (an automation, a dashboard button) and is laid out for its smaller body by hauteur_carte(), like the other popups.
  • Home Assistant keeps pushing. The package tab5_energie.yaml loops while the tablet's « Écran courant » is « Energy »; it now also loops while it is « Cars », otherwise the cars would freeze as soon as the Energy popup is covered. The popup lives on the same pushes as the Flux page (instant, every 5 s at most).
  • Two copies of the cars, for now. tab5_voitures.cpp keeps its own Voit array filled by voitures_recu() (called from tab5_maj_voiture after energie_voiture(), both read by voiture_lire()), because moving Voiture to a shared header means editing tab5_energie.cpp, where lot 4 is working. Follow-up once that file is free: one Voiture store in a header, two readers (ADR-0076 already says so).
  • Texts go through tr() in the seven languages (« Voitures », « d'autonomie », « Aucune voiture reçue » and the advice; the others already existed for the Flux page); the glyphs are in the fonts of their labels and in MDI_CODE_TARGETS (glyphe_etat, rule 9). Colours are palette roles only and are replayed on a theme change (voitures_rejouer_theme()).
  • No gesture code and no navigation-wheel entry yet. A gesture code goes at the end of kCodesGestes (kept by index in the NVS) and the wheel entry needs a « cars known » test like the AI server's: both are small, neither is asked in this lot; the popup is reachable from the Flux page and from « Go to screen ».

Consequences

  • No car chosen in the blueprint: Home Assistant pushes nothing, the Flux page has no car circle, nothing opens the popup but « Go to screen → Cars » (the message). Every existing screen is the one of before: the off-device render of this change was compared with main (rendu-captures-fr, job comparer), only the three new screens are added.
  • Cost (both boards compiled with this change; "before" is the build of #617 as reported then, not rebuilt here): Tab5 RAM 270 482 → 271 250 bytes (+768), flash 5 242 442 → 5 262 090 bytes (+19 648, +0.4 %), firmware.ota.bin unchanged at 5 312 512 bytes; Waveshare 7B RAM 268 554 → 269 306 bytes (+752), flash 4 556 596 → 4 574 388 bytes (+17 792). The 240 px font is one glyph of 221 × 120 px at 1 bit: about 3.4 KB of that flash (computed from the font file; the ELF names no symbol for it). The rest is the popup's code and widgets, its four texts in seven languages and two small glyphs (sleep in mdi_font_45, car-electric in mdi_font_32). Heap and PSRAM at run time are not measured: that needs the tablet, and nothing was flashed.
  • About 35 LVGL objects (two cards of eleven widgets, the chrome, two message labels) are created when the popup is first built, plus four arcs (two rings) at its first opening. Nothing is painted while the popup is closed: a push only copies the car.
  • Not judged on the real screen: the weight of the silhouette (240 px) in a half card on the Tab5, and in the 7B's smaller body; the off-device render shows both, the author's eye on the tablet decides. The silhouette is one car for every make: a make-specific silhouette needs an image per model, which D5 refuses.
  • Open — the way back. The cars popup closes to the home screen. If the author wants the × to return to the Flux page, the opening has to remember the page it came from (a small global and a call in the close button); not done, to keep the lot to what was asked.
  • With the battery and two cars the Flux page draws one « 2 voitures » circle: a tap on it opens the popup, which shows both cars.