Work through the remaining review items in TODO.md

Keep the HTTP session alive between weather polls (TODO #1). Re-creating the
client each time forced a fresh TLS handshake inside the window where the UI
is frozen. Measured on hardware: the fetch went from ~1.3s to ~80ms, so the
pause is no longer long enough to matter once thermostat controls exist. The
timeout drops from 30s to 10s once a session is warm, since only a cold
handshake needs the longer budget. Any transport error or non-200 tears the
session down so a half-open connection cannot poison every later poll.

The response buffer is now reset per request rather than on
HTTP_EVENT_ON_CONNECTED -- a kept-alive connection does not re-fire that
event, so the buffer would have accumulated across polls.

Indicate stale readings (TODO #2). After two consecutive failures the
temperature dims and the status line shows the age. Age comes from tick
counts, not weather_data_t.last_update: there is no SNTP client here, so
time(NULL) starts at the epoch and any age derived from it is meaningless.

Gate the touch readout behind UI_DEBUG_TOUCH, default off (TODO #3). Kept the
note about LVGL not bubbling events to parents -- it documents a real trap.

Delete main/utils (TODO #4); it had no callers outside itself. Also refreshed
project_structure.txt, which was additionally missing i2c_bus and backlight.

Lay out two 4MB OTA slots (TODO #5) while no devices are fielded, and document
in the README that an OTA download cannot run while the panel is scanning --
the flash write faults the bounce-buffer ISR.

Log the truncation warning once per response instead of once per chunk, and
record the weather task's stack high-water mark (TODO #6): ~2400 bytes spare
of 6144.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
mattandClaude committed 2026-08-04 09:08:51 -07:00
1 parent 5bbb50c4eb
commit d4b2ab7f99
10 files changed
+222 -101

No files matched your search

+10 -7
View File
@@ -2,6 +2,7 @@ CMakeLists.txt (project root -- required by ESP-IDF)
sdkconfig.defaults
partitions.csv
README.md
TODO.md
main/
├── CMakeLists.txt (the only component registration in the project)
├── idf_component.yml
@@ -12,6 +13,11 @@ main/
│ ├── wifi_manager.h
│ └── wifi_manager.c
├── drivers/
│ ├── i2c_bus.h (shared bus: STC8H1K28 + GT911)
│ ├── i2c_bus.c
│ ├── backlight/
│ │ ├── backlight.h (STC8H1K28 -- also gates GT911 reset)
│ │ └── backlight.c
│ ├── display/
│ │ ├── display_rgb.h
│ │ └── display_rgb.c
@@ -19,16 +25,13 @@ main/
│ ├── touch_gt911.h
│ └── touch_gt911.c
├── ui/
│ ├── lvgl_port.h (tick, service task, locking)
│ ├── lvgl_port.h (tick, service task, locking, pause/resume)
│ ├── lvgl_port.c
│ ├── ui_manager.h
│ └── ui_manager.c
├── api/
│ ├── ambient_weather.h
│ └── ambient_weather.c
└── utils/
├── utils.h
└── utils.c
└── api/
├── ambient_weather.h
└── ambient_weather.c
Note: main/ subdirectories are plain source folders, not ESP-IDF components.
IDF only auto-discovers components under a top-level components/ directory,