24 lines
797 B
C
24 lines
797 B
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#define UI_HISTORY_POINTS 180
|
|
#define UI_HISTORY_BUCKET_MS 10000
|
|
#define UI_SENSOR_STALE_MS 5000
|
|
|
|
typedef enum {
|
|
UI_METRIC_CO2, UI_METRIC_PM25, UI_METRIC_TEMP, UI_METRIC_RH,
|
|
UI_METRIC_VOC, UI_METRIC_NOX, UI_METRIC_COUNT
|
|
} ui_metric_t;
|
|
typedef struct {
|
|
uint64_t timestamp_ms;
|
|
float values[UI_METRIC_COUNT]; /* ppm, ug/m3, degC, %, VOC index, NOx index */
|
|
bool available;
|
|
} ui_sample_t;
|
|
|
|
/* Producer submits scaled numbers, with NAN for unavailable channels. No LVGL calls. */
|
|
void ui_model_publish(const ui_sample_t *sample);
|
|
void ui_model_snapshot(ui_sample_t *sample);
|
|
/* 180 fixed ten-second bins, oldest first; empty bins are NAN. RAM only. */
|
|
void ui_model_history(ui_metric_t metric, uint64_t now_ms, float *values);
|