comparison Discovery/Src/logbook.c @ 426:514e6269256f ImprovmentNVM_2

Added function to analyse the sampel ringbuffer: The function will show 0 for used sectors, 4 for the sector currently in use and 5 for empty sectors. This allows identification of log sample index position and identification of a buffer corruption (more than 2 sectors have state 4) The repair function writes dummy bytes to the end of the active buffer with the lower sector number. This decision is based on the fact that corruption results typically in a reset of index to buffer start address. After repair the writing will be continued using the hugher buffer marked as used.
author ideenmodellierer
date Sat, 15 Feb 2020 20:50:58 +0100
parents e908b894f107
children b1091e183d52
comparison
equal deleted inserted replaced
425:86fcac4cc43a 426:514e6269256f
1187 { 1187 {
1188 pSettings->logbookOffset++; 1188 pSettings->logbookOffset++;
1189 } 1189 }
1190 ext_flash_write_settings(); 1190 ext_flash_write_settings();
1191 ext_flash_disable_protection_for_logbook(); 1191 ext_flash_disable_protection_for_logbook();
1192
1193 ext_flash_CloseSector(); /* this is just a repair function which invalidates a not used sector in case a log maintenance was called before dive */
1192 bDiveMode = 3; 1194 bDiveMode = 3;
1193 } 1195 }
1194 if(bDiveMode == 3) 1196 if(bDiveMode == 3)
1195 logbook_UpdateHeader(pStateReal); 1197 logbook_UpdateHeader(pStateReal);
1196 } 1198 }