Mercurial > public > ostc4
comparison Discovery/Src/tMenu.c @ 647:15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
To be able to introduce a new menu page for future development, the selection of bailout cases is now combined with the selection of the diluent at one page. To enable this the concept of a "shadow page" has been introduced. With that the original functionality may be reused without need to a a standalone page. The bailout /diluen page is now switched (surface mode) using the last menu line of the gas selection page
author | Ideenmodellierer |
---|---|
date | Tue, 13 Apr 2021 19:25:41 +0200 |
parents | e221cf762f45 |
children | 5f0d3dce5ef4 |
comparison
equal
deleted
inserted
replaced
646:0fc1b47d2482 | 647:15f6f0b5786c |
---|---|
66 uint8_t linesAvailableForPage[MAXPAGES+1]; | 66 uint8_t linesAvailableForPage[MAXPAGES+1]; |
67 uint8_t pagesAvailable; | 67 uint8_t pagesAvailable; |
68 uint8_t pageCountNumber[MAXPAGES+1]; | 68 uint8_t pageCountNumber[MAXPAGES+1]; |
69 uint8_t pageCountTotal; | 69 uint8_t pageCountTotal; |
70 uint8_t modeFlipPages; | 70 uint8_t modeFlipPages; |
71 uint8_t shadowPage[MAXPAGES+1]; /* the page is switch in the context of another page */ | |
72 uint8_t activeShadow; /* Base page which is used for the shadow */ | |
71 } SMenuMemory; | 73 } SMenuMemory; |
72 | 74 |
73 /* Exported variables --------------------------------------------------------*/ | 75 /* Exported variables --------------------------------------------------------*/ |
74 | 76 |
75 /* Announced Private variables -----------------------------------------------*/ | 77 /* Announced Private variables -----------------------------------------------*/ |
90 | 92 |
91 static void draw_tMdesignSubUnselected(uint32_t *ppDestination); | 93 static void draw_tMdesignSubUnselected(uint32_t *ppDestination); |
92 static void draw_tMdesignSubSelected(uint32_t *ppDestination); | 94 static void draw_tMdesignSubSelected(uint32_t *ppDestination); |
93 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); | 95 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); |
94 static void tMenu_write(uint8_t page, char *text, char *subtext); | 96 static void tMenu_write(uint8_t page, char *text, char *subtext); |
95 | 97 static void nextLine(void); |
96 static void clean_line_actual_page(void); | 98 static void clean_line_actual_page(void); |
97 void tM_build_pages(void); | 99 void tM_build_pages(void); |
98 | 100 |
99 static void gotoMenuEdit(void); | 101 static void gotoMenuEdit(void); |
100 | 102 |
142 for(i=0;i<=MAXPAGES;i++) | 144 for(i=0;i<=MAXPAGES;i++) |
143 { | 145 { |
144 menu.lineMemoryForNavigationForPage[i] = 0; | 146 menu.lineMemoryForNavigationForPage[i] = 0; |
145 menu.StartAddressForPage[i] = 0; | 147 menu.StartAddressForPage[i] = 0; |
146 menu.linesAvailableForPage[i] = 0; | 148 menu.linesAvailableForPage[i] = 0; |
149 menu.shadowPage[i] = 0; | |
147 } | 150 } |
148 | 151 |
149 tMscreen.FBStartAdress = 0; | 152 tMscreen.FBStartAdress = 0; |
150 tMscreen.ImageHeight = 480; | 153 tMscreen.ImageHeight = 480; |
151 tMscreen.ImageWidth = 800; | 154 tMscreen.ImageWidth = 800; |
340 if(idList.page > MAXPAGES) | 343 if(idList.page > MAXPAGES) |
341 return; | 344 return; |
342 | 345 |
343 page = idList.page; | 346 page = idList.page; |
344 | 347 |
345 if(!menu.pageCountNumber[page]) | 348 if((!menu.pageCountNumber[page]) && (!menu.shadowPage[page])) /* shadow pages are not visible on top level */ |
346 return; | 349 { |
347 | 350 return; |
348 if(menu.pagesAvailable == 0) | 351 } |
349 tM_create_pagenumbering(); | 352 |
353 if(menu.pagesAvailable == 0) | |
354 tM_create_pagenumbering(); | |
350 | 355 |
351 if(*text == 0) | 356 if(*text == 0) |
352 return; | 357 return; |
353 | 358 |
354 linesFound = 1; | 359 linesFound = 1; |
431 page = menu.pageMemoryForNavigation; | 436 page = menu.pageMemoryForNavigation; |
432 | 437 |
433 if(page == 0) | 438 if(page == 0) |
434 page = first; | 439 page = first; |
435 | 440 |
436 while((page <= MAXPAGES) && ((menu.linesAvailableForPage[page] == 0) || (menu.StartAddressForPage[page] == 0) || (menu.pageCountNumber[page] == 0))) | 441 while((page <= MAXPAGES) && ((menu.linesAvailableForPage[page] == 0) || (menu.StartAddressForPage[page] == 0) || ((menu.pageCountNumber[page] == 0) && !((menu.shadowPage[page]) && (menu.pageMemoryForNavigation == page))))) |
437 page += 1; | 442 page += 1; |
438 | 443 |
439 if(page > MAXPAGES) | 444 if(page > MAXPAGES) |
440 page = first; | 445 page = first; |
441 | 446 |
463 | 468 |
464 if(page > MAXPAGES) | 469 if(page > MAXPAGES) |
465 return; | 470 return; |
466 | 471 |
467 menu.pageCountNumber[page] = 1; | 472 menu.pageCountNumber[page] = 1; |
473 } | |
474 | |
475 static void tM_addShadow(uint32_t id) | |
476 { | |
477 SStateList idList; | |
478 uint8_t page; | |
479 | |
480 get_idSpecificStateList(id, &idList); | |
481 | |
482 page = idList.page; | |
483 | |
484 if(page > MAXPAGES) | |
485 return; | |
486 | |
487 menu.shadowPage[page] = 1; | |
468 } | 488 } |
469 | 489 |
470 | 490 |
471 void tM_build_pages(void) | 491 void tM_build_pages(void) |
472 { | 492 { |
505 { | 525 { |
506 tM_add(StMPLAN); | 526 tM_add(StMPLAN); |
507 } | 527 } |
508 // if((pSettings->dive_mode != DIVEMODE_Gauge) && (pSettings->dive_mode != DIVEMODE_Apnea)) | 528 // if((pSettings->dive_mode != DIVEMODE_Gauge) && (pSettings->dive_mode != DIVEMODE_Apnea)) |
509 // { | 529 // { |
510 tM_add(StMOG); | |
511 tM_add(StMDECOP); | 530 tM_add(StMDECOP); |
512 // } | 531 // } |
532 | |
513 if((pSettings->dive_mode == DIVEMODE_CCR) || (stateUsed->diveSettings.ccrOption == 1)) | 533 if((pSettings->dive_mode == DIVEMODE_CCR) || (stateUsed->diveSettings.ccrOption == 1)) |
514 { | 534 { |
515 tM_add(StMCG); | 535 tM_add(StMCG); |
516 tM_add(StMSP); | 536 tM_add(StMSP); |
537 if (actual_menu_content == MENU_SURFACE) /* StMOG is now accessed using StMCG in CCR mode*/ | |
538 { | |
539 tM_add(StMXTRA); | |
540 tM_addShadow(StMOG); | |
541 } | |
542 else | |
543 { | |
544 tM_add(StMOG); | |
545 } | |
546 } | |
547 else | |
548 { | |
549 tM_add(StMOG); | |
517 } | 550 } |
518 | 551 |
519 id = tMOG_refresh(0, text, &tabPosition, subtext); | 552 id = tMOG_refresh(0, text, &tabPosition, subtext); |
520 tM_build_page(id, text, tabPosition, subtext); | 553 tM_build_page(id, text, tabPosition, subtext); |
521 | 554 |
846 { | 879 { |
847 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); | 880 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
848 } | 881 } |
849 } | 882 } |
850 | 883 |
884 void selectPage(uint32_t selection) | |
885 { | |
886 uint8_t page, line; | |
887 SStateList idList; | |
888 | |
889 SSettings* pSettings; | |
890 pSettings = settingsGetPointer(); | |
891 | |
892 // menu.pageMemoryForNavigation = selection; | |
893 | |
894 // findValidPosition(&page, &line); | |
895 if(selection > MAXPAGES) /* selection via structure */ | |
896 { | |
897 get_idSpecificStateList(selection, &idList); | |
898 page = idList.page; | |
899 } | |
900 else | |
901 { | |
902 page = selection; | |
903 } | |
904 | |
905 if(menu.shadowPage[page]) /* backup base page in case a shadow was selected */ | |
906 { | |
907 menu.activeShadow = menu.pageMemoryForNavigation; | |
908 } | |
909 | |
910 menu.pageMemoryForNavigation = page; | |
911 /* new test for 3button design */ | |
912 //menu.lineMemoryForNavigationForPage[page] = line; | |
913 menu.lineMemoryForNavigationForPage[page] = 0; | |
914 menu.modeFlipPages = 1; | |
915 | |
916 set_globalState_Menu_Page(page); | |
917 | |
918 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); | |
919 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
920 | |
921 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
922 /* new test for 3button design */ | |
923 //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); | |
924 if(!pSettings->FlipDisplay) | |
925 { | |
926 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); | |
927 } | |
928 else | |
929 { | |
930 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); | |
931 } | |
932 nextLine(); | |
933 } | |
934 | |
851 | 935 |
852 static void nextLine(void) | 936 static void nextLine(void) |
853 { | 937 { |
854 uint8_t page, line; | 938 uint8_t page, line; |
855 SSettings* pSettings; | 939 SSettings* pSettings; |
874 } | 958 } |
875 | 959 |
876 | 960 |
877 static void stepBackMenu(void) | 961 static void stepBackMenu(void) |
878 { | 962 { |
963 if(menu.activeShadow) /* restore base page */ | |
964 { | |
965 selectPage(menu.activeShadow); | |
966 menu.activeShadow = 0; | |
967 } | |
879 if(menu.modeFlipPages == 0) | 968 if(menu.modeFlipPages == 0) |
880 { | 969 { |
881 menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; | 970 menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; |
882 menu.modeFlipPages = 1; | 971 menu.modeFlipPages = 1; |
883 if(!settingsGetPointer()->FlipDisplay) | 972 if(!settingsGetPointer()->FlipDisplay) |
1141 uint16_t* pDestination; | 1230 uint16_t* pDestination; |
1142 uint8_t colorText; | 1231 uint8_t colorText; |
1143 uint16_t positionText; | 1232 uint16_t positionText; |
1144 uint8_t pageText; | 1233 uint8_t pageText; |
1145 | 1234 |
1146 const char text8max[MAXPAGES+1][8] = | 1235 char text8max[MAXPAGES+1][8] = |
1147 { "", | 1236 { "", |
1148 "OC", | 1237 "OC", |
1149 "CC", | 1238 "CC", |
1150 "SP", | 1239 "SP", |
1151 "DATA", | 1240 "DATA", |
1155 "", | 1244 "", |
1156 "", | 1245 "", |
1157 "SIM" | 1246 "SIM" |
1158 }; | 1247 }; |
1159 | 1248 |
1160 const _Bool spacing[MAXPAGES+1] = | 1249 _Bool spacing[MAXPAGES+1] = |
1161 { 0, | 1250 { 0, |
1162 0, // behind OC | 1251 0, // behind OC |
1163 0, // behind CC | 1252 0, // behind CC |
1164 1, // behind SP | 1253 1, // behind SP |
1165 1, // behind DATA | 1254 1, // behind DATA |
1170 1, // behind SYS3 | 1259 1, // behind SYS3 |
1171 1, // behind SIM | 1260 1, // behind SIM |
1172 0 | 1261 0 |
1173 }; | 1262 }; |
1174 | 1263 |
1264 if(actual_menu_content == MENU_SURFACE) | |
1265 { | |
1266 spacing[3] = 0; /* Display extra menu directly after setpoint */ | |
1267 sprintf(text8max[4],"OP"); | |
1268 } | |
1269 | |
1175 pBackup = tMscreen.FBStartAdress; | 1270 pBackup = tMscreen.FBStartAdress; |
1176 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | 1271 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; |
1177 pDestination = (uint16_t*) menu.StartAddressForPage[page]; | 1272 pDestination = (uint16_t*) menu.StartAddressForPage[page]; |
1178 positionText = 10; | 1273 positionText = 10; |
1179 pageText = page; | 1274 pageText = page; |
1235 } | 1330 } |
1236 | 1331 |
1237 pDestination += 5 * 480; | 1332 pDestination += 5 * 480; |
1238 positionText += 70; | 1333 positionText += 70; |
1239 | 1334 |
1240 if((k == 4) || ((k == 6) && (menu.pageCountNumber[5] == 0))) | 1335 if(((k == 4) && (actual_menu_content != MENU_SURFACE)) || ((k == 6) && (menu.pageCountNumber[5] == 0))) |
1241 { | 1336 { |
1242 pDestination += 70 * 480; | 1337 pDestination += 70 * 480; |
1243 positionText += 70; | 1338 positionText += 70; |
1244 } | 1339 } |
1245 | 1340 |