Skip to content

Commit

Permalink
Insitu/Keller stage gauge per sensor error #180
Browse files Browse the repository at this point in the history
  • Loading branch information
neilh20 authored and neilh20 committed Dec 6, 2024
1 parent 56ec2c5 commit faa6a2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions src/sensors/InsituParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ bool InsituParent::addSingleMeasurementResult(void) {
bool success = false;

// Initialize float variables
float waterPressureBar = -9999;
float waterTempertureC = -9999;
float waterDepthM = -9999;


float waterPressureBar = SNSRDEF_IP_WATERPRESSUREBAR;
float waterTempertureC = SNSRDEF_IP_WATERTEMPERATUREC;
float waterDepthM = SNSRDEF_IP_WATERDEPTHM;
float waterPressure_mBar = -9999;

// Check a measurement was *successfully* started (status bit 6 set)
Expand All @@ -149,12 +151,12 @@ bool InsituParent::addSingleMeasurementResult(void) {
// float waterTempertureC)

// Fix not-a-number values
if (!success || isnan(waterPressureBar)) waterPressureBar = -9999;
if (!success || isnan(waterTempertureC)) waterTempertureC = -9999;
if (!success || isnan(waterDepthM)) waterDepthM = -9999;
if (!success || isnan(waterPressureBar)) waterPressureBar = SNSRDEF_IP_WATERPRESSUREBAR ;
if (!success || isnan(waterTempertureC)) waterTempertureC = SNSRDEF_IP_WATERTEMPERATUREC;
if (!success || isnan(waterDepthM)) waterDepthM = SNSRDEF_IP_WATERDEPTHM;

// For waterPressureBar, convert bar to millibar
if (waterPressureBar != -9999)
if (waterPressureBar != SNSRDEF_IP_WATERPRESSUREBAR )
waterPressure_mBar = 1000 * waterPressureBar;

MS_DBG(F(" Pressure_mbar:"), waterPressure_mBar);
Expand Down
14 changes: 7 additions & 7 deletions src/sensors/KellerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ bool KellerParent::addSingleMeasurementResult(void) {
bool success = false;

// Initialize float variables
float waterPressureBar = -9999;
float waterTempertureC = -9999;
float waterDepthM = -9999;
float waterPressureBar = SNSRDEF_KP_WATERPRESSUREBAR;
float waterTempertureC = SNSRDEF_KP_WATERTEMPERATUREC ;
float waterDepthM = SNSRDEF_KP_WATERDEPTHM;
float waterPressure_mBar = -9999;

// Check a measurement was *successfully* started (status bit 6 set)
Expand All @@ -155,12 +155,12 @@ bool KellerParent::addSingleMeasurementResult(void) {
// float waterTempertureC)

// Fix not-a-number values
if (!success || isnan(waterPressureBar)) waterPressureBar = -9999;
if (!success || isnan(waterTempertureC)) waterTempertureC = -9999;
if (!success || isnan(waterDepthM)) waterDepthM = -9999;
if (!success || isnan(waterPressureBar)) waterPressureBar = SNSRDEF_KP_WATERPRESSUREBAR;
if (!success || isnan(waterTempertureC)) waterTempertureC = SNSRDEF_KP_WATERTEMPERATUREC;
if (!success || isnan(waterDepthM)) waterDepthM = SNSRDEF_KP_WATERDEPTHM;

// For waterPressureBar, convert bar to millibar
if (waterPressureBar != -9999)
if (waterPressureBar != SNSRDEF_KP_WATERPRESSUREBAR)
waterPressure_mBar = 1000 * waterPressureBar;

MS_DBG(F(" Pressure_mbar:"), waterPressure_mBar);
Expand Down

0 comments on commit faa6a2c

Please sign in to comment.