diff --git a/flash.c b/flash.c --- a/flash.c +++ b/flash.c @@ -5,6 +5,7 @@ void flash_init(therm_settings_t* tosave) { + ssd1306_clearscreen(); uint16_t size = sizeof(therm_settings_t)-1; uint32_t flash_adr = END_ADDR - size; flash_adr -= 2; @@ -29,13 +30,15 @@ void flash_init(therm_settings_t* tosave // If blank, do nothing and just use values from RAM + count = size + 1; // If not blank, check the checksums if(count != size) { ssd1306_DrawString("FLASH NOT BLANK", 1, 0); // Calculate Checksums - uint8_t cksum0=0,cksum1=0; - uint8_t rdSum0=0,rdSum1=0; + uint8_t cksum0=0,cksum1=0; + uint8_t rdSum0=0,rdSum1=0; + flash_adr = END_ADDR - size; flash_ptr = (uint8_t *)flash_adr; for(i=1; i < size; i++) @@ -70,18 +73,20 @@ void flash_init(therm_settings_t* tosave void flash_save(therm_settings_t* tosave) { - ssd1306_DrawString("BEGIN SAVE", 2, 0); - HAL_Delay(1500); - flash_erase(tosave); - flash_write(tosave); - flash_checksum(tosave); - ssd1306_DrawString("END SAVE", 2, 0); - HAL_Delay(1500); + ssd1306_clearscreen(); + ssd1306_DrawString("BEGIN SAVE", 0, 0); + HAL_Delay(1500); + flash_erase(tosave); + flash_write(tosave); + flash_checksum(tosave); + ssd1306_DrawString("END SAVE", 2, 0); + HAL_Delay(1500); } void flash_read(therm_settings_t *tosave) { + ssd1306_clearscreen(); ssd1306_DrawString("READING SAVE", 1, 0); char tempstr[10]; itoa(sizeof(therm_settings_t), tempstr, 10);