Fix early return in `startLowPowerPeriodicMeasurement`

In method `FrogMoreScd40::startLowPowerPeriodicMeasurement` the `return`
statement appeared before the update of the `DuringMeasurement` flag.
Thus, the class would wrongly assume not be in measurement mode and a
subsequent `stopPeriodicMeasurement` would fail. Moved the `return`
statement to after setting the flag.
This commit is contained in:
Stefan Tibus 2022-04-13 00:15:47 +02:00
parent 7a3035756e
commit 94e2c2f9da
1 changed files with 1 additions and 1 deletions

View File

@ -691,8 +691,8 @@ int FrogmoreScd40::startLowPowerPeriodicMeasurement(void)
if (DuringMeasurement) {
return (ERROR_SCD40_BUSY_MEASURING);
}
return (sendCommand(COMMAND_SCD40_START_LOW_POWER_PERIODIC_MEASUREMENT));
DuringMeasurement = 1;
return (sendCommand(COMMAND_SCD40_START_LOW_POWER_PERIODIC_MEASUREMENT));
}
int FrogmoreScd40::getDataReadyStatus(bool *pIsAvailable)