comparison Discovery/Src/tMenuEditCustom.c @ 820:7322adb00305

Split definition of custom views: In the previous version the T7 and T3 custom views were defined using the same enum. As result an ID shift may happen causing errors in the selection of the big font views. The second reason to split the definition is that shift operations are used in uint32_t variable (limit 32). The total number of current views is 27 => splitting will avoid ID problems in case new views are added.
author Ideenmodellierer
date Sun, 24 Sep 2023 18:43:12 +0200
parents ce8f71217f45
children 2a8af51ab04d
comparison
equal deleted inserted replaced
819:24b39a432bc2 820:7322adb00305
56 void openEdit_BigScreen(void); 56 void openEdit_BigScreen(void);
57 void openEdit_MotionCtrl(void); 57 void openEdit_MotionCtrl(void);
58 void openEdit_ViewPort(void); 58 void openEdit_ViewPort(void);
59 void refresh_Customviews(void); 59 void refresh_Customviews(void);
60 char customview_TXT2BYTE_helper(uint8_t customViewId); 60 char customview_TXT2BYTE_helper(uint8_t customViewId);
61 char customviewBF_TXT2BYTE_helper(uint8_t customViewId);
61 /* Announced function prototypes -----------------------------------------------*/ 62 /* Announced function prototypes -----------------------------------------------*/
62 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 63 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
63 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 64 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
64 uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 65 uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
65 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 66 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
108 text[0] = TXT_2BYTE; 109 text[0] = TXT_2BYTE;
109 text[1] = TXT2BYTE_ExtraDisplay; 110 text[1] = TXT2BYTE_ExtraDisplay;
110 text[2] = ' '; 111 text[2] = ' ';
111 text[3] = ' '; 112 text[3] = ' ';
112 text[4] = TXT_2BYTE; 113 text[4] = TXT_2BYTE;
113 text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimaryBF); 114 text[5] = customviewBF_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimaryBF);
114 text[6] = 0; 115 text[6] = 0;
115 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); 116 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
116 117
117 // field corner return 118 // field corner return
118 textpointer = 0; 119 textpointer = 0;
468 break; 469 break;
469 case CVIEW_Compass: 470 case CVIEW_Compass:
470 text = TXT2BYTE_Compass; 471 text = TXT2BYTE_Compass;
471 break; 472 break;
472 case CVIEW_Decolist: 473 case CVIEW_Decolist:
474 text = TXT2BYTE_Decolist;
475 break;
476 case CVIEW_Tissues:
477 text = TXT2BYTE_Tissues;
478 break;
479 case CVIEW_Profile:
480 text = TXT2BYTE_Profile;
481 break;
482 case CVIEW_Gaslist:
483 text = TXT2BYTE_Gaslist;
484 break;
485 case CVIEW_EADTime:
486 text = TXT2BYTE_Info;
487 break;
488 case CVIEW_SummaryOfLeftCorner:
489 text = TXT2BYTE_Summary;
490 break;
491 case CVIEW_Timer:
492 text = TXT2BYTE_Timer;
493 break;
494 case CVIEW_noneOrDebug:
495 text = TXT2BYTE_DispNoneDbg;
496 break;
497 default:
498 break;
499 }
500 return text;
501 }
502 char customviewBF_TXT2BYTE_helper(uint8_t customViewId)
503 {
504 char text = 0;
505
506 switch(customViewId)
507 {
508 case CVIEW_T3_noneOrDebug:
509 text = TXT2BYTE_DispNoneDbg;
510 break;
511 case CVIEW_T3_sensors:
512 text = TXT2BYTE_O2monitor;
513 break;
514 case CVIEW_T3_Compass:
515 text = TXT2BYTE_Compass;
516 break;
473 case CVIEW_T3_Decostop: 517 case CVIEW_T3_Decostop:
474 text = TXT2BYTE_Decolist; 518 text = TXT2BYTE_Decolist;
475 break; 519 break;
476 case CVIEW_Tissues:
477 text = TXT2BYTE_Tissues;
478 break;
479 case CVIEW_Profile:
480 #ifdef ENABLE_T3_PROFILE_VIEW 520 #ifdef ENABLE_T3_PROFILE_VIEW
481 case CVIEW_T3_Profile: 521 case CVIEW_T3_Profile:
522 text = TXT2BYTE_Profile;
523 break;
482 #endif 524 #endif
483 text = TXT2BYTE_Profile;
484 break;
485 case CVIEW_Gaslist:
486 case CVIEW_T3_GasList: 525 case CVIEW_T3_GasList:
487 text = TXT2BYTE_Gaslist; 526 text = TXT2BYTE_Gaslist;
488 break;
489 case CVIEW_EADTime:
490 text = TXT2BYTE_Info;
491 break;
492 case CVIEW_SummaryOfLeftCorner:
493 text = TXT2BYTE_Summary;
494 break;
495 case CVIEW_Timer:
496 text = TXT2BYTE_Timer;
497 break;
498 case CVIEW_noneOrDebug:
499 text = TXT2BYTE_DispNoneDbg;
500 break; 527 break;
501 case CVIEW_T3_MaxDepth: 528 case CVIEW_T3_MaxDepth:
502 text = TXT2BYTE_MaxDepth; 529 text = TXT2BYTE_MaxDepth;
503 break; 530 break;
504 case CVIEW_T3_StopWatch: 531 case CVIEW_T3_StopWatch:
523 break; 550 break;
524 } 551 }
525 return text; 552 return text;
526 } 553 }
527 554
528
529 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 555 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
530 { 556 {
531 uint8_t value; 557 uint8_t value;
532 value = settingsGetPointer()->tX_customViewTimeout; 558 value = settingsGetPointer()->tX_customViewTimeout;
533 559
601 { 627 {
602 uint8_t index = 0; 628 uint8_t index = 0;
603 uint8_t newValue; 629 uint8_t newValue;
604 630
605 /* list contains all views which may be selected => get index of current setting */ 631 /* list contains all views which may be selected => get index of current setting */
606 while((settingsGetPointer()->tX_customViewPrimaryBF != cv_changelist_BS[index]) || (cv_changelist_BS[index] == CVIEW_T3_END)) 632 while((settingsGetPointer()->tX_customViewPrimaryBF != cv_changelist_BS[index]) && (cv_changelist_BS[index] != CVIEW_T3_END))
607 { 633 {
608 index++; 634 index++;
609 } 635 }
610 if((cv_changelist_BS[index] == CVIEW_T3_END) || (cv_changelist_BS[index+1] == CVIEW_T3_END)) /* invalid or last setting */ 636 if((cv_changelist_BS[index] == CVIEW_T3_END) || (cv_changelist_BS[index+1] == CVIEW_T3_END)) /* invalid or last setting */
611 { 637 {
999 else 1025 else
1000 { 1026 {
1001 if(pcv_curchangelist == cv_changelist) 1027 if(pcv_curchangelist == cv_changelist)
1002 { 1028 {
1003 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id); 1029 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id);
1030 text[textPointer++] = ' ';
1031 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id));
1004 } 1032 }
1005 else 1033 else
1006 { 1034 {
1007 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id); 1035 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id);
1036 text[textPointer++] = ' ';
1037 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customviewBF_TXT2BYTE_helper(id));
1008 } 1038 }
1009 text[textPointer++] = ' '; 1039
1010 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id)); 1040 switch(i)
1011 1041 {
1012 switch(i) 1042 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text);
1013 { 1043 break;
1014 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text); 1044 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text);
1015 break; 1045 break;
1016 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text); 1046 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, text);
1017 break; 1047 break;
1018 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, text); 1048 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text);
1019 break; 1049 break;
1020 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); 1050 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, text);
1021 break; 1051 break;
1022 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, text); 1052 default:
1023 break; 1053 break;
1024 default: 1054 }
1025 break;
1026 }
1027 } 1055 }
1028 } 1056 }
1029 if(customviewsSubpageMax != 1) 1057 if(customviewsSubpageMax != 1)
1030 { 1058 {
1031 textPointer = 0; 1059 textPointer = 0;