don't process dallas if gpio is 0

This commit is contained in:
proddy
2021-03-28 16:27:54 +02:00
parent 22b4b66cff
commit 0c17e8deb3

View File

@@ -35,15 +35,15 @@ uuid::log::Logger DallasSensor::logger_{F_(dallassensor), uuid::log::Facility::D
void DallasSensor::start() {
reload();
#ifndef EMSESP_STANDALONE
// disabled if dallas gpio is 0
if (dallas_gpio_) {
#ifndef EMSESP_STANDALONE
bus_.begin(dallas_gpio_);
}
#endif
// API call
Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); });
}
}
// load the MQTT settings
void DallasSensor::reload() {
@@ -59,6 +59,10 @@ void DallasSensor::reload() {
}
void DallasSensor::loop() {
if (!dallas_gpio_) {
return; // dallas gpio is 0 (disabled)
}
#ifndef EMSESP_STANDALONE
uint32_t time_now = uuid::get_uptime();