diff --git a/IODevice.cpp b/IODevice.cpp index f76bbb0..3b6094b 100644 --- a/IODevice.cpp +++ b/IODevice.cpp @@ -294,7 +294,7 @@ bool IODevice::checkNoOverlap(VPIN firstPin, uint8_t nPins, uint8_t i2cAddress) } // Check for overlapping I2C address - if (dev->_matchI2CAddress(i2cAddress)) { + if (i2cAddress && dev->_I2CAddress==i2cAddress) { DIAG(F("WARNING HAL Overlap. i2c Addr 0x%x ignored."),i2cAddress); return false; } @@ -302,9 +302,6 @@ bool IODevice::checkNoOverlap(VPIN firstPin, uint8_t nPins, uint8_t i2cAddress) return true; // no overlaps... OK to go on with constructor } -bool IODevice::_matchI2CAddress(uint8_t i2cAddress) { - return (i2cAddress && i2cAddress==_I2CAddress); - } //================================================================================================================== // Static data diff --git a/IODevice.h b/IODevice.h index 07a632a..8b786c4 100644 --- a/IODevice.h +++ b/IODevice.h @@ -228,9 +228,6 @@ protected: // Pin number of interrupt pin for GPIO extender devices. The extender module will pull this // pin low if an input changes state. int16_t _gpioInterruptPin = -1; - - // non-i2c hal drivers return false, i2c drivers override this in IO_GPIOBase - bool _matchI2CAddress(uint8_t i2cAddress); // Method to check if pins will overlap before creating new device. static bool checkNoOverlap(VPIN firstPin, uint8_t nPins=1, uint8_t i2cAddress=0); diff --git a/IO_HCSR04.h b/IO_HCSR04.h index 5b9b169..d56dda3 100644 --- a/IO_HCSR04.h +++ b/IO_HCSR04.h @@ -76,7 +76,7 @@ public: // Static create function provides alternative way to create object static void create(VPIN vpin, int trigPin, int echoPin, uint16_t onThreshold, uint16_t offThreshold) { - if (checkNoOverlap(vpin) && checkNoOverlap(trigPin) && checkNoOverlap(echoPin)) + if (checkNoOverlap(vpin)) new HCSR04(vpin, trigPin, echoPin, onThreshold, offThreshold); }