Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditHardware.c @ 708:7e3bf2c0cd40
Menu cleanup rebreather specific settings:
In the previous version the selection for Fix setpoint or sensor was in the deco menu and the Fallback option in the hardware menu. As they have a dependency and are only relevant for rebreather operation, they have been moved into the extra menu which is containing rebreather related data and which is only visible in rebreather mode.
author | Ideenmodellierer |
---|---|
date | Thu, 03 Nov 2022 20:44:51 +0100 |
parents | 2f457024049b |
children | c799151670d5 |
comparison
equal
deleted
inserted
replaced
707:e81afd727993 | 708:7e3bf2c0cd40 |
---|---|
58 uint8_t OnAction_InertiaLevel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 58 uint8_t OnAction_InertiaLevel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
59 //uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 59 //uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
60 uint8_t OnAction_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 60 uint8_t OnAction_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
61 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 61 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
62 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 62 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
63 uint8_t OnAction_O2_Fallback (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
64 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 63 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
65 uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 64 uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
66 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 65 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
67 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 66 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
68 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 67 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
76 static uint8_t O2_calib_gas = 21; | 75 static uint8_t O2_calib_gas = 21; |
77 | 76 |
78 void openEdit_Hardware(uint8_t line) | 77 void openEdit_Hardware(uint8_t line) |
79 { | 78 { |
80 set_globalState_Menu_Line(line); | 79 set_globalState_Menu_Line(line); |
81 resetMenuEdit(CLUT_MenuPageHardware); | |
82 | 80 |
83 switch(line) | 81 switch(line) |
84 { | 82 { |
85 case 1: | 83 case 1: |
86 default: | 84 default: |
87 openEdit_Bluetooth(); | 85 openEdit_Bluetooth(); |
88 break; | 86 break; |
89 case 2: | 87 case 2: |
88 resetMenuEdit(CLUT_MenuPageHardware); | |
90 openEdit_Compass(); | 89 openEdit_Compass(); |
91 break; | 90 break; |
92 case 3: | 91 case 3: |
92 resetMenuEdit(CLUT_MenuPageHardware); | |
93 openEdit_O2Sensors(); | 93 openEdit_O2Sensors(); |
94 break; | 94 break; |
95 case 4: | 95 case 4: |
96 openEdit_Brightness(); | 96 openEdit_Brightness(); |
97 break; | 97 break; |
98 case 5: | 98 case 5: |
99 resetMenuEdit(CLUT_MenuPageHardware); | |
99 openEdit_ButtonSens(); | 100 openEdit_ButtonSens(); |
100 break; | 101 break; |
101 case 6: | 102 case 6: |
102 openEdit_FlipDisplay(); | 103 openEdit_FlipDisplay(); |
103 break; | 104 break; |
329 if(DataEX_external_ADC_Present()) | 330 if(DataEX_external_ADC_Present()) |
330 { | 331 { |
331 text[0] = TXT_2BYTE; | 332 text[0] = TXT_2BYTE; |
332 text[1] = TXT2BYTE_O2Interface; | 333 text[1] = TXT2BYTE_O2Interface; |
333 text[2] = 0; | 334 text[2] = 0; |
334 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text); | 335 write_label_var( 30, 340, ME_Y_LINE5, &FontT48, text); |
335 text[0] = TXT_2BYTE; | 336 text[0] = TXT_2BYTE; |
336 switch(settingsGetPointer()->ppo2sensors_source) | 337 switch(settingsGetPointer()->ppo2sensors_source) |
337 { | 338 { |
338 default: | 339 default: |
339 case O2_SENSOR_SOURCE_OPTIC: text[1] = TXT2BYTE_O2IFOptic; | 340 case O2_SENSOR_SOURCE_OPTIC: text[1] = TXT2BYTE_O2IFOptic; |
357 case O2_SENSOR_SOURCE_SENTINEL: snprintf(text, 10,"Sentinel"); | 358 case O2_SENSOR_SOURCE_SENTINEL: snprintf(text, 10,"Sentinel"); |
358 break; | 359 break; |
359 #endif | 360 #endif |
360 } | 361 } |
361 | 362 |
362 write_label_var( 400, 800, ME_Y_LINE6, &FontT48, text); | 363 write_label_var( 400, 800, ME_Y_LINE5, &FontT48, text); |
363 } | 364 } |
364 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1); | 365 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1); |
365 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2); | 366 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2); |
366 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3); | 367 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3); |
367 tMenuEdit_refresh_field(StMHARD3_O2_Fallback); | |
368 | 368 |
369 if(get_globalState() == StMHARD3_O2_Calibrate) | 369 if(get_globalState() == StMHARD3_O2_Calibrate) |
370 { | 370 { |
371 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_O2Calib,TXT2BYTE_ButtonPlus); | 371 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_O2Calib,TXT2BYTE_ButtonPlus); |
372 } | 372 } |
377 } | 377 } |
378 | 378 |
379 | 379 |
380 void openEdit_O2Sensors(void) | 380 void openEdit_O2Sensors(void) |
381 { | 381 { |
382 char text[2]; | |
383 uint8_t sensorActive[3]; | 382 uint8_t sensorActive[3]; |
384 | 383 |
385 sensorActive[0] = 1; | 384 sensorActive[0] = 1; |
386 sensorActive[1] = 1; | 385 sensorActive[1] = 1; |
387 sensorActive[2] = 1; | 386 sensorActive[2] = 1; |
406 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, "\016\016 %\017"); | 405 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, "\016\016 %\017"); |
407 | 406 |
408 write_field_toggle(StMHARD3_O2_Calibrate, 400, 800, ME_Y_LINE4, &FontT48, "", 21, 98); | 407 write_field_toggle(StMHARD3_O2_Calibrate, 400, 800, ME_Y_LINE4, &FontT48, "", 21, 98); |
409 } | 408 } |
410 | 409 |
411 text[0] = TXT_Fallback; | |
412 text[1] = 1; | |
413 | |
414 write_field_on_off(StMHARD3_O2_Fallback, 30, 500, ME_Y_LINE5, &FontT48, text, settingsGetPointer()->fallbackToFixedSetpoint); | |
415 | |
416 if(DataEX_external_ADC_Present()) | 410 if(DataEX_external_ADC_Present()) |
417 { | 411 { |
418 write_field_button(StMHARD3_O2_Source, 30, 800, ME_Y_LINE6, &FontT48, ""); | 412 write_field_button(StMHARD3_O2_Source, 30, 800, ME_Y_LINE5, &FontT48, ""); |
419 } | 413 } |
420 | 414 |
421 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1); | 415 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1); |
422 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2); | 416 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2); |
423 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3); | 417 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3); |
427 #endif | 421 #endif |
428 ) | 422 ) |
429 { | 423 { |
430 setEvent(StMHARD3_O2_Calibrate, (uint32_t)OnAction_O2_Calibrate); | 424 setEvent(StMHARD3_O2_Calibrate, (uint32_t)OnAction_O2_Calibrate); |
431 } | 425 } |
432 setEvent(StMHARD3_O2_Fallback, (uint32_t)OnAction_O2_Fallback); | 426 |
433 if(DataEX_external_ADC_Present()) | 427 if(DataEX_external_ADC_Present()) |
434 { | 428 { |
435 setEvent(StMHARD3_O2_Source, (uint32_t)OnAction_O2_Source); | 429 setEvent(StMHARD3_O2_Source, (uint32_t)OnAction_O2_Source); |
436 } | 430 } |
437 | 431 |
488 | 482 |
489 return UPDATE_DIVESETTINGS; | 483 return UPDATE_DIVESETTINGS; |
490 } | 484 } |
491 | 485 |
492 | 486 |
493 uint8_t OnAction_O2_Fallback (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
494 { | |
495 uint8_t fallback = settingsGetPointer()->fallbackToFixedSetpoint; | |
496 | |
497 if(fallback) | |
498 fallback = 0; | |
499 else | |
500 fallback = 1; | |
501 | |
502 settingsGetPointer()->fallbackToFixedSetpoint = fallback; | |
503 tMenuEdit_set_on_off(editId, fallback); | |
504 return UPDATE_DIVESETTINGS; | |
505 } | |
506 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 487 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
507 { | 488 { |
508 uint8_t loop; | 489 uint8_t loop; |
509 const SDiveState *pStateReal = stateRealGetPointer(); | 490 const SDiveState *pStateReal = stateRealGetPointer(); |
510 SSettings* pSettings = settingsGetPointer(); | 491 SSettings* pSettings = settingsGetPointer(); |