stop crashing when ETH used and Analog Sensor is pin 21/SDA or 22/SCC (I2C conflict). Show when its a bad GPIO in log.

This commit is contained in:
proddy
2024-06-27 14:52:48 +02:00
parent 320035fd72
commit 139d32c431
2 changed files with 22 additions and 6 deletions

View File

@@ -440,6 +440,11 @@ bool System::is_valid_gpio(uint8_t pin, bool has_psram) {
#endif
return false; // bad pin
}
// extra check for pins 21 and 22 (I2C) when ethernet is enabled
if ((EMSESP::system_.ethernet_connected()) && (pin >= 21 && pin <= 22)) {
return false; // bad pin
}
return true;
}