fix main alogo error

This commit is contained in:
Clement 2023-11-18 19:33:38 +01:00
parent cf3f14bb07
commit e0e9fb0bca

View File

@ -79,46 +79,43 @@ void Program::loop() {
} }
this->menu=MainMenu::SELECT_END_HOUR; this->menu=MainMenu::SELECT_END_HOUR;
this->resetMillis = millis(); 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 //TODO: géré les mardi et jeudi
Serial.print("hour :");
Serial.print(hour);
Serial.print(" min :");
Serial.println(min);
break;} break;}
case MainMenu::SELECT_END_HOUR: // select Close hour case MainMenu::SELECT_END_HOUR: // select Close hour
this->ledLib->actLed(this->encoder->getValue(), this->nLedStart); this->ledLib->actLed(this->encoder->getValue(), this->nLedStart);
break; break;
case MainMenu::SEND_TO_DISCORD:{ // send value to discord case MainMenu::SEND_TO_DISCORD:{ // send value to discord
String strTime = ""; String strTime = "";
bool min = false;
int endLed = this->encoder->getValue(); int endLed = this->encoder->getValue();
int hour = (this->nLedStart + endLed)/2; int hour = (this->nLedStart + endLed)/2;
if(this->pm){ if(this->pm){
hour += 12; hour += 12;
} }
strTime += hour; if(hour >= 24){
strTime += "h"; hour -= 24;
}
if(this->nLedStart % 2 == 1){ if(this->nLedStart % 2 == 1){
if(endLed % 2 == 1){ if(endLed % 2 == 1){
strTime += "30"; hour -=1;
min = true;
} }
}else{ }else{
if(endLed % 2 == 0){ if(endLed % 2 == 0){
strTime += "30"; hour -=1;
min = true;
} }
} }
strTime += hour;
strTime += "h";
if(min)strTime += "30";
Serial.println(strTime); Serial.println(strTime);
Serial.print("Start : "); //this->sendTime(strTime);
Serial.print(this->nLedStart);
Serial.print(" End : ");
Serial.print(endLed);
Serial.print(" hour : ");
Serial.print(hour);
Serial.println();
this->sendTime(strTime);
this->menu = MainMenu::INITIAL_STATE; this->menu = MainMenu::INITIAL_STATE;
this->encoder->resetMenu();
this->encoder->resetValue();
this->ledLib->okBlink();
} }
break; break;
@ -144,21 +141,6 @@ void Program::loop() {
this->resetMillis = millis(); this->resetMillis = millis();
this->menu = MainMenu::INITIAL_STATE; 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(); // int currentDayOfWeek = this->timeClient->getDay();
// Serial.print("Day of week: "); // Serial.print("Day of week: ");