Mercurial > public > ostc4
comparison Discovery/Src/tInfoLog.c @ 452:b90ddf57f7f1 minor_improvments
Added compile variant enabling the reset of profile sample information:
In case the sample ring has an overrun prior to the header ring then header will point to no longer available sample locations causing problems when the no longer existing samples are read. To avoid this also in earlier versions a variant has been added which enables the user to reset the invalid sample information by selecting the problematic dive in the infolog menu and pressing the middle button.
Added function which confirms consistency of dive log settings:
Meaning last dive and dive header are valid at startup. Repair and find lastDiveID are only called in case a inconsistency is detected
author | ideenmodellierer |
---|---|
date | Tue, 24 Mar 2020 21:59:11 +0100 |
parents | f11f0bf6ef2d |
children | 4bd01f48c285 |
comparison
equal
deleted
inserted
replaced
451:c2e02b87774f | 452:b90ddf57f7f1 |
---|---|
34 #include "show_logbook.h" | 34 #include "show_logbook.h" |
35 #include "tHome.h" | 35 #include "tHome.h" |
36 #include "tInfo.h" | 36 #include "tInfo.h" |
37 #include "tMenu.h" | 37 #include "tMenu.h" |
38 #include "unit.h" | 38 #include "unit.h" |
39 #include "externLogbookFlash.h" | |
40 #include "configuration.h" | |
39 | 41 |
40 /* Exported variables --------------------------------------------------------*/ | 42 /* Exported variables --------------------------------------------------------*/ |
41 | 43 |
42 /* Private types -------------------------------------------------------------*/ | 44 /* Private types -------------------------------------------------------------*/ |
43 typedef struct | 45 typedef struct |
62 void showLog(void); | 64 void showLog(void); |
63 void showNextLogPage(void); | 65 void showNextLogPage(void); |
64 void stepBackInfo(void); | 66 void stepBackInfo(void); |
65 void stepForwardInfo(void); | 67 void stepForwardInfo(void); |
66 void showLogExit(void); | 68 void showLogExit(void); |
69 void resetDiveProfile(void); | |
67 | 70 |
68 /* Exported functions --------------------------------------------------------*/ | 71 /* Exported functions --------------------------------------------------------*/ |
69 void tInfoLog_init(void) | 72 void tInfoLog_init(void) |
70 { | 73 { |
71 INFOLOGscreen.FBStartAdress = 0; | 74 INFOLOGscreen.FBStartAdress = 0; |
174 void sendActionToInfoLogShow(uint8_t sendAction) | 177 void sendActionToInfoLogShow(uint8_t sendAction) |
175 { | 178 { |
176 switch(sendAction) | 179 switch(sendAction) |
177 { | 180 { |
178 case ACTION_BUTTON_ENTER: | 181 case ACTION_BUTTON_ENTER: |
182 #ifdef ENABLE_PROFILE_RESET | |
183 resetDiveProfile(); | |
184 #endif | |
179 break; | 185 break; |
180 case ACTION_BUTTON_NEXT: | 186 case ACTION_BUTTON_NEXT: |
181 showNextLogPage(); | 187 showNextLogPage(); |
182 break; | 188 break; |
183 case ACTION_TIMEOUT: | 189 case ACTION_TIMEOUT: |
427 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1; | 433 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1; |
428 //build_logbook_test(); | 434 //build_logbook_test(); |
429 show_logbook_test(0, stepBack); | 435 show_logbook_test(0, stepBack); |
430 } | 436 } |
431 | 437 |
432 | 438 #ifdef ENABLE_PROFILE_RESET |
439 void resetDiveProfile() | |
440 { | |
441 uint8_t stepBack; | |
442 SLogbookHeader logbookHeader; | |
443 convert_Type dataStart; | |
444 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1; /* calculate current dive ID */ | |
445 logbook_getHeader(stepBack ,&logbookHeader); | |
446 | |
447 dataStart.u8bit.byteHigh = 0; | |
448 dataStart.u8bit.byteLow = logbookHeader.pBeginProfileData[0]; | |
449 dataStart.u8bit.byteMidLow = logbookHeader.pBeginProfileData[1]; | |
450 dataStart.u8bit.byteMidHigh = logbookHeader.pBeginProfileData[2]; | |
451 | |
452 dataStart.u32bit &= 0xFFFF0000; /* set to sector start */ | |
453 ext_flash_invalidate_sample_index(dataStart.u32bit); | |
454 } | |
455 #endif |