From 0bb81cea4ab2adad5e33e4140fbc5eb1546fcdb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Sat, 4 Sep 2021 17:40:36 +0200 Subject: [PATCH] Remove initial set low for output gpio --- gpio/integrationplugingpio.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gpio/integrationplugingpio.cpp b/gpio/integrationplugingpio.cpp index f77e5ce3..5f598bc3 100644 --- a/gpio/integrationplugingpio.cpp +++ b/gpio/integrationplugingpio.cpp @@ -105,12 +105,7 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring GPIO active low failed.")); } - if (!gpio->setValue(Gpio::ValueLow)) { - qCWarning(dcGpioController()) << "Could not set gpio value for thing" << thing->name(); - gpio->deleteLater(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Setting GPIO value failed.")); - } + // Note: the gpio value will be set to the previouse value in post setup m_gpioDevices.insert(gpio, thing); @@ -133,8 +128,6 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); } - - connect(monitor, &GpioMonitor::enabledChanged, thing, [this, thing](bool enabled){ if (thing->thingClassId() == gpioInputRpiThingClassId) { thing->setStateValue(gpioInputRpiPowerStateTypeId, enabled); @@ -501,7 +494,7 @@ void IntegrationPluginGpio::postSetupThing(Thing *thing) if (!gpio) return; - // Note: reset the pin to the last cached value + // Note: restore the pin value to the last cached value if (thing->thingClassId() == gpioOutputRpiThingClassId) { if (thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool()) { gpio->setValue(Gpio::ValueHigh);