mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
standardizing is_valid_gpio
This commit is contained in:
@@ -187,8 +187,8 @@ void AnalogSensor::reload(bool get_nvs) {
|
||||
for (auto & sensor : sensors_) {
|
||||
sensor.ha_registered = false; // force HA configs to be re-created
|
||||
|
||||
// first check if the GPIO is valid. If not, force set it to disabled
|
||||
if (!System::is_valid_gpio(sensor.gpio())) {
|
||||
// first check if the GPIO is valid. If not, force set the sensor to disabled, but don't remove it
|
||||
if (!EMSESP::system_.is_valid_gpio(sensor.gpio())) {
|
||||
LOG_WARNING("Bad GPIO %d for Sensor %s. Disabling.", sensor.gpio(), sensor.name().c_str());
|
||||
sensor.set_type(AnalogType::NOTUSED); // set disabled
|
||||
continue; // skip this loop pass
|
||||
@@ -542,7 +542,7 @@ bool AnalogSensor::update(uint8_t gpio, std::string & name, double offset, doubl
|
||||
|
||||
// return false if it's an invalid GPIO, an error will show in WebUI
|
||||
// and reported as an error in the log
|
||||
return System::is_valid_gpio(gpio);
|
||||
return EMSESP::system_.is_valid_gpio(gpio);
|
||||
}
|
||||
|
||||
// check to see if values have been updated
|
||||
|
||||
Reference in New Issue
Block a user