From b7034d321327d92b31bf7219d33739f89ce4119c Mon Sep 17 00:00:00 2001 From: ezcGman Date: Sun, 18 Dec 2022 21:33:25 +0100 Subject: [PATCH] UM SHT: Check for IOs gt zero --- usermods/sht/usermod_sht.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usermods/sht/usermod_sht.h b/usermods/sht/usermod_sht.h index effe44c7d..42b22a79e 100644 --- a/usermods/sht/usermod_sht.h +++ b/usermods/sht/usermod_sht.h @@ -245,7 +245,8 @@ void ShtUsermod::setup() { if (enabled) { PinManagerPinType pins[2] = { { i2c_sda, true }, { i2c_scl, true } }; - if (!pinManager.allocateMultiplePins(pins, 2, PinOwner::HW_I2C)) { + // GPIOs can be set to -1 and allocateMultiplePins() will return true, so check they're gt zero + if (i2c_sda < 0 || i2c_scl < 0 || !pinManager.allocateMultiplePins(pins, 2, PinOwner::HW_I2C)) { DEBUG_PRINTF("[%s] SHT pin allocation failed!\n", _name); cleanup(); return;