comparison Discovery/Src/tMenuEditHardware.c @ 797:acf6614dc396

Use mirror sensortype for visualization: The visualization of O2 sensor data is still based on the three slots. To make the usage of these slots more transparent and easy "mirror" sensortypes have been introduced. These types may be used within the refresh to switch the source. E.g. if only one or two slots are used for O2 values the the third may be used for CO2 data. By using the mirror the datastream does no longer need to be manipulated (copying Co2data in variables named O2xyz).
author Ideenmodellierer
date Mon, 31 Jul 2023 20:10:27 +0200
parents c31237d20491
children 1e3c12d772eb
comparison
equal deleted inserted replaced
796:75ace7af8212 797:acf6614dc396
383 uint8_t index = 0; 383 uint8_t index = 0;
384 384
385 const SDiveState *pStateReal = stateRealGetPointer(); 385 const SDiveState *pStateReal = stateRealGetPointer();
386 SSettings *pSettings = settingsGetPointer(); 386 SSettings *pSettings = settingsGetPointer();
387 387
388 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5) != 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, 5); 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
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 < 3; index++)
395 { 395 {
404 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) 404 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG)
405 { 405 {
406 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANALOG; 406 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANALOG;
407 } 407 }
408 break; 408 break;
409 case SENSOR_DIGO2: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) 409 case SENSOR_DIGO2M: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG)
410 { 410 {
411 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG; 411 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG;
412 } 412 }
413 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG) 413 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG)
414 { 414 {
452 break; 452 break;
453 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic; 453 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic;
454 break; 454 break;
455 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog; 455 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog;
456 break; 456 break;
457 case SENSOR_DIGO2: strSensorId[4] = TXT2BYTE_O2IFDigital; 457 case SENSOR_DIGO2:
458 case SENSOR_DIGO2M: strSensorId[4] = TXT2BYTE_O2IFDigital;
458 break; 459 break;
459 case SENSOR_CO2: strSensorId[3] = 'C'; 460 case SENSOR_CO2: strSensorId[3] = 'C';
460 strSensorId[4] = 'O'; 461 strSensorId[4] = 'O';
461 break; 462 break;
462 case SENSOR_SENTINEL: strSensorId[3] = 'S'; 463 case SENSOR_SENTINEL: strSensorId[3] = 'S';
653 654
654 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 655 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
655 { 656 {
656 const SDiveState *pStateReal = stateRealGetPointer(); 657 const SDiveState *pStateReal = stateRealGetPointer();
657 658
658 if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2) 659 if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M)
659 { 660 {
660 return EXIT_TO_INFO_SENSOR; 661 return EXIT_TO_INFO_SENSOR;
661 } 662 }
662 else 663 else
663 { 664 {
679 680
680 uint8_t OnAction_Sensor2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 681 uint8_t OnAction_Sensor2(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
681 { 682 {
682 const SDiveState *pStateReal = stateRealGetPointer(); 683 const SDiveState *pStateReal = stateRealGetPointer();
683 684
684 if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2) 685 if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M)
685 { 686 {
686 return EXIT_TO_INFO_SENSOR; 687 return EXIT_TO_INFO_SENSOR;
687 } 688 }
688 else 689 else
689 { 690 {
704 705
705 uint8_t OnAction_Sensor3(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 706 uint8_t OnAction_Sensor3(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
706 { 707 {
707 const SDiveState *pStateReal = stateRealGetPointer(); 708 const SDiveState *pStateReal = stateRealGetPointer();
708 709
709 if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2) 710 if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M)
710 { 711 {
711 return EXIT_TO_INFO_SENSOR; 712 return EXIT_TO_INFO_SENSOR;
712 } 713 }
713 else 714 else
714 { 715 {