feat: forecast change log
Record each forecast change (Zambretti letter transition) with a timestamp into a 24-entry ring buffer, persisted to LittleFS and restored on boot. New /api/forecasts endpoint and a 'Forecast log' panel in the web UI (newest first, category colour, timestamp). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "display_ui.h"
|
||||
#include "forecast.h"
|
||||
#include "history.h"
|
||||
#include "flog.h"
|
||||
#include "app_settings.h"
|
||||
#include "net.h"
|
||||
#include "web_server.h"
|
||||
@@ -28,6 +29,7 @@ static void sampleNow() {
|
||||
if (g_state.haveTrend) {
|
||||
g_state.trend = classifyTrend(d);
|
||||
g_state.forecast = computeForecast(g_state.mslHpa, g_state.trend, g_state.now.month);
|
||||
flogConsider(rtcEpoch(), g_state.forecast); // log only when the forecast changes
|
||||
} else {
|
||||
g_state.trend = TREND_STEADY;
|
||||
}
|
||||
@@ -52,6 +54,9 @@ void setup() {
|
||||
historyBegin();
|
||||
historyLoad(); // restore prior samples (empty on first ever boot)
|
||||
Serial.printf("history restored: %d samples\n", historyCount());
|
||||
flogBegin();
|
||||
flogLoad(); // restore forecast change log
|
||||
Serial.printf("forecast log restored: %d entries\n", flogCount());
|
||||
|
||||
displaySplash("WiFi", "Connect / portal");
|
||||
if (netBegin()) {
|
||||
|
||||
Reference in New Issue
Block a user