comparison Discovery/Src/tMenuEditDeco.c @ 882:608d3e918146 Evo_2_23

Added slow exit timer function: At the end of the dive the final ascent to surface should be done slowly. The new function provides a comparison of the current divers depth compared to a linear ascent simulated by the OSTC. The visualization is shown instead of the ascent speed with a little different appearance. The linear ascent is starting from the last stop depth and the time for the ascent may be configurated in the deco settings. The simulated and real peth is compared and the depth color changes based on the difference of the values. In case the diver is much below the timer depth then the timer will stop and wait for the diver to follow.
author Ideenmodellierer
date Sat, 31 Aug 2024 17:35:52 +0200
parents e81afd727993
children 24c08a80a5f7
comparison
equal deleted inserted replaced
881:5b675077ccfb 882:608d3e918146
40 /* Private function prototypes -----------------------------------------------*/ 40 /* Private function prototypes -----------------------------------------------*/
41 41
42 static void openEdit_DiveMode(void); 42 static void openEdit_DiveMode(void);
43 static void openEdit_ppO2max(void); 43 static void openEdit_ppO2max(void);
44 static void openEdit_SafetyStop(void); 44 static void openEdit_SafetyStop(void);
45 static void openEdit_ExitTime(void);
45 static void openEdit_FutureTTS(void); 46 static void openEdit_FutureTTS(void);
46 static void openEdit_Salinity(void); 47 static void openEdit_Salinity(void);
47 48
48 /* Announced function prototypes -----------------------------------------------*/ 49 /* Announced function prototypes -----------------------------------------------*/
49 static uint8_t OnAction_setMode (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 50 static uint8_t OnAction_setMode (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
50 static uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 51 static uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
51 static uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 52 static uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
52 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 53 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
54 static uint8_t OnAction_SlowExitTime (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
53 static uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 55 static uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
54 /* Exported functions --------------------------------------------------------*/ 56 /* Exported functions --------------------------------------------------------*/
55 57
56 void openEdit_Deco(uint8_t line) 58 void openEdit_Deco(uint8_t line)
57 { 59 {
71 break; 73 break;
72 case 3: 74 case 3:
73 openEdit_SafetyStop(); 75 openEdit_SafetyStop();
74 break; 76 break;
75 case 4: 77 case 4:
78 openEdit_ExitTime();
79 break;
80 case 5:
76 openEdit_FutureTTS(); 81 openEdit_FutureTTS();
77 break; 82 break;
78 case 5: 83 case 6:
79 openEdit_Salinity(); 84 openEdit_Salinity();
80 break; 85 break;
81 } 86 }
82 } 87 }
83 88
253 } 258 }
254 259
255 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); 260 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
256 261
257 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop); 262 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop);
263 startEdit();
264 }
265
266
267 static void openEdit_ExitTime(void)
268 {
269 uint32_t SlowExitTime;
270 char text[64];
271 uint16_t y_line;
272
273 SlowExitTime = settingsGetPointer()->safetystopDuration;
274
275 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
276
277 text[0] = '\001';
278 text[1] = TXT_2BYTE;
279 text[2] = TXT2BYTE_SlowExit;
280 text[3] = 0;
281 write_topline(text);
282
283 write_label_var( 20, 800, y_line, &FontT48, &text[1]);
284
285 strcpy(text,"\016\016");
286 text[2] = TXT_Minutes;
287 if(settingsGetPointer()->nonMetricalSystem)
288 {
289 sprintf(&text[3], "\017 ^ %u\016\016 ft\017", settingsGetPointer()->slowExitTime);
290 }
291 else
292 {
293 sprintf(&text[3], "\017 ^ %u\016\016 m\017", settingsGetPointer()->slowExitTime);
294 }
295 write_label_var( 410, 800, y_line, &FontT48, text);
296
297 write_field_udigit(StMDECO_SlowExit, 370, 800, y_line, &FontT48, "#", SlowExitTime, 0, 0, 0);
298 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
299
300 setEvent(StMDECO_SlowExit, (uint32_t)OnAction_SlowExitTime);
258 startEdit(); 301 startEdit();
259 } 302 }
260 303
261 304
262 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 305 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
344 return digitContentNew; 387 return digitContentNew;
345 } 388 }
346 return EXIT_TO_MENU; 389 return EXIT_TO_MENU;
347 } 390 }
348 391
392 static uint8_t OnAction_SlowExitTime (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
393 {
394 uint8_t digitContentNew;
395 uint32_t newExitTime;
396
397 if(action == ACTION_BUTTON_ENTER)
398 {
399 return digitContent;
400 }
401 if(action == ACTION_BUTTON_ENTER_FINAL)
402 {
403 evaluateNewString(editId, &newExitTime, 0, 0, 0);
404
405 settingsGetPointer()->slowExitTime = newExitTime;
406
407 tMenuEdit_newInput(editId, newExitTime, 0, 0, 0);
408 return UPDATE_AND_EXIT_TO_MENU;
409 }
410 if(action == ACTION_BUTTON_NEXT)
411 {
412 digitContentNew = digitContent + 1;
413 if(blockNumber == 0)
414 {
415 if(digitContentNew > '9')
416 digitContentNew = '0';
417 }
418
419 return digitContentNew;
420 }
421 if(action == ACTION_BUTTON_BACK)
422 {
423 digitContentNew = digitContent - 1;
424 if(blockNumber == 0)
425 {
426 if(digitContentNew < '0')
427 digitContentNew = '9';
428 }
429
430 return digitContentNew;
431 }
432 return EXIT_TO_MENU;
433 }
349 434
350 static void openEdit_Salinity(void) 435 static void openEdit_Salinity(void)
351 { 436 {
352 char text[32]; 437 char text[32];
353 uint16_t y_line; 438 uint16_t y_line;