Fix EEPROM is ready

This commit is contained in:
Elp03 2024-03-06 15:27:30 +01:00
parent 27d8d44d34
commit 7008037de9

View File

@ -79,10 +79,14 @@ typedef struct {
void checkEEpromIsReady(){
printf("checking eeprom");
if (eeprom_is_ready()){
printf("it is");
}else{
printf("its not");
while(1){
if (eeprom_is_ready()){
break;
printf("it is");
}else{
;
printf("its not");
}
}
}
@ -107,7 +111,7 @@ config_t ReadStructInEEPROM(){
config_t readStruct;
uint8_t structsize = sizeof(readStruct);
//checkEEpromIsReady();
checkEEpromIsReady();
eeprom_read_block((void *) &readStruct,(void*) &fanControllerStartAddress, structsize);
return readStruct;
@ -115,7 +119,7 @@ config_t ReadStructInEEPROM(){
void WriteFanSpeedInEEPROM(uint8_t fanSpeed){
//checkEEpromIsReady();
checkEEpromIsReady();
eeprom_write_byte(currentFanSpeedAddress, fanSpeed);
currentFanSpeedAddress++;
@ -128,7 +132,7 @@ void ReadFanSpeedInfo(){
uint8_t len = currentFanSpeedAddress - fanSpeedStartAddress;
uint8_t fanSpeedIterate = 0;
//checkEEpromIsReady();
checkEEpromIsReady();
for (uint8_t i = 0; i <len; i++){
fanSpeedIterate = eeprom_read_byte(i);
@ -147,7 +151,7 @@ void main() {
while(1){
printf("in loop\n");
printf("Write the struct \n");
printf("Write the struct \n");
WriteStructInEEPROM(fanController);
printf("Read struct\n");