feat(display): add air quality pages, history and display settings

This commit is contained in:
root
2026-11-11 22:24:29 +00:00
parent 62e9d249cb
commit dde4736cc2
24 changed files with 3634 additions and 481 deletions
@@ -3,6 +3,6 @@ idf_component_register(
"src/sys_status.c"
INCLUDE_DIRS
"include"
REQUIRES
REQUIRES esp_timer
)
@@ -1,6 +1,7 @@
// File: firmware/components/sys_status/include/sys_status.h
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
@@ -25,6 +26,10 @@ static inline bool sys_status_get_wifi_ok(void) { return (xEventGroupGetBits(s
static inline bool sys_status_get_influx_ok(void) { return (xEventGroupGetBits(sys_status_group()) & SYS_STATUS_INFLUX_OK) != 0; }
static inline bool sys_status_get_mdns_ok(void) { return (xEventGroupGetBits(sys_status_group()) & SYS_STATUS_MDNS_OK) != 0; }
/* Monotonic timestamp of a confirmed HTTP 204, never merely a WLAN connection. */
void sys_status_record_influx_success(void);
uint64_t sys_status_last_influx_success_ms(void);
#ifdef __cplusplus
}
#endif
@@ -21,3 +21,22 @@ EventGroupHandle_t sys_status_group(void)
if (!s_status_group) sys_status_init();
return s_status_group;
}
#include "esp_timer.h"
#include "freertos/portmacro.h"
static portMUX_TYPE influx_time_mux = portMUX_INITIALIZER_UNLOCKED;
static uint64_t last_influx_success;
void sys_status_record_influx_success(void)
{
uint64_t now = (uint64_t)(esp_timer_get_time() / 1000);
portENTER_CRITICAL(&influx_time_mux);
last_influx_success = now;
portEXIT_CRITICAL(&influx_time_mux);
}
uint64_t sys_status_last_influx_success_ms(void)
{
portENTER_CRITICAL(&influx_time_mux);
uint64_t result = last_influx_success;
portEXIT_CRITICAL(&influx_time_mux);
return result;
}