Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
projets:esp32-cam_timelaps_code [2020/06/03 13:51] – gepeto | projets:esp32-cam_timelaps_code [2020/06/06 17:42] – gepeto | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | < | ||
/* | /* | ||
ESP32-CAM l'oeil clignotemps | ESP32-CAM l'oeil clignotemps | ||
Ligne 729: | Ligne 730: | ||
Serial.println(WiFi.SSID()); | Serial.println(WiFi.SSID()); | ||
Serial.println(internet_connected); | Serial.println(internet_connected); | ||
- | char pool[] = "fr.pool.ntp.org"; | + | char pool[16] = ""; |
- | if ( internet_connected == 2) sprintf(pool, | + | if ( internet_connected == 2) { |
+ | | ||
+ | } else { | ||
+ | sprintf(pool, | ||
+ | } | ||
+ | Serial.print(F(" | ||
+ | Serial.print(pool); | ||
configTime(0, | configTime(0, | ||
setenv(" | setenv(" | ||
Ligne 741: | Ligne 748: | ||
time(& | time(& | ||
localtime_r(& | localtime_r(& | ||
- | | + | |
- | while (timeinfo.tm_year < (2016 - 1900) && ++retry < retry_count) { | + | while (!time(nullptr) && ++retry < retry_count) { |
- | Serial.printf(" | + | Serial.printf(" |
delay(1000); | delay(1000); | ||
time(& | time(& | ||
Ligne 751: | Ligne 758: | ||
sprintf(localip, | sprintf(localip, | ||
} | } | ||
+ | ntp_ok = true; // on force | ||
+ | |||
} | } | ||
if (internet_connected >= 2) { | if (internet_connected >= 2) { | ||
- | Serial.print(F(" | + | Serial.print(F(" |
WiFi.disconnect(); | WiFi.disconnect(); | ||
delay(500); | delay(500); | ||
Ligne 1954: | Ligne 1963: | ||
Serial.println(F(" | Serial.println(F(" | ||
} | } | ||
+ | |||
+ | </ |