Mercurial > public > ostc4
comparison Discovery/Src/tMenuXtra.c @ 850:bc2fcd002fc4 Evo_2_23
Check line enable/disable state when a new page is selected:
Some lines may change the enable/disable state based on events which are triggered from outside the page scope (for example sensor setup). Updating the line states while another page is active caused problems in the framebuffer handling. To solve this usecase the conditions for the line dis/enabling is checked when a "nextPage" is selected. If condition changed then the page will be refreshed.
author | Ideenmodellierer |
---|---|
date | Fri, 01 Mar 2024 19:30:29 +0100 |
parents | 17d9d6eddd8d |
children | 48b6a3b1f3f8 |
comparison
equal
deleted
inserted
replaced
849:fce639612464 | 850:bc2fcd002fc4 |
---|---|
35 #include "tMenuXtra.h" | 35 #include "tMenuXtra.h" |
36 #include "text_multilanguage.h" | 36 #include "text_multilanguage.h" |
37 #include "data_central.h" | 37 #include "data_central.h" |
38 #include "simulation.h" | 38 #include "simulation.h" |
39 #include "configuration.h" | 39 #include "configuration.h" |
40 | |
40 | 41 |
41 /* Exported functions --------------------------------------------------------*/ | 42 /* Exported functions --------------------------------------------------------*/ |
42 | 43 |
43 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | 44 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) |
44 { | 45 { |
166 if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback) | 167 if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback) |
167 text[textPointer++] = '\005'; | 168 text[textPointer++] = '\005'; |
168 else | 169 else |
169 text[textPointer++] = '\006'; | 170 text[textPointer++] = '\006'; |
170 | 171 |
171 if (!canDoFallback) { | 172 if (!canDoFallback) |
173 { | |
172 text[textPointer++] = '\020'; | 174 text[textPointer++] = '\020'; |
173 disableLine(StMXTRA_O2_Fallback); | 175 disableLine(StMXTRA_O2_Fallback); |
174 } else { | 176 } else |
177 { | |
175 enableLine(StMXTRA_O2_Fallback); | 178 enableLine(StMXTRA_O2_Fallback); |
176 } | 179 } |
177 strcpy(&text[textPointer],"\n\r"); | 180 strcpy(&text[textPointer],"\n\r"); |
178 textPointer += 2; | 181 textPointer += 2; |
179 } | 182 } |
206 } | 209 } |
207 strcpy(&text[textPointer],"\n\r"); | 210 strcpy(&text[textPointer],"\n\r"); |
208 textPointer += 2; | 211 textPointer += 2; |
209 } | 212 } |
210 #endif | 213 #endif |
211 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL)) | 214 if((line == 0) || (line == 5)) |
212 { | 215 { |
213 if((line == 0) || (line == 5)) | 216 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL)) |
214 { | 217 { |
215 textPointer += snprintf(&text[textPointer], 60,\ | 218 textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PreDive); |
216 "%c" | |
217 ,TXT_PreDive); | |
218 } | 219 } |
220 else | |
221 { | |
222 text[textPointer++] = '\031'; /* change text color */ | |
223 textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PreDive); | |
224 text[textPointer++] = '\020'; /* restore text color */ | |
225 disableLine(StMXTRA_Predive_Check); | |
226 } | |
227 strcpy(&text[textPointer],"\n\r"); | |
228 textPointer += 2; | |
219 } | 229 } |
220 } | 230 } |
221 return StMXTRA; | 231 return StMXTRA; |
222 } | 232 } |
223 | 233 |
234 void tMXtra_checkLineStatus(void) | |
235 { | |
236 uint8_t localLineMask = 0; | |
237 uint8_t lineMask = getLineMask(StMXTRA); | |
238 SSettings *pSettings = settingsGetPointer(); | |
239 | |
240 if(pSettings->CCR_Mode != CCRMODE_Sensors) | |
241 { | |
242 localLineMask |= 1 << 2; | |
243 } | |
244 if(pSettings->dive_mode != DIVEMODE_PSCR) | |
245 { | |
246 localLineMask |= 1 << 4; | |
247 } | |
248 if((pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) && (pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_DIGITAL)) | |
249 { | |
250 localLineMask |= 1 << 5; | |
251 } | |
252 | |
253 if(lineMask != localLineMask) | |
254 { | |
255 updateMenu(); | |
256 } | |
257 } | |
258 |