diff --git a/include/Program.h b/include/Program.h index d2c92e8..31aab13 100644 --- a/include/Program.h +++ b/include/Program.h @@ -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 diff --git a/src/Program.cpp b/src/Program.cpp index 129ac98..7a43a7e 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -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() {