Skip to content

Commit 322c72e

Browse files
committed
remove setclock call
1 parent 6b3996a commit 322c72e

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ WipperSnapper_Component_I2C::WipperSnapper_Component_I2C(
8282
} else {
8383
_isInit = true; // if the peripheral was configured incorrectly
8484
}
85-
_i2c->setClock(50000);
8685
#elif defined(ARDUINO_ARCH_ESP8266)
8786
_i2c = new TwoWire();
8887
_i2c->begin(msgInitRequest->i2c_pin_sda, msgInitRequest->i2c_pin_scl);
@@ -162,42 +161,34 @@ WipperSnapper_Component_I2C::scanAddresses() {
162161
uint8_t endTransmissionRC = _i2c->endTransmission();
163162

164163
if (endTransmissionRC == 0) {
165-
WS_DEBUG_PRINT("[i2c] Found Device");
164+
WS_DEBUG_PRINTLN("[i2c] Found Device!");
166165
scanResp.addresses_found[scanResp.addresses_found_count] =
167166
(uint32_t)address;
168167
scanResp.addresses_found_count++;
169168
}
170169
#if defined(ARDUINO_ARCH_ESP32)
171170
// Check endTransmission()'s return code (Arduino-ESP32 ONLY)
172171
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!");
176173
continue;
177174
} 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!");
181177
continue;
182178
} 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!");
186181
continue;
187182
} 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!");
191185
continue;
192186
} 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!");
196188
continue;
197189
} 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!");
201192
continue;
202193
}
203194
#endif

0 commit comments

Comments
 (0)