Browse Source

ntp time

main
Hendrik Langer 5 years ago
parent
commit
b04d242f20
  1. 11
      src/main.cpp
  2. 2
      src/network/XD0OTA.cpp

11
src/main.cpp

@ -201,6 +201,13 @@ void wifiConnect() {
}
}
bool obtain_time() {
ESP_LOGI(TAG, "syncing time");
configTzTime("CET-1CEST,M3.5.0/2,M10.5.0/3", "de.pool.ntp.org");
struct tm timeinfo;
return getLocalTime(&timeinfo, 5000);
}
void helloWorld()
{
const char HelloWorld[] = "IchbinsBens!";
@ -747,6 +754,7 @@ void setup()
// wakeup not caused by deep sleep
display.clearScreen();
display.refresh();
lastDisplayRefresh = getTimestamp();
helloWorld();
display.powerOff();
} else {
@ -760,10 +768,11 @@ void setup()
wifiConnect();
WiFi.waitForConnectResult();
//displayIcoPartial(ico_wifi16, display.width()-20, y_offset+0, ico_wifi16_width, ico_wifi16_height);
displayIcoPartial(ico_wifi16, display.width()-20, y_offset+0, ico_wifi16_width, ico_wifi16_height);
if (wakeup_reason == ESP_SLEEP_WAKEUP_UNDEFINED || bootCount == 1) {
// wakeup not caused by deep sleep
obtain_time();
ESP_LOGD(TAG, "trying to fetch over-the-air update");
if (WiFi.status() == WL_CONNECTED) {
ota.update();

2
src/network/XD0OTA.cpp

@ -57,7 +57,7 @@ String XD0OTA::getUpdateURL(String file, String extension) {
}
void XD0OTA::update(void) {
setClock();
//setClock();
// try device specific image first
String fwURL = getUpdateURL(getMAC(), ".bin");

Loading…
Cancel
Save