comparison Discovery/Src/t3.c @ 837:18946846b95b Evo_2_23

Bugfixes and code cleanup for BF views: BF views gauge and apnoe were using "dive computer" T3 view functions which caused some problem because these legacy views were not intended to work with customer view selection. A switch condition has been added to skip these kind of functions in case a design other T3 is in use. Another potential problem was that there were two definitions for T3 and T7 views which were basically the same. If they wold not be the same the switching functionality wold not work properly. To avoid this problem in futur the arrays have been merged => the view are handled sing the (newer) cv_view arrays instead of the standard_views which were in used before the user could the views which should be shown.
author ideenmodellierer
date Wed, 27 Dec 2023 19:37:17 +0100
parents 717b460294cd
children aed39d19269c
comparison
equal deleted inserted replaced
836:8d6c35655d4d 837:18946846b95b
64 64
65 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ 65 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/
66 66
67 /* Private types -------------------------------------------------------------*/ 67 /* Private types -------------------------------------------------------------*/
68 #define TEXTSIZE 16 68 #define TEXTSIZE 16
69 #define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */
70
71 const uint8_t t3_customviewsStandard[] =
72 {
73 CVIEW_T3_Decostop,
74 CVIEW_sensors,
75 CVIEW_Compass,
76 CVIEW_T3_MaxDepth,
77 CVIEW_T3_StopWatch,
78 CVIEW_T3_TTS,
79 CVIEW_T3_ppO2andGas,
80 CVIEW_T3_GasList,
81 CVIEW_T3_Navigation,
82 CVIEW_T3_DepthData,
83 CVIEW_noneOrDebug,
84 CVIEW_T3_DecoTTS,
85 #ifdef ENABLE_T3_PROFILE_VIEW
86 CVIEW_T3_Profile,
87 #endif
88 CVIEW_T3_END
89 };
90 69
91 /* Private function prototypes -----------------------------------------------*/ 70 /* Private function prototypes -----------------------------------------------*/
92 void t3_refresh_divemode(void); 71 void t3_refresh_divemode(void);
93 72
94 uint8_t t3_test_customview_warnings(void); 73 uint8_t t3_test_customview_warnings(void);
100 void t3_init(void) 79 void t3_init(void)
101 { 80 {
102 SSettings* pSettings; 81 SSettings* pSettings;
103 pSettings = settingsGetPointer(); 82 pSettings = settingsGetPointer();
104 83
105 t3_selection_customview = t3_customviewsStandard[0]; 84 t3_selection_customview = cv_changelist_BS[0];
106 85
107 t3screen.FBStartAdress = 0; 86 t3screen.FBStartAdress = 0;
108 t3screen.ImageHeight = 480; 87 t3screen.ImageHeight = 480;
109 t3screen.ImageWidth = 800; 88 t3screen.ImageWidth = 800;
110 t3screen.LayerIndex = 1; 89 t3screen.LayerIndex = 1;
901 } 880 }
902 881
903 882
904 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) 883 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode)
905 { 884 {
906 static uint8_t last_customview = CVIEW_END; 885 static uint8_t last_customview = CVIEW_T3_END;
907 886
908 char text[30]; 887 char text[30];
909 uint16_t textpointer = 0; 888 uint16_t textpointer = 0;
910 889
911 SSettings* pSettings; 890 SSettings* pSettings;
970 } 949 }
971 else 950 else
972 { 951 {
973 heading = (uint16_t)stateUsed->lifeData.compass_heading; 952 heading = (uint16_t)stateUsed->lifeData.compass_heading;
974 } 953 }
975 if(last_customview != tX_selection_customview) /* check if current selection is disabled and should be skipped */ 954 if((last_customview != tX_selection_customview) && (settingsGetPointer()->design == 3)) /* check if current selection is disabled and should be skipped */
976 { 955 {
977 if(t3_customview_disabled(tX_selection_customview)) 956 if(t3_customview_disabled(tX_selection_customview))
978 { 957 {
979 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); 958 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER);
980 } 959 }
1254 GFX_write_string(&FontT105,tXc1,text,0); 1233 GFX_write_string(&FontT105,tXc1,text,0);
1255 } 1234 }
1256 } 1235 }
1257 break; 1236 break;
1258 1237
1259 case CVIEW_sensors: 1238 case CVIEW_T3_sensors:
1260 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); 1239 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor);
1261 GFX_write_string(&FontT42,tXc1,text,0); 1240 GFX_write_string(&FontT42,tXc1,text,0);
1262 1241
1263 for(int i=0;i<3;i++) 1242 for(int i=0;i<3;i++)
1264 { 1243 {
1674 break; 1653 break;
1675 } 1654 }
1676 i++; 1655 i++;
1677 } 1656 }
1678 1657
1679 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && 1658 if ((view == CVIEW_T3_sensors) &&
1680 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) 1659 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback))
1681 { 1660 {
1682 cv_disabled = 1; 1661 cv_disabled = 1;
1683 } 1662 }
1684 1663
1686 } 1665 }
1687 1666
1688 uint8_t t3_change_customview(uint8_t action) 1667 uint8_t t3_change_customview(uint8_t action)
1689 { 1668 {
1690 1669
1691 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); 1670 t3_basics_change_customview(&t3_selection_customview, cv_changelist_BS, action);
1692 return t3_selection_customview; 1671 return t3_selection_customview;
1693 } 1672 }
1694 1673
1695 1674
1696 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) 1675 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action)
1707 while((tX_customviews[index] != CVIEW_T3_END)) 1686 while((tX_customviews[index] != CVIEW_T3_END))
1708 { 1687 {
1709 if (tX_customviews[index] == *tX_selection_customview) 1688 if (tX_customviews[index] == *tX_selection_customview)
1710 { 1689 {
1711 curViewIdx = index; 1690 curViewIdx = index;
1691 break;
1712 } 1692 }
1713 index++; 1693 index++;
1714 } 1694 }
1715 if(curViewIdx == 0xff) /* called with unknown view */ 1695 if(curViewIdx == 0xff) /* called with unknown view */
1716 { 1696 {
1750 break; 1730 break;
1751 default: 1731 default:
1752 break; 1732 break;
1753 } 1733 }
1754 1734
1755 if(t3_customview_disabled(tX_customviews[index])) 1735 if((tX_customviews == cv_changelist_BS) && (t3_customview_disabled(tX_customviews[index])))
1756 { 1736 {
1757 iterate = 1; 1737 iterate = 1;
1758 if(*tX_selection_customview == tX_customviews[index]) 1738 if(*tX_selection_customview == tX_customviews[index])
1759 { 1739 {
1760 useFallback = 1; /* the provided view is disabled => use fallback */ 1740 useFallback = 1; /* the provided view is disabled => use fallback */
1950 { 1930 {
1951 uint8_t *pViews; 1931 uint8_t *pViews;
1952 uint8_t increment = 1; 1932 uint8_t increment = 1;
1953 uint8_t enabledViewCnt = 0; 1933 uint8_t enabledViewCnt = 0;
1954 1934
1955 pViews = (uint8_t*)t3_customviewsStandard; 1935 pViews = (uint8_t*)cv_changelist_BS;
1956 while((*pViews != CVIEW_T3_END)) 1936 while((*pViews != CVIEW_T3_END))
1957 { 1937 {
1958 increment = 1; 1938 increment = 1;
1959 /* check if view is enabled */ 1939 /* check if view is enabled */
1960 if(t3_customview_disabled(*pViews)) 1940 if(t3_customview_disabled(*pViews))