now with automatic dst ajust

master
JbLb 5 years ago
parent 0336126dcb
commit ec50088db0

@ -4,6 +4,7 @@
//################# LIBRARIES ##########################
#include <ESP8266WiFi.h>
#include <Timezone.h> // https://github.com/JChristensen/Timezone
#include <ESP8266WebServer.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#include <DNSServer.h>
@ -25,14 +26,14 @@
// CLK -> D5 (Same Pin for WEMOS)
//################ PROGRAM SETTINGS ####################
String version = "0.1b";
String version = "0.2b";
int PORT = 80;
int wait = 50;
int spacer = 1;
int width = 5 + spacer;
String SITE_WIDTH = "1000";
int timezone = 1;
int dstOffset = 1;
int timezone = 0;
int dstOffset = 0;
const char* ntpServer = "fr.pool.ntp.org";
int brightness = 2;
int pinCS = D4;
@ -45,6 +46,11 @@ String message, webpage;
ESP8266WebServer server(PORT);
Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);
//################## Time Zone & dst config #############
TimeChangeRule CET = {"CET", Last, Sun, Oct, 2, 60}; //UTC + 1 hour
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120}; //UTC + 2 hours
Timezone CentralEuropean(CET, CEST);
void configModeCallback (WiFiManager *myWiFiManager) { // AP config mode
display_static_message("Setup");
}
@ -88,7 +94,7 @@ void setup() {
DEBUG_PRINTLN(F("WiFi connected..."));
display_static_message("OK");
DEBUG_PRINTLN(WiFi.localIP());
configTime(timezone * 3600, dstOffset * 3600, ntpServer); // First sync of time with (S)NTP
configTime(timezone * 3600, dstOffset * 3600, ntpServer); // First sync of time with (S)NTP UTC time
#ifdef DEBUG_TELNET
// Start the Telnet server
@ -223,4 +229,3 @@ void append_page_footer(){ // Saves repeating many lines of code for HTML page f
webpage += F("<ul><li><a href='/'>Recharger la page</a></li></ul>");
webpage += F("</body></html>");
}

Loading…
Cancel
Save