comparison Discovery/Src/tMenuEditHardware.c @ 827:ffb1036c27c2 Evo_2_23

Moved CO2 Menu from Xtra to Hardware: The first CO2 sensor menu implementation was placed within the Xtra menu. In the new version the CO2 options may be accessed using the sensor overview menu of the Hardware page. With this change it is no longer necessary to take care for compile switches in the menus because the menu will only be shown if a CO2 sensor is detected.
author Ideenmodellierer
date Sun, 05 Nov 2023 20:19:08 +0100
parents 26ae9e8f24fd
children c3dd461ca3f9
comparison
equal deleted inserted replaced
826:a370741a743b 827:ffb1036c27c2
387 387
388 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT) != 0) 388 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT) != 0)
389 { 389 {
390 memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT); 390 memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT);
391 pSettings->ppo2sensors_deactivated = 0x0; /* deactivation will be done by openEditO2Sensor if need */ 391 pSettings->ppo2sensors_deactivated = 0x0; /* deactivation will be done by openEditO2Sensor if need */
392 392 pSettings->co2_sensor_active = 0;
393 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; 393 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
394 for(index = 0; index < 3; index++) 394 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT - 1; index++)
395 { 395 {
396 switch(pSettings->ext_sensor_map[index]) 396 switch(pSettings->ext_sensor_map[index])
397 { 397 {
398 case SENSOR_OPTIC: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC; 398 case SENSOR_OPTIC: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
399 break; 399 break;
413 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) 413 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG)
414 { 414 {
415 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_DIGITAL; 415 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_DIGITAL;
416 } 416 }
417 break; 417 break;
418 case SENSOR_CO2:
419 case SENSOR_CO2M: pSettings->co2_sensor_active = 1;
420 break;
418 #ifdef ENABLE_SENTINEL_MODE 421 #ifdef ENABLE_SENTINEL_MODE
419 case SENSOR_SENTINEL: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_SENTINEL; 422 case SENSOR_SENTINEL: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_SENTINEL;
420 break; 423 break;
421 #endif 424 #endif
422 default: 425 default:
522 strSensorId[2] = 0; 525 strSensorId[2] = 0;
523 526
524 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, strSensorId); 527 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, strSensorId);
525 } 528 }
526 529
527 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_TYPE_O2_END)) 530 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX))
528 { 531 {
529 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1); 532 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1);
530 } 533 }
531 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_TYPE_O2_END)) 534 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX))
532 { 535 {
533 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2); 536 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2);
534 } 537 }
535 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_TYPE_O2_END)) 538 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX))
536 { 539 {
537 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3); 540 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3);
538 } 541 }
539 542
540 if(get_globalState() == StMHARD3_O2_Calibrate) 543 if(get_globalState() == StMHARD3_O2_Calibrate)
568 { 571 {
569 sensorActive[index] = 1; 572 sensorActive[index] = 1;
570 } 573 }
571 } 574 }
572 575
573 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_TYPE_O2_END))) 576 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_MUX)))
574 { 577 {
575 pSettings->ppo2sensors_deactivated |= 1; 578 pSettings->ppo2sensors_deactivated |= 1;
576 } 579 }
577 else 580 else
578 { 581 {
579 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); 582 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]);
580 } 583 }
581 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_TYPE_O2_END))) 584 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_MUX)))
582 { 585 {
583 pSettings->ppo2sensors_deactivated |= 2; 586 pSettings->ppo2sensors_deactivated |= 2;
584 } 587 }
585 else 588 else
586 { 589 {
587 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); 590 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]);
588 } 591 }
589 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_TYPE_O2_END))) 592 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_MUX)))
590 { 593 {
591 pSettings->ppo2sensors_deactivated |= 4; 594 pSettings->ppo2sensors_deactivated |= 4;
592 } 595 }
593 else 596 else
594 { 597 {
625 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text); 628 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text);
626 629
627 write_field_button(StMHARD3_Sensor_Detect, 30, 800, ME_Y_LINE6, &FontT48, text); 630 write_field_button(StMHARD3_Sensor_Detect, 30, 800, ME_Y_LINE6, &FontT48, text);
628 } 631 }
629 632
630 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_TYPE_O2_END)) 633 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX))
631 { 634 {
632 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1); 635 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1);
633 } 636 }
634 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_TYPE_O2_END)) 637 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX))
635 { 638 {
636 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2); 639 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2);
637 } 640 }
638 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_TYPE_O2_END)) 641 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX))
639 { 642 {
640 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3); 643 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3);
641 } 644 }
642 645
643 if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) 646 if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)
659 662
660 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 663 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
661 { 664 {
662 const SDiveState *pStateReal = stateRealGetPointer(); 665 const SDiveState *pStateReal = stateRealGetPointer();
663 666
664 if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M) 667 if((pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_CO2M))
665 { 668 {
666 return EXIT_TO_INFO_SENSOR; 669 return EXIT_TO_INFO_SENSOR;
667 } 670 }
668 else 671 else
669 { 672 {
685 688
686 uint8_t OnAction_Sensor2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 689 uint8_t OnAction_Sensor2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
687 { 690 {
688 const SDiveState *pStateReal = stateRealGetPointer(); 691 const SDiveState *pStateReal = stateRealGetPointer();
689 692
690 if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M) 693 if((pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_CO2M))
691 { 694 {
692 return EXIT_TO_INFO_SENSOR; 695 return EXIT_TO_INFO_SENSOR;
693 } 696 }
694 else 697 else
695 { 698 {
710 713
711 uint8_t OnAction_Sensor3(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 714 uint8_t OnAction_Sensor3(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
712 { 715 {
713 const SDiveState *pStateReal = stateRealGetPointer(); 716 const SDiveState *pStateReal = stateRealGetPointer();
714 717
715 if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M) 718 if((pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_CO2M))
716 { 719 {
717 return EXIT_TO_INFO_SENSOR; 720 return EXIT_TO_INFO_SENSOR;
718 } 721 }
719 else 722 else
720 { 723 {