Merge PR #509: Update to libnymea-gpio changes

master
Jenkins nymea 2021-12-15 11:53:15 +01:00
commit 886cc109da
2 changed files with 7 additions and 7 deletions

2
debian/control vendored
View File

@ -6,7 +6,7 @@ Build-depends: libboblight-dev,
debhelper (>= 0.0.0),
libnymea-dev (>= 0.26~),
libnymea-mqtt-dev,
libnymea-gpio-dev (>= 1.0.4~),
libnymea-gpio-dev (>= 1.0.5~),
libnymea-zigbee-dev,
libqt5serialport5-dev,
libqt5websockets5-dev,

View File

@ -237,15 +237,15 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info)
// Gpio input
if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) {
GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this);
monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool());
if (!monitor->enable()) {
bool activeLow = thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool();
if (!monitor->enable(activeLow)) {
qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name();
//: Error setting up GPIO thing
monitor->deleteLater();
return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed."));
}
connect(monitor, &GpioMonitor::interruptOccurred, thing, [thing](bool value){
connect(monitor, &GpioMonitor::valueChanged, thing, [thing](bool value){
if (thing->thingClassId() == gpioInputRpiThingClassId) {
thing->setStateValue(gpioInputRpiPowerStateTypeId, value);
} else if (thing->thingClassId() == gpioInputBbbThingClassId) {
@ -267,15 +267,15 @@ void IntegrationPluginGpio::setupThing(ThingSetupInfo *info)
// Counter
if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) {
GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this);
monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool());
if (!monitor->enable()) {
bool activeLow = thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool();
if (!monitor->enable(activeLow)) {
qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name();
monitor->deleteLater();
//: Error setting up GPIO thing
return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed."));
}
connect(monitor, &GpioMonitor::interruptOccurred, thing, [this, thing](bool value){
connect(monitor, &GpioMonitor::valueChanged, thing, [this, thing](bool value){
if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) {
if (value) {
m_counterValues[thing->id()] += 1;