2 Commits
0.03 ... 0.04

Author SHA1 Message Date
Christian Mittring
2d4a10990a [Update]: Testing Version 0.04 2018-04-01 12:18:23 +02:00
Christian Mittring
1ecddd2789 [Fixed]: NTP Update Error 2018-04-01 09:11:43 +02:00
3 changed files with 18 additions and 12 deletions

View File

@@ -30,7 +30,7 @@ CRGB leds[NUM_LEDS];
RTClib RTC; RTClib RTC;
DS3231 Clock; DS3231 Clock;
//NTP Setup //NTP Setup
NTPtime NTPch("ch.pool.ntp.org"); // Choose server pool as required NTPtime NTPch("ntp2.uni-augsburg.de"); // Choose server pool as required
//Display //Display
LiquidCrystal_I2C lcd(0x3f, 16, 2); LiquidCrystal_I2C lcd(0x3f, 16, 2);
@@ -89,8 +89,6 @@ void configModeCallback (WiFiManager *myWiFiManager) {
} }
void setup() { void setup() {
// put your setup code here, to run once:
// Initializing serial port for debugging purposes
Serial.begin(115200); Serial.begin(115200);
delay(10); delay(10);
@@ -165,15 +163,15 @@ void setup() {
Serial.print("IP address: "); Serial.print("IP address: ");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
wifi_connected = true; wifi_connected = true;
display_text("IP address",String(WiFi.localIP())); display_text("IP address",WiFi.localIP().toString());
delay(5000); delay(5000);
} }
else{ else{
WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_OFF);
} }
display_text("Licht Wecker","SW: 0.03"); display_text("Licht Wecker","SW: 0.04");
delay(1000); delay(1000);
display_text("Licht Wecker","HW: 0.02"); display_text("Licht Wecker","HW: 0.10");
delay(1000); delay(1000);
display_text("Licht Wecker",""); display_text("Licht Wecker","");
@@ -209,6 +207,7 @@ void setup() {
Serial.println("Alarm2 Set:" + String(A1Day) + ", " + String(A1Hour) + ", " + String(A1Minute) + ", " + String(AlarmBits) + ", " + String(A1Dy) + ", " + String(A1h12) + ", "); Serial.println("Alarm2 Set:" + String(A1Day) + ", " + String(A1Hour) + ", " + String(A1Minute) + ", " + String(AlarmBits) + ", " + String(A1Dy) + ", " + String(A1h12) + ", ");
show_green(); show_green();
update_time_from_web();
delay(1000); delay(1000);
show_black(); show_black();
@@ -252,7 +251,7 @@ void loop() {
//OTA //OTA
unsigned long currentMillis = millis(); unsigned long currentMillis = millis();
long intervall = currentMillis - previousMillis; unsigned long intervall = currentMillis - previousMillis;
release_gui(currentMillis); release_gui(currentMillis);
@@ -269,7 +268,7 @@ void loop() {
} }
test_pin(); test_pin();
handleSleep(intervall, currentMillis); handleSleep(intervall, currentMillis);
if(m == 1) if(m == 1 && s == 30)
{ {
update_time_from_web(); update_time_from_web();
} }

View File

@@ -123,10 +123,15 @@ void display_year(int Day, int Month, int Year){
void display_time(int Stunde, int Minute, int Sekunde){ void display_time(int Stunde, int Minute, int Sekunde){
String Min = String(Minute); String Min = String(Minute);
String Stu = String(Stunde); String Stu = String(Stunde);
String Sek = String(Sekunde);
if (Minute < 10) if (Minute < 10)
{ {
Min = "0" + Min; Min = "0" + Min;
} }
if (Sekunde < 10)
{
Sek = "0" + Sek;
}
if (Stunde < 10) if (Stunde < 10)
{ {
Stu = "0" + Stu; Stu = "0" + Stu;
@@ -159,11 +164,11 @@ void display_time(int Stunde, int Minute, int Sekunde){
{ {
display_text("Alarm 2", "Minute: " + Min); display_text("Alarm 2", "Minute: " + Min);
} }
else if (Sekunde % 2 == 0){ /*else if (Sekunde % 2 == 0){
display_text(Stu + ":" + Min, get_alarm_string()); display_text(Stu + ":" + Min, get_alarm_string());
} }*/
else{ else{
display_text(Stu + "." + Min, get_alarm_string()); display_text(Stu + ":" + Min + ":" + Sek, get_alarm_string());
} }
} }

View File

@@ -17,7 +17,7 @@ void update_time_from_web(){
byte actualMonth = dateTime.month; byte actualMonth = dateTime.month;
byte actualday =dateTime.day; byte actualday =dateTime.day;
byte actualdayofWeek = dateTime.dayofWeek; byte actualdayofWeek = dateTime.dayofWeek;
if (actualMinute != m){ if (actualMinute != m && actualday != 7 && actualMonth != 2 && actualyear != 2036){
h = actualHour; h = actualHour;
m = actualMinute; m = actualMinute;
s = actualsecond; s = actualsecond;
@@ -26,6 +26,8 @@ void update_time_from_web(){
d = actualday; d = actualday;
set_clock(); set_clock();
Serial.println("Time Updated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); Serial.println("Time Updated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
display_text("Update Time","");
delay_gui(1000);
} }
} }
} }