Merge commit '8edae04556c46aa0645792c6b3c021636bb454ff' into feat--add-ntp-support

This commit is contained in:
2023-10-21 19:11:44 +02:00
22 changed files with 2063 additions and 8 deletions

View File

@ -1,9 +1,12 @@
#include "Program.h"
Program::Program() {
// Startup
// Startup Serial
Serial.begin(MONITOR_SPEED);
// Startup WiFi
WiFi.begin(WSSID, PASS);
Serial.print("Connecting to ");
@ -12,7 +15,8 @@ Program::Program() {
int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
Serial.print(++i);
Serial.print(' ');
}
Serial.println('\n');
@ -20,14 +24,14 @@ Program::Program() {
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
//init obj
// Startup Discord API
this->discord = new DiscordAPI(DISCORD_HOOK);
// startup NTP
this->ntpUDP = new WiFiUDP();
this->timeClient = new NTPClient(*this->ntpUDP, "pool.ntp.org", 3600*2);//*2 = gnt+2
this->timeClient->update();
this->sendTime("18h12");
//this->sendTime("18h12");
}
void Program::sendTime(String timeEnd){
@ -40,7 +44,12 @@ void Program::sendTime(String timeEnd){
}
void Program::loop() {
// Loop
if(this->encoder->update()){
Serial.print(this->encoder->getValue());
this->ledLib->actLed(this->encoder->getValue());
Serial.print(" ");
Serial.println(this->encoder->getMenu());
}
delay(1000);
this->timeClient->update();