EEpromloadsetting: set hours and minutes to zero if its eepromload value is not a valid time

This commit is contained in:
Charlez Kwan 2020-08-15 14:44:55 +02:00
parent b6c8bed2a6
commit 5676b5b5a6

View file

@ -814,10 +814,26 @@ void Write_intostime(){
void Eeprom_loadsettings(){ void Eeprom_loadsettings(){
for(uint8_t i=0 ; i < 7 ; i++){ for(uint8_t i=0 ; i < 7 ; i++){
if((uint8_t) (readEEPROMHalfWord(2*i) >> 8) >= 0 && (uint8_t) (readEEPROMHalfWord(2*i) >> 8) < 24){
sSetStart[i].Hours = (uint8_t) (readEEPROMHalfWord(2*i) >> 8); sSetStart[i].Hours = (uint8_t) (readEEPROMHalfWord(2*i) >> 8);
}else{
sSetStart[i].Hours = 0;
}
if((uint8_t) readEEPROMHalfWord(2*i) >= 0 && (uint8_t) readEEPROMHalfWord(2*i) < 60){
sSetStart[i].Minutes = (uint8_t) readEEPROMHalfWord(2*i); sSetStart[i].Minutes = (uint8_t) readEEPROMHalfWord(2*i);
}else{
sSetStart[i].Minutes = 0;
}
if((uint8_t) (readEEPROMHalfWord(2*i + 14) >> 8) >= 0 && (uint8_t) (readEEPROMHalfWord(2*i + 14) >> 8) < 24){
sSetEnd[i].Hours = (uint8_t) (readEEPROMHalfWord(2*i + 14) >> 8); sSetEnd[i].Hours = (uint8_t) (readEEPROMHalfWord(2*i + 14) >> 8);
}else{
sSetEnd[i].Hours = 0;
}
if((uint8_t) readEEPROMHalfWord(2*i + 14) >= 0 && (uint8_t) readEEPROMHalfWord(2*i + 14) < 60){
sSetEnd[i].Minutes = (uint8_t) readEEPROMHalfWord(2*i + 14); sSetEnd[i].Minutes = (uint8_t) readEEPROMHalfWord(2*i + 14);
}else{
sSetEnd[i].Minutes = 0;
}
} }
} }