comparison Discovery/Src/tMenuXtra.c @ 981:c6c781a2e85b default

Merge into default
author heinrichsweikamp
date Tue, 11 Feb 2025 18:12:00 +0100
parents 7755a476f164
children
comparison
equal deleted inserted replaced
871:f7318457df4d 981:c6c781a2e85b
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 {
45 uint8_t textPointer = 0; 46 uint8_t textPointer = 0;
48 textPointer = 0; 49 textPointer = 0;
49 *tab = 500; 50 *tab = 500;
50 *subtext = 0; 51 *subtext = 0;
51 52
52 SSettings *pSettings = settingsGetPointer(); 53 SSettings *pSettings = settingsGetPointer();
54
55 resetLineMask(StMXTRA);
53 56
54 /* DIVE MODE */ 57 /* DIVE MODE */
55 if(actual_menu_content != MENU_SURFACE) 58 if(actual_menu_content != MENU_SURFACE)
56 { 59 {
57 if((line == 0) || (line == 1)) 60 if((line == 0) || (line == 1))
166 if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback) 169 if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback)
167 text[textPointer++] = '\005'; 170 text[textPointer++] = '\005';
168 else 171 else
169 text[textPointer++] = '\006'; 172 text[textPointer++] = '\006';
170 173
171 if (!canDoFallback) { 174 if (!canDoFallback)
175 {
172 text[textPointer++] = '\020'; 176 text[textPointer++] = '\020';
173 disableLine(StMXTRA_O2_Fallback); 177 disableLine(StMXTRA_O2_Fallback);
174 } else { 178 } else
179 {
175 enableLine(StMXTRA_O2_Fallback); 180 enableLine(StMXTRA_O2_Fallback);
176 } 181 }
177 strcpy(&text[textPointer],"\n\r"); 182 strcpy(&text[textPointer],"\n\r");
178 textPointer += 2; 183 textPointer += 2;
179 } 184 }
188 strcpy(&text[textPointer],"\n\r"); 193 strcpy(&text[textPointer],"\n\r");
189 textPointer += 2; 194 textPointer += 2;
190 } 195 }
191 196
192 #ifdef ENABLE_PSCR_MODE 197 #ifdef ENABLE_PSCR_MODE
193 if(pSettings->dive_mode == DIVEMODE_PSCR)
194 {
195 if((line == 0) || (line == 4))
196 {
197 textPointer += snprintf(&text[textPointer], 60,\
198 "%c"
199 ,TXT_PSClosedCircuit);
200 }
201 }
202 #endif
203 #ifdef ENABLE_CO2_SUPPORT
204 if((line == 0) || (line == 4)) 198 if((line == 0) || (line == 4))
205 { 199 {
206 textPointer += snprintf(&text[textPointer], 60, "%c", TXT_CO2Sensor); 200 if(pSettings->dive_mode == DIVEMODE_PSCR)
201 {
202 textPointer += snprintf(&text[textPointer], 60, "%c",TXT_PSClosedCircuit);
203 enableLine(StMXTRA_PSCR_O2_Drop);
204 }
205 else
206 {
207 text[textPointer++] = '\031'; /* change text color */
208 textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PSClosedCircuit);
209 text[textPointer++] = '\020'; /* restore text color */
210 disableLine(StMXTRA_PSCR_O2_Drop);
211 }
212 strcpy(&text[textPointer],"\n\r");
213 textPointer += 2;
207 } 214 }
215 #endif
216 #ifdef ENABLE_PREDIVE_CHECK
217 if((line == 0) || (line == 5))
218 {
219 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL))
220 {
221 textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PreDive);
222 }
223 else
224 {
225 text[textPointer++] = '\031'; /* change text color */
226 textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PreDive);
227 text[textPointer++] = '\020'; /* restore text color */
228 disableLine(StMXTRA_Predive_Check);
229 }
230 strcpy(&text[textPointer],"\n\r");
231 textPointer += 2;
232 }
208 #endif 233 #endif
209 } 234 }
210 return StMXTRA; 235 return StMXTRA;
211 } 236 }
212 237
238 void tMXtra_checkLineStatus(void)
239 {
240 uint8_t localLineMask = 0;
241 uint8_t lineMask = getLineMask(StMXTRA);
242 SSettings *pSettings = settingsGetPointer();
243
244 if(pSettings->CCR_Mode != CCRMODE_Sensors)
245 {
246 localLineMask |= 1 << 2;
247 }
248 if(pSettings->dive_mode != DIVEMODE_PSCR)
249 {
250 localLineMask |= 1 << 4;
251 }
252 if((pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) && (pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_DIGITAL))
253 {
254 localLineMask |= 1 << 5;
255 }
256
257 if(lineMask != localLineMask)
258 {
259 updateMenu();
260 }
261 }
262