EEpromloadsetting: set hours and minutes to zero if its eepromload value is not a valid time
This commit is contained in:
parent
b6c8bed2a6
commit
5676b5b5a6
1 changed files with 21 additions and 5 deletions
18
Src/main.c
18
Src/main.c
|
@ -1,4 +1,4 @@
|
||||||
/* USER CODE BEGIN Header */
|
/* USER CODE BEGIN Header */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file : main.c
|
* @file : main.c
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue