Skip to content

Commit 6b3996a

Browse files
committed
track addresses
1 parent e0bb91f commit 6b3996a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,15 @@ WipperSnapper_Component_I2C::scanAddresses() {
154154

155155
// Scan all I2C addresses between 0x08 and 0x7F inclusive and return a list of
156156
// those that respond.
157-
WS_DEBUG_PRINTLN("EXEC: I2C Scan");
157+
WS_DEBUG_PRINTLN("[i2c]: Scanning I2C Bus for Devices...");
158158
for (uint8_t address = 1; address < 127; ++address) {
159+
WS_DEBUG_PRINT("[i2c] Scanning Address: 0x");
160+
WS_DEBUG_PRINTLN(address, HEX);
159161
_i2c->beginTransmission(address);
160162
uint8_t endTransmissionRC = _i2c->endTransmission();
161163

162164
if (endTransmissionRC == 0) {
163-
WS_DEBUG_PRINT("Found I2C Device at 0x");
164-
WS_DEBUG_PRINTLN(address);
165+
WS_DEBUG_PRINT("[i2c] Found Device");
165166
scanResp.addresses_found[scanResp.addresses_found_count] =
166167
(uint32_t)address;
167168
scanResp.addresses_found_count++;
@@ -208,8 +209,9 @@ WipperSnapper_Component_I2C::scanAddresses() {
208209
WS.feedWDT();
209210
#endif
210211

211-
WS_DEBUG_PRINT("I2C Devices Found: ")
212-
WS_DEBUG_PRINTLN(scanResp.addresses_found_count);
212+
WS_DEBUG_PRINT("[i2c] Scan Complete! Found: ")
213+
WS_DEBUG_PRINT(scanResp.addresses_found_count);
214+
WS_DEBUG_PRINTLN(" Devices on bus.");
213215

214216
scanResp.bus_response = wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_SUCCESS;
215217
return scanResp;

0 commit comments

Comments
 (0)