Skip to content

Commit

Permalink
DS2484: resolve feedback + failure messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Jul 23, 2024
1 parent c0acc94 commit 80326ce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_DS2484.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
*/
bool processTemperatureEvent(sensors_event_t *tempEvent) {
if (!_ds2484->OneWireReset()) {
WS_DEBUG_PRINTLN("Failed to do a OneWire bus reset");
return false;
}
if (!_ds2484->presencePulseDetected()) {
Expand All @@ -131,7 +132,11 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
delay(750); // Wait for conversion (750ms for maximum precision)

// Read scratchpad
_ds2484->OneWireReset();
if (!_ds2484->OneWireReset()) {
WS_DEBUG_PRINTLN(
"Failed to do a OneWire bus reset after starting temp conversion");
return false;
}
_ds2484->OneWireWriteByte(DS18B20_CMD_MATCH_ROM); // Match ROM command
for (int i = 0; i < 8; i++) {
_ds2484->OneWireWriteByte(_rom[i]);
Expand All @@ -140,7 +145,7 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
DS18B20_CMD_READ_SCRATCHPAD); // Read Scratchpad command

uint8_t data[9];
for (int i = 0; i < 9; i++) {
for (int i = 0; i < sizeof(data) / sizeof(data[0]); i++) {
_ds2484->OneWireReadByte(&data[i]);
}

Expand Down

0 comments on commit 80326ce

Please sign in to comment.