Two indoor sensors, wind compass, and stop framebuffer cache thrashing
Downstairs and upstairs are now separate readings. The station names them
backwards -- "temperature_4" is downstairs and "inside_temperature" is
upstairs -- so ha_config.h says which is which. Downstairs is the primary:
big number on the card, and it is what the furnace controls on, because it
is where people are and heat rises. Upstairs sits beside it, obviously
subordinate by size, and costs no vertical space in a layout that has none.
The anemometer came back on 2026-08-07, so wind gets its own column: a dial
whose needle points at the direction the wind is coming FROM (weather-vane
convention, matching the cardinal below it), the speed, and a 5-minute trend
arrow.
- The needle does not animate. A spin would look better, but every animated
frame is a redraw, and redrawing is what starves the bounce refill ISR.
- Below 0.5 mph it shows "Calm" and draws no needle. A vane that is not
being pushed reports whatever it last settled on, which on this station
is a steady 0 degrees -- a confident needle pointing due north at zero
wind. The live snapshot caught exactly that.
- The trend is local, not HA's 10-minute average, so the window is ours to
pick: 1-minute buckets over 5 minutes, threshold 1.5 mph.
That last point needed the trend engine to stop assuming one hour. Window,
bucket size, minimum age and threshold are now per-channel in a table, which
also removes the threshold arguments main.c was passing in.
Grid drops to 117px cells to make room, so the sun sub-line is just which
event it is and "RAIN TODAY" is "RAIN" -- both were overrunning.
On the artefacts: bounce mode is NOT a DMA read of the framebuffer. The
refill is a CPU memcpy in an ISR, which is why the driver skips the usual
write-back in draw_bitmap ("the data gets read by the CPU as well"). So the
panel streams 750KB per frame at ~44Hz through the DCache, evicting the
working set of everything else on the chip, continuously -- which is the real
reason this board is so sensitive to WiFi and to any extra rendering.
bb_invalidate_cache frees each chunk after it is copied. The header warns it
"can be dangerous if data is written from other core(s)"; that does not apply
here, because it invalidates the buffer being scanned and by design LVGL only
draws into the other one. Whether it is enough is for the panel to say.
Also gives tools/ha_snapshot.py a --token-file so the token no longer has to
travel through a shell command line to reach it.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
7a58f9838a
commit
ea1b8b8d15
13 files changed
+435
-155
No files matched your search
+12
-8
@@ -71,9 +71,11 @@ typedef enum {
|
||||
} ha_trend_t;
|
||||
|
||||
enum {
|
||||
HA_TREND_CH_INDOOR = 0,
|
||||
HA_TREND_CH_INDOOR_DOWN = 0,
|
||||
HA_TREND_CH_INDOOR_UP,
|
||||
HA_TREND_CH_OUTDOOR,
|
||||
HA_TREND_CH_PRESSURE,
|
||||
HA_TREND_CH_WIND,
|
||||
HA_TREND_CHANNELS,
|
||||
};
|
||||
|
||||
@@ -91,8 +93,11 @@ typedef struct {
|
||||
/* Weather station */
|
||||
ha_value_t outdoor_temp_f;
|
||||
ha_value_t outdoor_humidity;
|
||||
ha_value_t indoor_temp_f;
|
||||
ha_value_t indoor_humidity;
|
||||
/* Downstairs is the primary reading and drives the control loop. */
|
||||
ha_value_t indoor_down_temp_f;
|
||||
ha_value_t indoor_down_humidity;
|
||||
ha_value_t indoor_up_temp_f;
|
||||
ha_value_t indoor_up_humidity;
|
||||
ha_value_t dew_point_f;
|
||||
ha_value_t pressure_inhg;
|
||||
ha_value_t rain_today_in;
|
||||
@@ -121,9 +126,11 @@ typedef struct {
|
||||
* query: an /api/history call returns hundreds of points per entity,
|
||||
* which is silly when the device already sees every reading each poll.
|
||||
*/
|
||||
ha_trend_t trend_indoor;
|
||||
ha_trend_t trend_indoor_down;
|
||||
ha_trend_t trend_indoor_up;
|
||||
ha_trend_t trend_outdoor;
|
||||
ha_trend_t trend_pressure;
|
||||
ha_trend_t trend_wind;
|
||||
} ha_data_t;
|
||||
|
||||
/*
|
||||
@@ -173,10 +180,7 @@ const char *ha_wind_cardinal(float degrees);
|
||||
* compute returns UNKNOWN until the oldest usable sample is at least
|
||||
* HA_TREND_MIN_AGE_MS old -- "trending" over 90 seconds is noise.
|
||||
*/
|
||||
#define HA_TREND_WINDOW_MS (60u * 60u * 1000u)
|
||||
#define HA_TREND_MIN_AGE_MS (5u * 60u * 1000u)
|
||||
|
||||
void ha_trend_feed(int channel, float value, uint32_t now_ms);
|
||||
ha_trend_t ha_trend_compute(int channel, float threshold_per_hour, uint32_t now_ms);
|
||||
ha_trend_t ha_trend_compute(int channel, uint32_t now_ms);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user