small change: 4LD bugfix
Initially i2c_sda and i2c_scl are set to "-1" in wled.h. This can cause a bootloop when trying to initialize I2C with pins (-1, -1). This fix ensures that usermod initialization will fail when SDA=-1 or SCL=-1.
This commit is contained in:
@@ -175,7 +175,9 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
if (!pinManager.allocateMultiplePins(pins, 5, po)) { type=NONE; return; }
|
||||
} else {
|
||||
isHW = (ioPin[0]==i2c_scl && ioPin[1]==i2c_sda);
|
||||
//isHW = true;
|
||||
if (isHW) po = PinOwner::HW_I2C; // allow multiple allocations of HW I2C bus pins
|
||||
if (ioPin[0] < 0 || ioPin[1] < 0) { type=NONE; return; } //WLEDSR bugfix - ensure that "final" GPIO are valid
|
||||
PinManagerPinType pins[2] = { { ioPin[0], true }, { ioPin[1], true } };
|
||||
if (!pinManager.allocateMultiplePins(pins, 2, po)) { type=NONE; return; }
|
||||
}
|
||||
|
||||
@@ -336,8 +336,10 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
ioPin[1] = hw_sda;
|
||||
}
|
||||
isHW = (ioPin[0]==hw_scl && ioPin[1]==hw_sda);
|
||||
// isHW = true;
|
||||
if (isHW) po = PinOwner::HW_I2C; // allow multiple allocations of HW I2C bus pins
|
||||
PinManagerPinType pins[2] = { {ioPin[0], true }, { ioPin[1], true } };
|
||||
if (ioPin[0] < 0 || ioPin[1] < 0) { type=NONE; return; } //WLEDSR bugfix - ensure that "final" GPIO are valid
|
||||
if (!pinManager.allocateMultiplePins(pins, 2, po)) { type=NONE; return; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user