2024-12-2200 RCT
This commit is contained in:
parent
6491bd17b7
commit
41a8516d10
|
@ -17,6 +17,7 @@ lib_deps =
|
|||
;adafruit/Adafruit BME280 Library @ 2.2.4
|
||||
adafruit/Adafruit BMP280 Library @ 2.6.8
|
||||
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||
adafruit/RTClib @ 2.1.4
|
||||
SD
|
||||
FS
|
||||
SPI
|
||||
|
|
23
src/main.cpp
23
src/main.cpp
|
@ -53,6 +53,9 @@ SPIClass mySpi = SPIClass(VSPI);
|
|||
#include <mcp9808.h>
|
||||
#include <mess_BMP280.h>
|
||||
#include <Preferences.h>
|
||||
#include "RTClib.h"
|
||||
|
||||
RTC_DS3231 rtc;
|
||||
|
||||
Preferences preferences;
|
||||
|
||||
|
@ -283,6 +286,24 @@ void setup() {
|
|||
ESP.restart();
|
||||
}
|
||||
}
|
||||
|
||||
if (!rtc.begin()) {
|
||||
tft.fillScreen(TFT_RED);
|
||||
Serial.println("Couldn't find RTC");
|
||||
tft.setTextColor(TFT_BLACK, TFT_WHITE);
|
||||
tft.drawCentreString(" Couldn't find RTC ", 160, 110, 2);
|
||||
//Serial.flush();
|
||||
while(1);
|
||||
}
|
||||
|
||||
//Serial.println("Setting the time...");
|
||||
// When time needs to be set on a new device, or after a power loss, the
|
||||
// following line sets the RTC to the date & time this sketch was compiled
|
||||
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
|
||||
// This line sets the RTC with an explicit date & time, for example to set
|
||||
// January 21, 2014 at 3am you would call:
|
||||
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
|
||||
|
||||
// Print local IP address and start web server
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
Serial.println("");
|
||||
|
@ -343,6 +364,8 @@ void setup() {
|
|||
ESP.restart();
|
||||
}
|
||||
lastNTPtime = time(&now);
|
||||
getNTPtime(10);
|
||||
//rtc.adjust(DateTime(timeinfo.tm_year, timeinfo.tm_mon, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec));
|
||||
preferences.begin("Interval", false);
|
||||
interval = preferences.getUInt("Interval", SAVE_INTERVAL);;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user