feat: Zambretti forecast with trend classification

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 19:59:17 +07:00
co-authored by Claude Opus 4.8
parent 2d52fcd851
commit 5819739fcb
3 changed files with 127 additions and 0 deletions
+12
View File
@@ -4,6 +4,7 @@
#include "display_ui.h"
#include "sensors.h"
#include "rtc_time.h"
#include "forecast.h"
static void i2cScan() {
Serial.println(F("I2C scan:"));
@@ -34,6 +35,17 @@ void setup() {
Serial.println(F("RTC lost power -> setting to build time"));
rtcSet(RtcTime{2026, 7, 17, 12, 0, 0}); // temporary; NTP will correct later
}
// --- forecast self-test (remove after Task 8) ---
struct { float p; Trend tr; } cases[] = {
{1030, TREND_STEADY}, {1030, TREND_RISING}, {1030, TREND_FALLING},
{1000, TREND_STEADY}, {1000, TREND_FALLING}, {970, TREND_FALLING},
};
for (auto& c : cases) {
Forecast f = computeForecast(c.p, c.tr, 7);
Serial.printf("p=%.0f trend=%d -> %c [%s] (%s)\n",
c.p, c.tr, f.letter, f.text, categoryShort(f.category));
}
}
void loop() {