@@ -39,13 +39,13 @@ class Module : public Printable {
39
39
if (address == 0xFF ) {
40
40
address = discover () / 2 ; // divide by 2 to match address in fw main.c
41
41
}
42
- return (address != 0xFF );
42
+ return (address < 0x7F );
43
43
}
44
44
virtual uint8_t discover () {
45
45
return 0xFF ;
46
46
}
47
47
operator bool () {
48
- return address != 0xFF ;
48
+ return address < 0x7F ;
49
49
}
50
50
static HardwareI2C* getWire () {
51
51
return Modulino._wire ;
@@ -133,6 +133,7 @@ class ModulinoButtons : public Module {
133
133
return match[i];
134
134
}
135
135
}
136
+ return 0xFF ;
136
137
}
137
138
private:
138
139
bool last_status[3 ];
@@ -161,6 +162,7 @@ class ModulinoBuzzer : public Module {
161
162
return match[i];
162
163
}
163
164
}
165
+ return 0xFF ;
164
166
}
165
167
protected:
166
168
std::vector<uint8_t > match = { 0x3C }; // same as fw main.c
@@ -207,6 +209,7 @@ class ModulinoPixels : public Module {
207
209
return match[i];
208
210
}
209
211
}
212
+ return 0xFF ;
210
213
}
211
214
private:
212
215
static const int NUMLEDS = 8 ;
@@ -263,6 +266,7 @@ class ModulinoKnob : public Module {
263
266
return match[i];
264
267
}
265
268
}
269
+ return 0xFF ;
266
270
}
267
271
private:
268
272
bool _pressed = false ;
@@ -379,6 +383,11 @@ class ModulinoLight : public Module {
379
383
class ModulinoDistance : public Module {
380
384
public:
381
385
bool begin () {
386
+ // try scanning for 0x29 since the library contains a while(true) on begin()
387
+ getWire ()->beginTransmission (0x29 );
388
+ if (getWire ()->endTransmission () != 0 ) {
389
+ return false ;
390
+ }
382
391
tof_sensor = new VL53L4CD ((TwoWire*)getWire (), -1 );
383
392
auto ret = tof_sensor->InitSensor ();
384
393
if (ret == VL53L4CD_ERROR_NONE) {
0 commit comments