comparison Discovery/Src/externLogbookFlash.c @ 441:9a9e4908ce2e

fix potential issue with >255 dives in the logbook
author heinrichsweikamp
date Sun, 01 Mar 2020 10:06:45 +0100
parents 7f351c25608a
children 2effe85f1a9b
comparison
equal deleted inserted replaced
440:4787cd767a9d 441:9a9e4908ce2e
1405 convert_Type dataStart, dataEnd; 1405 convert_Type dataStart, dataEnd;
1406 1406
1407 /* TODO Cleanup_Ref_1: cleanup logFlashNextSampleStartAddress and lastDiveLogId */ 1407 /* TODO Cleanup_Ref_1: cleanup logFlashNextSampleStartAddress and lastDiveLogId */
1408 /* The implementation below would cause problems in case more then 254 dives would be done. */ 1408 /* The implementation below would cause problems in case more then 254 dives would be done. */
1409 /* This is avoided by Cleanup_Ref2 */ 1409 /* This is avoided by Cleanup_Ref2 */
1410 for(id = 0; id < 255;id++) 1410 for(id = 0; id <= 255;id++)
1411 { 1411 {
1412 actualAddress = HEADERSTART + (0x800 * id) + HEADER2OFFSET; 1412 actualAddress = HEADERSTART + (0x800 * id) + HEADER2OFFSET;
1413 ext_flash_read_block_start(); 1413 ext_flash_read_block_start();
1414 ext_flash_read_block(&header1, EF_HEADER); 1414 ext_flash_read_block(&header1, EF_HEADER);
1415 ext_flash_read_block(&header2, EF_HEADER); 1415 ext_flash_read_block(&header2, EF_HEADER);