Skip to content

Commit d639510

Browse files
committed
5.5.64 D HAL SHOW includes scan
1 parent a65e8fc commit d639510

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

DCCEXParser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,10 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
14321432

14331433
#if !defined(IO_NO_HAL)
14341434
case "HAL"_hk:
1435-
if (p[1] == "SHOW"_hk)
1435+
if (p[1] == "SHOW"_hk) {
1436+
I2CManager.scanForDevices(&USB_SERIAL);
14361437
IODevice::DumpAll();
1438+
}
14371439
else if (p[1] == "RESET"_hk)
14381440
IODevice::reset();
14391441
return true;

I2CManager.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,14 @@ void I2CManagerClass::begin(void) {
9898

9999
// Now initialise I2C
100100
_initialise();
101+
scanForDevices(&USB_SERIAL);
102+
}
103+
}
101104

105+
void I2CManagerClass::scanForDevices(Print* stream) {
106+
StringFormatter::send(stream, F("<* Scanning I2C bus for devices...\n"));
102107
#if defined(I2C_USE_WIRE)
103-
DIAG(F("I2CManager: Using Wire library"));
108+
StringFormatter::send(stream,F(" I2CManager: Using Wire library\n"));
104109
#endif
105110

106111
// Probe and list devices. Use standard mode
@@ -123,7 +128,7 @@ void I2CManagerClass::begin(void) {
123128
for (uint8_t addr=0x08; addr<0x78; addr++) {
124129
if (exists(addr)) {
125130
found = true;
126-
DIAG(F("I2C Device found at 0x%x, %S?"), addr, guessI2CDeviceType(addr));
131+
StringFormatter::send(stream,F(" Device found at 0x%x, %S?\n"), addr, guessI2CDeviceType(addr));
127132
}
128133
}
129134

@@ -148,7 +153,7 @@ void I2CManagerClass::begin(void) {
148153
// Device responds when subbus selected but not when
149154
// subbus disabled - ergo it must be on subbus!
150155
found = true;
151-
DIAG(F("I2C Device found at {I2CMux_%d,SubBus_%d,0x%x}, %S?"),
156+
StringFormatter::send(stream,F(" Device found at {I2CMux_%d,SubBus_%d,0x%x}, %S?\n"),
152157
muxNo, subBus, addr, guessI2CDeviceType(addr));
153158
}
154159
// Re-select subbus
@@ -165,11 +170,10 @@ void I2CManagerClass::begin(void) {
165170
}
166171
}
167172
#endif
168-
if (!found) DIAG(F("No I2C Devices found"));
173+
StringFormatter::send(stream,found?F("*>\n"):F(" No I2C Devices found\n*>\n"));
169174
_setClock(_clockSpeed);
170175
setTimeout(originalTimeout); // set timeout back to original
171176
}
172-
}
173177

174178
// Set clock speed to the lowest requested one. If none requested,
175179
// the Wire default is 100kHz.

I2CManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ class I2CManagerClass {
470470
// need to be printed using FSH.
471471
static const FSH *getErrorMessage(uint8_t status);
472472

473+
void scanForDevices(Print * stream);
474+
473475
private:
474476
bool _beginCompleted = false;
475477
bool _clockSpeedFixed = false;

version.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
#include "StringFormatter.h"
55

6-
#define VERSION "5.5.63"
6+
#define VERSION "5.5.64"
7+
// 5.5.64 - I2C scan included in <D HAL SHOW>
78
// 5.5.63 - Bugfix: EXRAIL IFLOCO did not handle -1 (loco not found)
89
// 5.5.62 - EXRAIL IFLOCO(list)
910
// - NEOPIXEL automatic WHITE(if available) when red=green=blue

0 commit comments

Comments
 (0)