comparison Discovery/Src/t7.c @ 701:8c48553a0176

Bugfix display of deactivated sensors: In the previous version disabled sensors had been show after startup. Rootcause was that the deactivation state was taken from the divesettings instead of the common setting. After startup divesettings are not initialized and therefore all three sensors were displayed even if one or more were disabled. This has been fixed by using the common settings in case that the OSTC is not in divemode.
author Ideenmodellierer
date Fri, 28 Oct 2022 19:39:20 +0200
parents 79ce499e26aa
children 8adf9b8fc7fa
comparison
equal deleted inserted replaced
700:c28c09017210 701:8c48553a0176
1731 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime 1731 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime
1732 1732
1733 SSettings* pSettings; 1733 SSettings* pSettings;
1734 pSettings = settingsGetPointer(); 1734 pSettings = settingsGetPointer();
1735 1735
1736 uint8_t local_ppo2sensors_deactivated = 0;
1737
1738 if(stateUsed->mode == MODE_DIVE) /* show sensors based on current dive settings */
1739 {
1740 local_ppo2sensors_deactivated = stateUsed->diveSettings.ppo2sensors_deactivated;
1741 }
1742 else
1743 {
1744 local_ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated;
1745 }
1746
1736 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */ 1747 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */
1737 { 1748 {
1738 if(t7_customview_disabled(selection_customview)) 1749 if(t7_customview_disabled(selection_customview))
1739 { 1750 {
1740 t7_change_customview(ACTION_BUTTON_ENTER); 1751 t7_change_customview(ACTION_BUTTON_ENTER);
2038 GFX_write_string(&FontT42,&t7cH,text,0); 2049 GFX_write_string(&FontT42,&t7cH,text,0);
2039 textpointer = 0; 2050 textpointer = 0;
2040 text[textpointer++] = '\030'; // main color 2051 text[textpointer++] = '\030'; // main color
2041 for(int i=0;i<3;i++) 2052 for(int i=0;i<3;i++)
2042 { 2053 {
2043 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) 2054 if((local_ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
2044 { 2055 {
2045 #ifdef ENABLE_PSCR_MODE 2056 #ifdef ENABLE_PSCR_MODE
2046 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */ 2057 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */
2047 { 2058 {
2048 text[textpointer++] = '\023'; 2059 text[textpointer++] = '\023';
2087 GFX_write_string(&FontT42,&t7cH,text,0); 2098 GFX_write_string(&FontT42,&t7cH,text,0);
2088 textpointer = 0; 2099 textpointer = 0;
2089 text[textpointer++] = '\030'; 2100 text[textpointer++] = '\030';
2090 for(int i=0;i<3;i++) 2101 for(int i=0;i<3;i++)
2091 { 2102 {
2092 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) 2103 if(local_ppo2sensors_deactivated & (1<<i))
2093 { 2104 {
2094 text[textpointer++] = '\031'; 2105 text[textpointer++] = '\031';
2095 text[textpointer++] = '\001'; 2106 text[textpointer++] = '\001';
2096 text[textpointer++] = '-'; 2107 text[textpointer++] = '-';
2097 text[textpointer++] = '\n'; 2108 text[textpointer++] = '\n';