File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
114
114
*/
115
115
bool processTemperatureEvent (sensors_event_t *tempEvent) {
116
116
if (!_ds2484->OneWireReset ()) {
117
+ WS_DEBUG_PRINTLN (" Failed to do a OneWire bus reset" );
117
118
return false ;
118
119
}
119
120
if (!_ds2484->presencePulseDetected ()) {
@@ -131,7 +132,11 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
131
132
delay (750 ); // Wait for conversion (750ms for maximum precision)
132
133
133
134
// Read scratchpad
134
- _ds2484->OneWireReset ();
135
+ if (!_ds2484->OneWireReset ()) {
136
+ WS_DEBUG_PRINTLN (
137
+ " Failed to do a OneWire bus reset after starting temp conversion" );
138
+ return false ;
139
+ }
135
140
_ds2484->OneWireWriteByte (DS18B20_CMD_MATCH_ROM); // Match ROM command
136
141
for (int i = 0 ; i < 8 ; i++) {
137
142
_ds2484->OneWireWriteByte (_rom[i]);
@@ -140,7 +145,7 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
140
145
DS18B20_CMD_READ_SCRATCHPAD); // Read Scratchpad command
141
146
142
147
uint8_t data[9 ];
143
- for (int i = 0 ; i < 9 ; i++) {
148
+ for (int i = 0 ; i < sizeof (data) / sizeof (data[ 0 ]) ; i++) {
144
149
_ds2484->OneWireReadByte (&data[i]);
145
150
}
146
151
You can’t perform that action at this time.
0 commit comments