comparison Discovery/Src/data_exchange_main.c @ 497:5757edda56b7

Added worst case plausibility check (disabled by compile switch) Just used in case of development activities which may cause negativ values resulting in errors / timeout in the deco calculation
author Ideenmodellierer
date Mon, 24 Aug 2020 19:59:28 +0200
parents c2e02b87774f
children d784f281833a
comparison
equal deleted inserted replaced
496:9623f166b0c0 497:5757edda56b7
730 730
731 ambient = d->data[d->boolPressureData].pressure_mbar / 1000.0f; 731 ambient = d->data[d->boolPressureData].pressure_mbar / 1000.0f;
732 surface = d->data[d->boolPressureData].surface_mbar / 1000.0f; 732 surface = d->data[d->boolPressureData].surface_mbar / 1000.0f;
733 density = ((float)( 100 + settingsGetPointer()->salinity)) / 100.0f; 733 density = ((float)( 100 + settingsGetPointer()->salinity)) / 100.0f;
734 734
735 #ifdef TESTBENCH
736 /* do plausibility check (typically only needed at debug hardware) */
737 if(ambient < 0)
738 {
739 ambient = 1.0;
740 }
741 if(surface < 0)
742 {
743 surface = 1.0;
744 }
745 #endif
735 ds->lifeData.pressure_ambient_bar = ambient; 746 ds->lifeData.pressure_ambient_bar = ambient;
736 ds->lifeData.pressure_surface_bar = surface; 747 ds->lifeData.pressure_surface_bar = surface;
737 depth = (ambient - surface) / (0.09807f * density); 748 depth = (ambient - surface) / (0.09807f * density);
738 ds->lifeData.bool_temp1 = d->data[d->boolPressureData].SPARE1; 749 ds->lifeData.bool_temp1 = d->data[d->boolPressureData].SPARE1;
739 750
743 static float getTemperature(SDataExchangeSlaveToMaster *d) 754 static float getTemperature(SDataExchangeSlaveToMaster *d)
744 { 755 {
745 float temp = 0; 756 float temp = 0;
746 temp = d->data[d->boolPressureData].temperature; 757 temp = d->data[d->boolPressureData].temperature;
747 758
759 #ifdef TESTBENCH
760 /* do plausibility check (typically only needed at debug hardware */
761 if(temp < -40.0)
762 {
763 temp = 20.0;
764 }
765 #endif
748 return temp; 766 return temp;
749 } 767 }
750 768
751 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag) 769 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag)
752 { 770 {