diff --git a/src/Program.cpp b/src/Program.cpp index 08d6677..57cac54 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -79,46 +79,43 @@ void Program::loop() { } this->menu=MainMenu::SELECT_END_HOUR; this->resetMillis = millis(); + this->ledLib->okBlink();//TODO: faire en sorte d'avoir une led d'alumé par defaut //TODO: géré les mardi et jeudi - Serial.print("hour :"); - Serial.print(hour); - Serial.print(" min :"); - Serial.println(min); break;} - case MainMenu::SELECT_END_HOUR: // select Close hour this->ledLib->actLed(this->encoder->getValue(), this->nLedStart); break; - case MainMenu::SEND_TO_DISCORD:{ // send value to discord String strTime = ""; + bool min = false; int endLed = this->encoder->getValue(); int hour = (this->nLedStart + endLed)/2; if(this->pm){ hour += 12; } - strTime += hour; - strTime += "h"; + if(hour >= 24){ + hour -= 24; + } if(this->nLedStart % 2 == 1){ if(endLed % 2 == 1){ - strTime += "30"; + hour -=1; + min = true; } }else{ if(endLed % 2 == 0){ - strTime += "30"; + hour -=1; + min = true; } } + strTime += hour; + strTime += "h"; + if(min)strTime += "30"; Serial.println(strTime); - Serial.print("Start : "); - Serial.print(this->nLedStart); - Serial.print(" End : "); - Serial.print(endLed); - Serial.print(" hour : "); - Serial.print(hour); - Serial.println(); - - this->sendTime(strTime); + //this->sendTime(strTime); this->menu = MainMenu::INITIAL_STATE; + this->encoder->resetMenu(); + this->encoder->resetValue(); + this->ledLib->okBlink(); } break; @@ -144,21 +141,6 @@ void Program::loop() { this->resetMillis = millis(); this->menu = MainMenu::INITIAL_STATE; } - // delay(1000); - - // this->timeClient->update(); - - // int currentHour = this->timeClient->getHours(); - // Serial.print("Hour: "); - // Serial.println(currentHour); - - // int currentMinute = this->timeClient->getMinutes(); - // Serial.print("Minutes: "); - // Serial.println(currentMinute); - - // int currentSecond = this->timeClient->getSeconds(); - // Serial.print("Seconds: "); - // Serial.println(currentSecond); // int currentDayOfWeek = this->timeClient->getDay(); // Serial.print("Day of week: ");