feat: add-ntp-support #4
@ -25,6 +25,13 @@ private:
|
||||
DiscordAPI* discord;
|
||||
WiFiUDP* ntpUDP;
|
||||
NTPClient* timeClient;
|
||||
|
||||
/**
|
||||
* @brief Send time to discord
|
||||
* the start time is automaticly set to the current time
|
||||
* @param[in] timeEnd LabOuest closing time
|
||||
*/
|
||||
void sendTime(String timeEnd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,17 @@ Program::Program() {
|
||||
this->ntpUDP = new WiFiUDP();
|
||||
this->timeClient = new NTPClient(*this->ntpUDP, "pool.ntp.org", 3600*2);//*2 = gnt+2
|
||||
|
||||
//Serial.println(this->discord->sendHeure("10h", "18h"));
|
||||
this->timeClient->update();
|
||||
this->sendTime("18h12");
|
||||
}
|
||||
|
||||
void Program::sendTime(String timeEnd){
|
||||
String start = (String)this->timeClient->getHours() + "h";
|
||||
int startQuater = this->timeClient->getMinutes()/15;
|
||||
if (startQuater != 0){
|
||||
start += (String)(startQuater * 15);
|
||||
}
|
||||
this->discord->sendHeure(start, timeEnd);
|
||||
}
|
||||
|
||||
void Program::loop() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user