@@ -82,7 +82,6 @@ WipperSnapper_Component_I2C::WipperSnapper_Component_I2C(
82
82
} else {
83
83
_isInit = true ; // if the peripheral was configured incorrectly
84
84
}
85
- _i2c->setClock (50000 );
86
85
#elif defined(ARDUINO_ARCH_ESP8266)
87
86
_i2c = new TwoWire ();
88
87
_i2c->begin (msgInitRequest->i2c_pin_sda , msgInitRequest->i2c_pin_scl );
@@ -162,42 +161,34 @@ WipperSnapper_Component_I2C::scanAddresses() {
162
161
uint8_t endTransmissionRC = _i2c->endTransmission ();
163
162
164
163
if (endTransmissionRC == 0 ) {
165
- WS_DEBUG_PRINT (" [i2c] Found Device" );
164
+ WS_DEBUG_PRINTLN (" [i2c] Found Device! " );
166
165
scanResp.addresses_found [scanResp.addresses_found_count ] =
167
166
(uint32_t )address;
168
167
scanResp.addresses_found_count ++;
169
168
}
170
169
#if defined(ARDUINO_ARCH_ESP32)
171
170
// Check endTransmission()'s return code (Arduino-ESP32 ONLY)
172
171
else if (endTransmissionRC == 3 ) {
173
- // NOTE: The printf below is commented out for performance, this is the
174
- // default case and should typically be hit if the address is not found.
175
- WS_DEBUG_PRINTLN (" [i2c] ERROR: received NACK on transmit of data!" );
172
+ WS_DEBUG_PRINTLN (" [i2c] Did not find device: NACK on transmit of data!" );
176
173
continue ;
177
174
} else if (endTransmissionRC == 2 ) {
178
- WS_DEBUG_PRINTLN (" [i2c] ERROR: received NACK on transmit of address!" );
179
- scanResp.bus_response =
180
- wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_UNSPECIFIED;
175
+ WS_DEBUG_PRINTLN (
176
+ " [i2c] Did not find device: NACK on transmit of address!" );
181
177
continue ;
182
178
} else if (endTransmissionRC == 1 ) {
183
- WS_DEBUG_PRINTLN (" [i2c] ERROR: data too long to fit in transmit buffer!" );
184
- scanResp.bus_response =
185
- wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_UNSPECIFIED;
179
+ WS_DEBUG_PRINTLN (
180
+ " [i2c] Did not find device: data too long to fit in xmit buffer!" );
186
181
continue ;
187
182
} else if (endTransmissionRC == 4 ) {
188
- WS_DEBUG_PRINTLN (" [i2c] ERROR: Unspecified bus error occured!" );
189
- scanResp.bus_response =
190
- wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_UNSPECIFIED;
183
+ WS_DEBUG_PRINTLN (
184
+ " [i2c] Did not find device: Unspecified bus error occured!" );
191
185
continue ;
192
186
} else if (endTransmissionRC == 5 ) {
193
- WS_DEBUG_PRINTLN (" [i2c] ERROR: I2C Bus has timed out!" );
194
- scanResp.bus_response =
195
- wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_ERROR_HANG;
187
+ WS_DEBUG_PRINTLN (" [i2c] Did not find device: Bus timed out!" );
196
188
continue ;
197
189
} else {
198
- WS_DEBUG_PRINTLN (" [i2c] ERROR: An unknown bus error has occured!" );
199
- scanResp.bus_response =
200
- wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_UNSPECIFIED;
190
+ WS_DEBUG_PRINTLN (
191
+ " [i2c] Did not find device: Unknown bus error has occured!" );
201
192
continue ;
202
193
}
203
194
#endif
0 commit comments