Remove initial set low for output gpio

This commit is contained in:
Simon Stürz 2021-09-04 17:40:36 +02:00
parent 506a14ea10
commit 0bb81cea4a

View File

@ -105,12 +105,7 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info)
return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring GPIO active low failed.")); return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring GPIO active low failed."));
} }
if (!gpio->setValue(Gpio::ValueLow)) { // Note: the gpio value will be set to the previouse value in post setup
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."));
}
m_gpioDevices.insert(gpio, thing); 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.")); return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed."));
} }
connect(monitor, &GpioMonitor::enabledChanged, thing, [this, thing](bool enabled){ connect(monitor, &GpioMonitor::enabledChanged, thing, [this, thing](bool enabled){
if (thing->thingClassId() == gpioInputRpiThingClassId) { if (thing->thingClassId() == gpioInputRpiThingClassId) {
thing->setStateValue(gpioInputRpiPowerStateTypeId, enabled); thing->setStateValue(gpioInputRpiPowerStateTypeId, enabled);
@ -501,7 +494,7 @@ void IntegrationPluginGpio::postSetupThing(Thing *thing)
if (!gpio) if (!gpio)
return; 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->thingClassId() == gpioOutputRpiThingClassId) {
if (thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool()) { if (thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool()) {
gpio->setValue(Gpio::ValueHigh); gpio->setValue(Gpio::ValueHigh);