I2C usermods: make sure that no Wire-begin(-1, -1) sneaks through

This commit is contained in:
Frank
2022-12-17 21:42:16 +01:00
parent dae6de76f1
commit 2c9cde4096
3 changed files with 3 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ public:
if (!pinManager.allocateMultiplePins(pins, 2, po)) return;
#if defined(ARDUINO_ARCH_ESP32)
if (pins[1].pin < 0 || pins[0].pin < 0) { sensorFound=false; return; } //WLEDMM bugfix - ensure that "final" GPIO are valid and no "-1" sneaks trough
Wire.begin(pins[1].pin, pins[0].pin); // WLEDMM this might silently fail, which is OK as it just means that I2C bus is already running.
#else
Wire.begin(); // WLEDMM - i2c pins on 8266 are fixed.