@@ -39,13 +39,13 @@ class Module : public Printable {
3939 if (address == 0xFF ) {
4040 address = discover () / 2 ; // divide by 2 to match address in fw main.c
4141 }
42- return (address != 0xFF );
42+ return (address < 0x7F );
4343 }
4444 virtual uint8_t discover () {
4545 return 0xFF ;
4646 }
4747 operator bool () {
48- return address != 0xFF ;
48+ return address < 0x7F ;
4949 }
5050 static HardwareI2C* getWire () {
5151 return Modulino._wire ;
@@ -133,6 +133,7 @@ class ModulinoButtons : public Module {
133133 return match[i];
134134 }
135135 }
136+ return 0xFF ;
136137 }
137138private:
138139 bool last_status[3 ];
@@ -161,6 +162,7 @@ class ModulinoBuzzer : public Module {
161162 return match[i];
162163 }
163164 }
165+ return 0xFF ;
164166 }
165167protected:
166168 std::vector<uint8_t > match = { 0x3C }; // same as fw main.c
@@ -207,6 +209,7 @@ class ModulinoPixels : public Module {
207209 return match[i];
208210 }
209211 }
212+ return 0xFF ;
210213 }
211214private:
212215 static const int NUMLEDS = 8 ;
@@ -263,6 +266,7 @@ class ModulinoKnob : public Module {
263266 return match[i];
264267 }
265268 }
269+ return 0xFF ;
266270 }
267271private:
268272 bool _pressed = false ;
@@ -379,6 +383,11 @@ class ModulinoLight : public Module {
379383class ModulinoDistance : public Module {
380384public:
381385 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+ }
382391 tof_sensor = new VL53L4CD ((TwoWire*)getWire (), -1 );
383392 auto ret = tof_sensor->InitSensor ();
384393 if (ret == VL53L4CD_ERROR_NONE) {
0 commit comments