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 {
114114 */
115115 bool processTemperatureEvent (sensors_event_t *tempEvent) {
116116 if (!_ds2484->OneWireReset ()) {
117+ WS_DEBUG_PRINTLN (" Failed to do a OneWire bus reset" );
117118 return false ;
118119 }
119120 if (!_ds2484->presencePulseDetected ()) {
@@ -131,7 +132,11 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
131132 delay (750 ); // Wait for conversion (750ms for maximum precision)
132133
133134 // 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+ }
135140 _ds2484->OneWireWriteByte (DS18B20_CMD_MATCH_ROM); // Match ROM command
136141 for (int i = 0 ; i < 8 ; i++) {
137142 _ds2484->OneWireWriteByte (_rom[i]);
@@ -140,7 +145,7 @@ class WipperSnapper_I2C_Driver_DS2484 : public WipperSnapper_I2C_Driver {
140145 DS18B20_CMD_READ_SCRATCHPAD); // Read Scratchpad command
141146
142147 uint8_t data[9 ];
143- for (int i = 0 ; i < 9 ; i++) {
148+ for (int i = 0 ; i < sizeof (data) / sizeof (data[ 0 ]) ; i++) {
144149 _ds2484->OneWireReadByte (&data[i]);
145150 }
146151
You can’t perform that action at this time.
0 commit comments