Skip to content

Commit

Permalink
return true in a readable way for HDC302x
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Sep 24, 2024
1 parent e120688 commit 2a0564b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_HDC302X.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ class WipperSnapper_I2C_Driver_HDC302X : public WipperSnapper_I2C_Driver {
WS_DEBUG_PRINTLN(F("Device Reset Detected"));
return false;
}

if (status & 0x0001) {
WS_DEBUG_PRINTLN(
F("Checksum Verification Fail (incorrect checksum received)"));
return false;
}

if (!_hdc302x->readTemperatureHumidityOnDemand(_temp, _humidity,
TRIGGERMODE_LP0)) {
WS_DEBUG_PRINTLN(F("Failed to read temperature and humidity."));
Expand All @@ -99,7 +101,8 @@ class WipperSnapper_I2C_Driver_HDC302X : public WipperSnapper_I2C_Driver {
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
if (readSensorData() == false)
return false;
return tempEvent->temperature = _temp;
tempEvent->temperature = _temp;
return true;
}

/*******************************************************************************/
Expand All @@ -114,7 +117,8 @@ class WipperSnapper_I2C_Driver_HDC302X : public WipperSnapper_I2C_Driver {
bool getEventRelativeHumidity(sensors_event_t *humidEvent) {
if (readSensorData() == false)
return false;
return humidEvent->relative_humidity = _humidity;
humidEvent->relative_humidity = _humidity;
return true;
}

protected:
Expand Down

0 comments on commit 2a0564b

Please sign in to comment.