V2.19 230327 Sommerzeit stellt die Uhr jetzt auch vor (nicht zurück); neues SDK
This commit is contained in:
186
ESPNTUhrPx.ino
186
ESPNTUhrPx.ino
@@ -1,4 +1,4 @@
|
|||||||
#define VERSION (char *) "V2.17"
|
#define VERSION (char *) "V2.19"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V2.12 230205 neues SDK 8266; AP+Wifi Client; lokaleip eingebaut
|
V2.12 230205 neues SDK 8266; AP+Wifi Client; lokaleip eingebaut
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
V2.15 230212 Verbesserung AP_STA modus;Wlan auf 1 Connect beschränkt;
|
V2.15 230212 Verbesserung AP_STA modus;Wlan auf 1 Connect beschränkt;
|
||||||
V2.16 230212 MaxConnect auf 2; Beacon auf 250ms
|
V2.16 230212 MaxConnect auf 2; Beacon auf 250ms
|
||||||
V2.17 230227 alle unbekannten Seiten Leiten auf die IP um
|
V2.17 230227 alle unbekannten Seiten Leiten auf die IP um
|
||||||
|
V2.18 230313 Sommerzeitprüfung auch offline eingebaut; Auf doRTCSecond umgebaut;
|
||||||
|
V2.19 230327 Sommerzeit stellt die Uhr jetzt auch vor (nicht zurück); neues SDK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Pins for LED MATRIX
|
// Pins for LED MATRIX
|
||||||
@@ -71,7 +73,8 @@ char ChipID[10] = "ERROR";
|
|||||||
#include <RV-3029-C2.h>
|
#include <RV-3029-C2.h>
|
||||||
RV3029 rtc;
|
RV3029 rtc;
|
||||||
const int PINRTC_CLOCK = 12;
|
const int PINRTC_CLOCK = 12;
|
||||||
boolean rtcEnabled = false;
|
bool rtcEnabled = false;
|
||||||
|
bool doRTCSecond = false;
|
||||||
uint8_t temperature=0;
|
uint8_t temperature=0;
|
||||||
|
|
||||||
#include <TimeLib.h>
|
#include <TimeLib.h>
|
||||||
@@ -87,7 +90,8 @@ char ChipID[10] = "ERROR";
|
|||||||
float brightness = 0.80;
|
float brightness = 0.80;
|
||||||
int8_t lastminutes = -1;
|
int8_t lastminutes = -1;
|
||||||
|
|
||||||
boolean iDL = false;
|
bool iDL = false;
|
||||||
|
bool savediDL = false;
|
||||||
|
|
||||||
uint8_t lastTimeSyncTyp = 0;
|
uint8_t lastTimeSyncTyp = 0;
|
||||||
long lastTimeSyncTime = 0;
|
long lastTimeSyncTime = 0;
|
||||||
@@ -111,35 +115,21 @@ void display_update_enable(bool is_enable){
|
|||||||
display_ticker.detach();
|
display_ticker.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Led mit Helligkeit setzen
|
//Led setzen
|
||||||
void setPixelColor(uint8_t x,uint8_t y, uint8_t red, uint8_t green ,uint8_t blue){
|
void setPixelColor(uint8_t x,uint8_t y, uint8_t red, uint8_t green ,uint8_t blue){
|
||||||
/*red = ceil(red * brightness);
|
|
||||||
green = ceil(green * brightness);
|
|
||||||
blue = ceil(blue * brightness);*/
|
|
||||||
display.drawPixelRGB888(x, y, red, green, blue);
|
display.drawPixelRGB888(x, y, red, green, blue);
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Zeichene eine Linie waagrecht x/y und z als länge
|
//Zeichene eine Linie waagrecht x/y und z als länge
|
||||||
void LineH(uint8_t x, uint8_t y, uint8_t z, uint8_t red, uint8_t green ,uint8_t blue){
|
void LineH(uint8_t x, uint8_t y, uint8_t z, uint8_t red, uint8_t green ,uint8_t blue){
|
||||||
uint16_t color = display.color565(red, green, blue);
|
uint16_t color = display.color565(red, green, blue);
|
||||||
display.drawFastHLine(x,y,z,color);
|
display.drawFastHLine(x,y,z,color);
|
||||||
//display.display(display_draw_time);
|
|
||||||
/*for(uint8_t c = 0; c<z; c++){
|
|
||||||
setPixelColor(x+c,y, red, green, blue);
|
|
||||||
}*/
|
|
||||||
//display.display(display_draw_time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Zeichene eine Linie senkrecht x/y und z als länge
|
//Zeichene eine Linie senkrecht x/y und z als länge
|
||||||
void LineV(uint8_t x, uint8_t y, uint8_t z, uint8_t red, uint8_t green, uint8_t blue){
|
void LineV(uint8_t x, uint8_t y, uint8_t z, uint8_t red, uint8_t green, uint8_t blue){
|
||||||
uint16_t color = display.color565(red, green, blue);
|
uint16_t color = display.color565(red, green, blue);
|
||||||
display.drawFastVLine(x,y,z,color);
|
display.drawFastVLine(x,y,z,color);
|
||||||
//display.display(display_draw_time);
|
|
||||||
/*for(uint8_t c = 0; c<z; c++){
|
|
||||||
setPixelColor(x,y+c, red, green, blue);
|
|
||||||
}*/
|
|
||||||
//display.display(display_draw_time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//eigene Schriften
|
//eigene Schriften
|
||||||
@@ -149,17 +139,9 @@ void LineV(uint8_t x, uint8_t y, uint8_t z, uint8_t red, uint8_t green, uint8_t
|
|||||||
#include <char10x16.h>
|
#include <char10x16.h>
|
||||||
|
|
||||||
void doClearLEDsSeconds(int8_t ycorrection=0){
|
void doClearLEDsSeconds(int8_t ycorrection=0){
|
||||||
|
|
||||||
for(uint8_t x=0;x<5;x++){
|
for(uint8_t x=0;x<5;x++){
|
||||||
display.drawFastHLine(56,26 + x + ycorrection, 7, 0);
|
display.drawFastHLine(56,26 + x + ycorrection, 7, 0);
|
||||||
}
|
}
|
||||||
/*for(uint16_t x=56;x<MATRIX_WIDTH;x++){
|
|
||||||
for(uint16_t y=26;y<MATRIX_HEIGHT;y++){
|
|
||||||
display.drawPixelRGB888(x,y, 0, 0, 0);
|
|
||||||
//
|
|
||||||
}
|
|
||||||
//display.display(display_draw_time);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void doClearLEDsStatus(){
|
void doClearLEDsStatus(){
|
||||||
@@ -170,16 +152,6 @@ void doClearLEDsStatus(){
|
|||||||
|
|
||||||
void doClearLEDs(boolean incFirstLine = false){
|
void doClearLEDs(boolean incFirstLine = false){
|
||||||
display.fillScreen(0);
|
display.fillScreen(0);
|
||||||
/*if(incFirstLine)
|
|
||||||
display.clearDisplay();
|
|
||||||
else{
|
|
||||||
for(uint16_t x=0;x<MATRIX_WIDTH;x++){
|
|
||||||
for(uint16_t y=1;y<MATRIX_HEIGHT;y++){
|
|
||||||
display.drawPixelRGB888(x,y, 0, 0, 0);
|
|
||||||
}
|
|
||||||
//display.display(display_draw_time);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void showOVALZ(void){
|
void showOVALZ(void){
|
||||||
@@ -212,22 +184,6 @@ void showNTOOLS(void){
|
|||||||
spalte += Out5x7Char('e',spalte,zeile,0,0,255)+1;
|
spalte += Out5x7Char('e',spalte,zeile,0,0,255)+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void show3x5(uint8_t x, uint8_t y, char text[] , uint8_t red, uint8_t green, uint8_t blue){
|
|
||||||
uint8_t textlen = strlen(text);
|
|
||||||
for(uint8_t b=0;b<textlen;b++){
|
|
||||||
x += Out3x5Char(text[b],x,y,red,green,blue)+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void show5x7(uint8_t x, uint8_t y, char text[] , uint8_t red, uint8_t green, uint8_t blue){
|
|
||||||
uint8_t textlen = strlen(text);
|
|
||||||
for(uint8_t b=0;b<textlen;b++){
|
|
||||||
x += Out5x7Char(text[b],x,y,red,green,blue)+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t drawTactical(time_t t,uint8_t x = 0, uint8_t y = 0 ){
|
uint8_t drawTactical(time_t t,uint8_t x = 0, uint8_t y = 0 ){
|
||||||
uint8_t r = tacticalTimeColor[0];
|
uint8_t r = tacticalTimeColor[0];
|
||||||
uint8_t g = tacticalTimeColor[1];
|
uint8_t g = tacticalTimeColor[1];
|
||||||
@@ -388,12 +344,6 @@ void showTimeTactical(time_t t){
|
|||||||
|
|
||||||
void showTime(time_t t){
|
void showTime(time_t t){
|
||||||
uint16_t tmp = 0;
|
uint16_t tmp = 0;
|
||||||
uint8_t x = 0;
|
|
||||||
uint8_t y = 0;
|
|
||||||
|
|
||||||
uint8_t r = timeColor[0];
|
|
||||||
uint8_t g = timeColor[1];
|
|
||||||
uint8_t b = timeColor[2];
|
|
||||||
|
|
||||||
tmp = minute(t);
|
tmp = minute(t);
|
||||||
if(lastminutes != tmp){
|
if(lastminutes != tmp){
|
||||||
@@ -494,9 +444,6 @@ uint16_t ACcolor = display.color565(255, 255, 255);
|
|||||||
uint16_t ACcolorBlk = display.color565(0, 0, 0);
|
uint16_t ACcolorBlk = display.color565(0, 0, 0);
|
||||||
|
|
||||||
void drawAnalogSecond(int second){
|
void drawAnalogSecond(int second){
|
||||||
//uint y = ((clock_radius-1)*cos(PI -(2*PI )/60*second))+clock_center_y;
|
|
||||||
//uint x = ((clock_radius-1)*sin(PI -(2*PI )/60*second))+clock_center_x;
|
|
||||||
//display.drawCircle(x, y, 1, 0x0ff000);
|
|
||||||
uint y = ((clock_radius)*cos(PI-(2*PI)/60*second))+clock_center_y;
|
uint y = ((clock_radius)*cos(PI-(2*PI)/60*second))+clock_center_y;
|
||||||
uint x = ((clock_radius)*sin(PI-(2*PI)/60*second))+clock_center_x;
|
uint x = ((clock_radius)*sin(PI-(2*PI)/60*second))+clock_center_x;
|
||||||
display.drawLine(clock_center_x,clock_center_y,x,y,display.color565(255, 0, 0));
|
display.drawLine(clock_center_x,clock_center_y,x,y,display.color565(255, 0, 0));
|
||||||
@@ -512,18 +459,13 @@ void drawAnalogHour(int hour, int minute){
|
|||||||
|
|
||||||
uint y = ((clock_radius-4)*cos(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_y;
|
uint y = ((clock_radius-4)*cos(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_y;
|
||||||
uint x = ((clock_radius-4)*sin(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_x;
|
uint x = ((clock_radius-4)*sin(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_x;
|
||||||
//uint y1 = ((clock_radius-4)*cos(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_y+1;
|
|
||||||
//uint x1 = ((clock_radius-4)*sin(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_x+1;
|
|
||||||
uint y2 = ((clock_radius-4)*cos(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_y-1;
|
uint y2 = ((clock_radius-4)*cos(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_y-1;
|
||||||
uint x2 = ((clock_radius-4)*sin(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_x-1;
|
uint x2 = ((clock_radius-4)*sin(PI-(2*PI)/12*hour-(2*PI)/720*minute))+clock_center_x-1;
|
||||||
display.drawLine(clock_center_x,clock_center_y,x,y,display.color565(88, 255, 0));
|
display.drawLine(clock_center_x,clock_center_y,x,y,display.color565(88, 255, 0));
|
||||||
//display.drawLine(clock_center_x+1,clock_center_y+1,x1,y1,display.color565(88, 255, 0));
|
|
||||||
display.drawLine(clock_center_x-1,clock_center_y-1,x2,y2,display.color565(88, 255, 0));
|
display.drawLine(clock_center_x-1,clock_center_y-1,x2,y2,display.color565(88, 255, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawAnalogFace(void){
|
void drawAnalogFace(void){
|
||||||
// draw the center of the clock
|
|
||||||
//display.drawCircle(clock_center_x, clock_center_y,3, ACcolor);
|
|
||||||
display.fillCircle(clock_center_x, clock_center_y,2, ACcolor);
|
display.fillCircle(clock_center_x, clock_center_y,2, ACcolor);
|
||||||
|
|
||||||
// draw hour pointers around the face of a clock
|
// draw hour pointers around the face of a clock
|
||||||
@@ -641,10 +583,7 @@ void doSetTime(unsigned long t){
|
|||||||
|
|
||||||
void IRAM_ATTR rtc_clock(){ //Interrupt vom RTC
|
void IRAM_ATTR rtc_clock(){ //Interrupt vom RTC
|
||||||
if(digitalRead(PINRTC_CLOCK)){
|
if(digitalRead(PINRTC_CLOCK)){
|
||||||
ti_second = millis() - 1020;
|
doRTCSecond = true;
|
||||||
//display.drawPixelRGB888(4,0,0,255,0);
|
|
||||||
}else{
|
|
||||||
//display.drawPixelRGB888(4,0,0,0,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,6 +600,33 @@ uint8_t isDayLight(uint8_t hour, uint8_t day, uint8_t wday, uint8_t month){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t isDayLightEx(void){
|
||||||
|
long currentUNIXTime = now();
|
||||||
|
byte Month, Day, Hour, WDay;
|
||||||
|
Month = month(currentUNIXTime);
|
||||||
|
Day = day(currentUNIXTime);
|
||||||
|
Hour = hour(currentUNIXTime);
|
||||||
|
WDay = weekday();
|
||||||
|
return isDayLight(Hour,Day,WDay,Month);
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkiDL(void){
|
||||||
|
iDL = isDayLightEx();
|
||||||
|
if(iDL != savediDL){
|
||||||
|
long currentUNIXTime = now();
|
||||||
|
if(iDL){
|
||||||
|
currentUNIXTime += (SECS_PER_HOUR);
|
||||||
|
}else{
|
||||||
|
currentUNIXTime -= (SECS_PER_HOUR);
|
||||||
|
}
|
||||||
|
setTime(currentUNIXTime);
|
||||||
|
doSetTime(currentUNIXTime);
|
||||||
|
savediDL = iDL;
|
||||||
|
EEPROM.put(10, savediDL);
|
||||||
|
EEPROM.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//NTP Update auf ganz lange
|
//NTP Update auf ganz lange
|
||||||
uint32_t sntp_update_delay_MS_rfc_not_less_than_15000 (){
|
uint32_t sntp_update_delay_MS_rfc_not_less_than_15000 (){
|
||||||
return 365 * 24 * 60 * 60 * 1000UL; // 365 Tage
|
return 365 * 24 * 60 * 60 * 1000UL; // 365 Tage
|
||||||
@@ -688,6 +654,8 @@ void setup() {
|
|||||||
if(brightness > 1.0)
|
if(brightness > 1.0)
|
||||||
brightness = 1.0;
|
brightness = 1.0;
|
||||||
|
|
||||||
|
EEPROM.get(10, savediDL);
|
||||||
|
|
||||||
timeColor[0] = EEPROM.read(11);
|
timeColor[0] = EEPROM.read(11);
|
||||||
timeColor[1] = EEPROM.read(12);
|
timeColor[1] = EEPROM.read(12);
|
||||||
timeColor[2] = EEPROM.read(13);
|
timeColor[2] = EEPROM.read(13);
|
||||||
@@ -709,7 +677,6 @@ void setup() {
|
|||||||
EEPROM.get(151,appass);
|
EEPROM.get(151,appass);
|
||||||
|
|
||||||
display.begin(16);
|
display.begin(16);
|
||||||
//display.setBrightness(255);
|
|
||||||
display.setBrightness(ceil(255 * brightness));
|
display.setBrightness(ceil(255 * brightness));
|
||||||
display.setFastUpdate(true);
|
display.setFastUpdate(true);
|
||||||
doClearLEDs(true);
|
doClearLEDs(true);
|
||||||
@@ -719,7 +686,6 @@ void setup() {
|
|||||||
display_update_enable(true);
|
display_update_enable(true);
|
||||||
|
|
||||||
Wire.begin(1,3);
|
Wire.begin(1,3);
|
||||||
//Wire.setClock(400000);
|
|
||||||
//RTC
|
//RTC
|
||||||
if (rtc.begin() == false) {
|
if (rtc.begin() == false) {
|
||||||
display.drawPixelRGB888(0,0,255,0,0);
|
display.drawPixelRGB888(0,0,255,0,0);
|
||||||
@@ -731,15 +697,7 @@ void setup() {
|
|||||||
rtcEnabled = true;
|
rtcEnabled = true;
|
||||||
pinMode(PINRTC_CLOCK, INPUT_PULLUP);
|
pinMode(PINRTC_CLOCK, INPUT_PULLUP);
|
||||||
setTime(rtc.getUNIX());
|
setTime(rtc.getUNIX());
|
||||||
long currentUNIXTime = now();
|
checkiDL();
|
||||||
byte Month, Day, Hour, Minute, Second, WDay;
|
|
||||||
Month = month(currentUNIXTime);
|
|
||||||
Day = day(currentUNIXTime);
|
|
||||||
Hour = hour(currentUNIXTime);
|
|
||||||
Minute = minute(currentUNIXTime);
|
|
||||||
Second = second(currentUNIXTime);
|
|
||||||
WDay = weekday();
|
|
||||||
iDL = isDayLight(Hour,Day,WDay,Month);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char NetName[30];
|
char NetName[30];
|
||||||
@@ -749,9 +707,7 @@ void setup() {
|
|||||||
strcpy(APName, "NTUhr VPx ");
|
strcpy(APName, "NTUhr VPx ");
|
||||||
strcat(APName, ChipID);
|
strcat(APName, ChipID);
|
||||||
|
|
||||||
|
|
||||||
WiFi.persistent(false);
|
WiFi.persistent(false);
|
||||||
WiFi.mode(WIFI_AP_STA);
|
|
||||||
WiFi.begin(ssid,pass);
|
WiFi.begin(ssid,pass);
|
||||||
WiFi.hostname(NetName);
|
WiFi.hostname(NetName);
|
||||||
int xc = 0;
|
int xc = 0;
|
||||||
@@ -791,21 +747,25 @@ void setup() {
|
|||||||
}
|
}
|
||||||
if(timenow > SECS_YR_2000){
|
if(timenow > SECS_YR_2000){
|
||||||
timenow += 1;
|
timenow += 1;
|
||||||
int Year;
|
uint8_t Month, Day, Hour;
|
||||||
byte Month, Day, Hour;
|
|
||||||
setTime(timenow);
|
setTime(timenow);
|
||||||
Year = year(timenow);
|
Month = month(timenow);
|
||||||
Day = day(timenow);
|
Day = day(timenow);
|
||||||
Hour = hour(timenow);
|
Hour = hour(timenow);
|
||||||
if(isDayLight(Hour,Day,weekday(),Month))
|
iDL = isDayLight(Hour,Day,weekday(),Month);
|
||||||
|
if(iDL)
|
||||||
timenow += (SECS_PER_HOUR * 2);
|
timenow += (SECS_PER_HOUR * 2);
|
||||||
else
|
else
|
||||||
timenow += (SECS_PER_HOUR);
|
timenow += (SECS_PER_HOUR);
|
||||||
|
setTime(timenow);
|
||||||
if(rtcEnabled){
|
if(rtcEnabled){
|
||||||
doSetTime(timenow);
|
doSetTime(timenow);
|
||||||
}
|
}
|
||||||
lastTimeSyncTyp = 2;
|
lastTimeSyncTyp = 2;
|
||||||
lastTimeSyncTime = timenow;
|
lastTimeSyncTime = timenow;
|
||||||
|
savediDL = iDL;
|
||||||
|
EEPROM.put(10, savediDL);
|
||||||
|
EEPROM.commit();
|
||||||
display.drawPixelRGB888(2,0,0,255,0);
|
display.drawPixelRGB888(2,0,0,255,0);
|
||||||
display_doupdate();
|
display_doupdate();
|
||||||
}else{
|
}else{
|
||||||
@@ -829,7 +789,6 @@ void setup() {
|
|||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
WiFi.softAPConfig(ip_local, ip_gateway, ip_subnet);
|
WiFi.softAPConfig(ip_local, ip_gateway, ip_subnet);
|
||||||
//appass = ;
|
|
||||||
APEnabled = WiFi.softAP(APName, appass,2,0,2,250);
|
APEnabled = WiFi.softAP(APName, appass,2,0,2,250);
|
||||||
if(!APEnabled)
|
if(!APEnabled)
|
||||||
display.drawPixelRGB888(3,0,255,0,0);
|
display.drawPixelRGB888(3,0,255,0,0);
|
||||||
@@ -843,13 +802,6 @@ void setup() {
|
|||||||
|
|
||||||
display_doupdate();
|
display_doupdate();
|
||||||
|
|
||||||
//für die automatische Umleitung
|
|
||||||
/*webServer.on("/generate_204", HTTP_GET, [](AsyncWebServerRequest *request){html_root(request);}); //Android captive portal.
|
|
||||||
webServer.on("/fwlink", HTTP_GET, [](AsyncWebServerRequest *request){html_root(request);}); //Microsoft captive portal.
|
|
||||||
webServer.on("/connecttest.txt", HTTP_GET, [](AsyncWebServerRequest *request){html_root(request);}); //www.msftconnecttest.com
|
|
||||||
webServer.on("/hotspot-detect.html", HTTP_GET, [](AsyncWebServerRequest *request){html_root(request);}); //captive.apple.com
|
|
||||||
webServer.on("/success.txt", HTTP_GET, [](AsyncWebServerRequest *request){html_handle_success(request);}); //detectportal.firefox.com/sucess.txt
|
|
||||||
webServer.on("/redirect", HTTP_GET, [](AsyncWebServerRequest *request){html_root(request);}); //Microsoft captive portal.*/
|
|
||||||
webServer.onNotFound([](AsyncWebServerRequest *request){html_handle_notsuccess(request);});
|
webServer.onNotFound([](AsyncWebServerRequest *request){html_handle_notsuccess(request);});
|
||||||
|
|
||||||
//eigene Seiten
|
//eigene Seiten
|
||||||
@@ -871,28 +823,22 @@ void setup() {
|
|||||||
void loop(){
|
void loop(){
|
||||||
if (millis() - ti_second > 1000) {
|
if (millis() - ti_second > 1000) {
|
||||||
ti_second = millis();
|
ti_second = millis();
|
||||||
|
}
|
||||||
|
if(doRTCSecond){
|
||||||
|
doRTCSecond = false;
|
||||||
if((timeStatus() != timeNotSet)){
|
if((timeStatus() != timeNotSet)){
|
||||||
time_t currentUNIXTime = now();
|
time_t currentUNIXTime = now();
|
||||||
if(rtcEnabled){
|
if(rtcEnabled){
|
||||||
currentUNIXTime = rtc.getUNIX();
|
currentUNIXTime = rtc.getUNIX();
|
||||||
setTime(currentUNIXTime);
|
setTime(currentUNIXTime);
|
||||||
}
|
}
|
||||||
byte Month, Day, Hour, Minute, Second, WDay;
|
uint8_t Hour, Minute, Second, WDay;
|
||||||
Month = month(currentUNIXTime);
|
|
||||||
Day = day(currentUNIXTime);
|
|
||||||
Hour = hour(currentUNIXTime);
|
Hour = hour(currentUNIXTime);
|
||||||
Minute = minute(currentUNIXTime);
|
Minute = minute(currentUNIXTime);
|
||||||
Second = second(currentUNIXTime);
|
Second = second(currentUNIXTime);
|
||||||
WDay = weekday();
|
WDay = weekday();
|
||||||
if((isDayLight(Hour,Day,WDay,Month) != iDL) && (((Month == 10) & (Hour >= 3)) | (Month == 3))){
|
checkiDL();
|
||||||
if(iDL){
|
//Sonntag Reset ..
|
||||||
doSetTime(currentUNIXTime - SECS_PER_HOUR);
|
|
||||||
}else{
|
|
||||||
doSetTime(currentUNIXTime + SECS_PER_HOUR);
|
|
||||||
}
|
|
||||||
iDL = isDayLight(Hour,Day,WDay,Month);
|
|
||||||
}
|
|
||||||
//Sonntag und NTP = Reset ..
|
|
||||||
if((WDay == 1) && (Hour == 3) && (Minute == 1) && (Second == 0)){
|
if((WDay == 1) && (Hour == 3) && (Minute == 1) && (Second == 0)){
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
@@ -922,8 +868,8 @@ void loop(){
|
|||||||
}
|
}
|
||||||
rtc.getTEMPERATURE(&temperature);
|
rtc.getTEMPERATURE(&temperature);
|
||||||
}
|
}
|
||||||
dnsServer.processNextRequest();
|
if(APEnabled)
|
||||||
//yield();
|
dnsServer.processNextRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
//alles was WEB ist ...
|
//alles was WEB ist ...
|
||||||
@@ -1006,6 +952,9 @@ void html_poll(AsyncWebServerRequest *request) {
|
|||||||
itoa(kw,tempBuff,DEC);
|
itoa(kw,tempBuff,DEC);
|
||||||
strcat(ret,(char *)",");
|
strcat(ret,(char *)",");
|
||||||
strcat(ret,tempBuff);
|
strcat(ret,tempBuff);
|
||||||
|
itoa(iDL,tempBuff,DEC);
|
||||||
|
strcat(ret,(char *)",");
|
||||||
|
strcat(ret,tempBuff);
|
||||||
strcat(ret,(char *)"]");
|
strcat(ret,(char *)"]");
|
||||||
request->send(200, "text/plain", ret);
|
request->send(200, "text/plain", ret);
|
||||||
}
|
}
|
||||||
@@ -1021,6 +970,16 @@ void html_do(AsyncWebServerRequest *request) {
|
|||||||
doSetTime(l_value);
|
doSetTime(l_value);
|
||||||
lastTimeSyncTyp = 3;
|
lastTimeSyncTyp = 3;
|
||||||
lastTimeSyncTime = now();
|
lastTimeSyncTime = now();
|
||||||
|
//isDayLight (Sommerzeit) prüfen
|
||||||
|
uint8_t Month, Day, Hour;
|
||||||
|
setTime(l_value);
|
||||||
|
Month = month(l_value);
|
||||||
|
Day = day(l_value);
|
||||||
|
Hour = hour(l_value);
|
||||||
|
iDL = isDayLight(Hour,Day,weekday(),Month);
|
||||||
|
savediDL = iDL;
|
||||||
|
EEPROM.put(10, savediDL);
|
||||||
|
EEPROM.commit();
|
||||||
}else if(request->hasParam(PARAM_SHOWWHAT)) {
|
}else if(request->hasParam(PARAM_SHOWWHAT)) {
|
||||||
s_value = request->getParam(PARAM_SHOWWHAT)->value();
|
s_value = request->getParam(PARAM_SHOWWHAT)->value();
|
||||||
timeIndex = s_value.toInt();
|
timeIndex = s_value.toInt();
|
||||||
@@ -1139,12 +1098,3 @@ char * html_processor(const String& var){
|
|||||||
}
|
}
|
||||||
return (char *) "not defined";
|
return (char *) "not defined";
|
||||||
}
|
}
|
||||||
|
|
||||||
String toggleState(int toggle){
|
|
||||||
switch(toggle){
|
|
||||||
case 0:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
@@ -228,6 +228,10 @@ const char html_page_index[] PROGMEM = R"rawliteral(
|
|||||||
<input id="withSeconds" type='checkbox' onclick="return false" readonly>
|
<input id="withSeconds" type='checkbox' onclick="return false" readonly>
|
||||||
<label for="withSeconds">Sekunden zeigen</label>
|
<label for="withSeconds">Sekunden zeigen</label>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="wsnw">
|
||||||
|
<input id="isSummerTime" type='checkbox' onclick="return false" readonly>
|
||||||
|
<label for="isSummerTime">Sommerzeit</label>
|
||||||
|
</span>
|
||||||
<span class="wsnw">
|
<span class="wsnw">
|
||||||
<input id="alwaysAccessPoint" type='checkbox' onclick="return false" readonly>
|
<input id="alwaysAccessPoint" type='checkbox' onclick="return false" readonly>
|
||||||
<label for="alwaysAccessPoint">AccessPoint erstellen auch bei erfolgreicher WiFi Verbindung</label>
|
<label for="alwaysAccessPoint">AccessPoint erstellen auch bei erfolgreicher WiFi Verbindung</label>
|
||||||
@@ -422,6 +426,7 @@ const char html_page_index[] PROGMEM = R"rawliteral(
|
|||||||
colorString = "#" + data[13].toString(16).padStart(6, '0');
|
colorString = "#" + data[13].toString(16).padStart(6, '0');
|
||||||
document.getElementById('actKW').style.color = colorString;
|
document.getElementById('actKW').style.color = colorString;
|
||||||
document.getElementById('actKW').innerHTML = "KW " + data[14];
|
document.getElementById('actKW').innerHTML = "KW " + data[14];
|
||||||
|
document.getElementById("isSummerTime").checked = (data[15] == 1);
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user