Use actual time in plots
This commit is contained in:
parent
1045e85cfb
commit
cc6618e650
25
src/main.cpp
25
src/main.cpp
|
@ -25,7 +25,7 @@ static bool wiFiConnectedToStation;
|
|||
|
||||
static WiFiUDP ntpUDP;
|
||||
|
||||
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000);
|
||||
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 0, 60000);
|
||||
|
||||
#define REF_ALTITUDE 320 // meters
|
||||
#define REF_CO2_PPM 425 // clean air according to DWD at 2024-06-17
|
||||
|
@ -89,9 +89,9 @@ void wifi_setup(void)
|
|||
|
||||
void initSCD30(void)
|
||||
{
|
||||
timeseries_init(&ts_scd30_co2, 0, 15, "ppm", "%.1f");
|
||||
timeseries_init(&ts_scd30_temperature, 0, 15, "°C", "%.1f");
|
||||
timeseries_init(&ts_scd30_humidity, 0, 15, "%", "%.1f");
|
||||
timeseries_init(&ts_scd30_co2, timeClient.getEpochTime(), 15, "ppm", "%.1f");
|
||||
timeseries_init(&ts_scd30_temperature, timeClient.getEpochTime(), 15, "°C", "%.1f");
|
||||
timeseries_init(&ts_scd30_humidity, timeClient.getEpochTime(), 15, "%", "%.1f");
|
||||
|
||||
// Try to initialize!
|
||||
if (!scd30.begin()) {
|
||||
|
@ -280,8 +280,6 @@ static void draw_epaper_callback(GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_H
|
|||
y = 150 + FreeSans12pt7b.yAdvance*3/4;
|
||||
display->setCursor(0, y);
|
||||
|
||||
display->setCursor(0, y);
|
||||
|
||||
display->setFont(&FreeSans12pt7b);
|
||||
display->print("Feuchte: ");
|
||||
|
||||
|
@ -295,6 +293,21 @@ static void draw_epaper_callback(GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_H
|
|||
display->print(" %rH");
|
||||
|
||||
epaper_plot(150, 155, 150, 65, &ts_scd30_humidity, 900);
|
||||
|
||||
y = 225 + FreeSans12pt7b.yAdvance*3/4;
|
||||
display->setCursor(0, y);
|
||||
|
||||
display->setFont(&FreeSans12pt7b);
|
||||
display->print("Aktualisiert: ");
|
||||
|
||||
y += FreeSans12pt7b.yAdvance;
|
||||
display->setCursor(0, y);
|
||||
|
||||
display->setFont(&FreeSansBold12pt7b);
|
||||
display->print(timeClient.getFormattedTime());
|
||||
|
||||
display->setFont(&FreeSans12pt7b);
|
||||
display->print(" UTC");
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
|
|
Loading…
Reference in a new issue