comparison Discovery/Src/tInfoLog.c @ 461:b3f684cea9c0

Merged in Ideenmodellierer/ostc4/minor_improvments (pull request #41) Minor improvments
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Mon, 30 Mar 2020 13:16:11 +0000
parents 4bd01f48c285
children 04d94851cd1b
comparison
equal deleted inserted replaced
441:9a9e4908ce2e 461:b3f684cea9c0
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 #ifdef ENABLE_PROFILE_RESET
70 void resetDiveProfile(void);
71 #endif
67 72
68 /* Exported functions --------------------------------------------------------*/ 73 /* Exported functions --------------------------------------------------------*/
69 void tInfoLog_init(void) 74 void tInfoLog_init(void)
70 { 75 {
71 INFOLOGscreen.FBStartAdress = 0; 76 INFOLOGscreen.FBStartAdress = 0;
174 void sendActionToInfoLogShow(uint8_t sendAction) 179 void sendActionToInfoLogShow(uint8_t sendAction)
175 { 180 {
176 switch(sendAction) 181 switch(sendAction)
177 { 182 {
178 case ACTION_BUTTON_ENTER: 183 case ACTION_BUTTON_ENTER:
184 #ifdef ENABLE_PROFILE_RESET
185 resetDiveProfile();
186 #endif
179 break; 187 break;
180 case ACTION_BUTTON_NEXT: 188 case ACTION_BUTTON_NEXT:
181 showNextLogPage(); 189 showNextLogPage();
182 break; 190 break;
183 case ACTION_TIMEOUT: 191 case ACTION_TIMEOUT:
427 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1; 435 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1;
428 //build_logbook_test(); 436 //build_logbook_test();
429 show_logbook_test(0, stepBack); 437 show_logbook_test(0, stepBack);
430 } 438 }
431 439
432 440 #ifdef ENABLE_PROFILE_RESET
441 void resetDiveProfile()
442 {
443 uint8_t stepBack;
444 SLogbookHeader logbookHeader;
445 convert_Type dataStart;
446 stepBack = (6 * (infolog.page - 1)) + infolog.line - 1; /* calculate current dive ID */
447 logbook_getHeader(stepBack ,&logbookHeader);
448
449 dataStart.u8bit.byteHigh = 0;
450 dataStart.u8bit.byteLow = logbookHeader.pBeginProfileData[0];
451 dataStart.u8bit.byteMidLow = logbookHeader.pBeginProfileData[1];
452 dataStart.u8bit.byteMidHigh = logbookHeader.pBeginProfileData[2];
453
454 dataStart.u32bit &= 0xFFFF0000; /* set to sector start */
455 ext_flash_invalidate_sample_index(dataStart.u32bit);
456 }
457 #endif