From 2c09402bbb1977dfb8c35728f763873eedf10ded Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 14 Nov 2024 14:27:53 +0100 Subject: [PATCH] dCArun: Fix DigitalOutputAbstraction --- dCArun/CArun.cpp | 1 + dCArun/DigitalOutputAbstraction.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dCArun/CArun.cpp b/dCArun/CArun.cpp index 19e8657..d94460b 100644 --- a/dCArun/CArun.cpp +++ b/dCArun/CArun.cpp @@ -20,6 +20,7 @@ CArun::CArun(QObject *parent) this->timerChainCtrl->start(); + this->digitalOutputAbstraction = new DigitalOutputAbstraction(this->HWaccess, this); this->digitalOutputAbstraction->addCCWake("/sys/class/leds/wakeupctrl_cc/brightness"); this->digitalOutputAbstraction->addCCPower("/run/powerctrl_cc"); diff --git a/dCArun/DigitalOutputAbstraction.cpp b/dCArun/DigitalOutputAbstraction.cpp index 1635293..9b0dd80 100644 --- a/dCArun/DigitalOutputAbstraction.cpp +++ b/dCArun/DigitalOutputAbstraction.cpp @@ -18,9 +18,9 @@ DigitalOutputAbstraction::DigitalOutputAbstraction(hwinf *dc, QObject *parent) : QObject(parent) , dc(dc) { - auto fileMonitor = new QFileSystemWatcher(this); + this->fileMonitor = new QFileSystemWatcher(this); - connect(fileMonitor, &QFileSystemWatcher::fileChanged, + connect(this->fileMonitor, &QFileSystemWatcher::fileChanged, this, &DigitalOutputAbstraction::fileChanged); qCritical() << "... init DigitalOutputAbstraction"; @@ -74,7 +74,7 @@ void DigitalOutputAbstraction::fileChanged(const QString &path) { if (path == this->ccPowerPath) this->private_ccPowerChanged(); if (path == this->ccWakePath) this->private_ccWakeChanged(); - if (path == this->modemPowerPath) this->private_ccWakeChanged(); + if (path == this->modemPowerPath) this->private_modemPowerChanged(); } void DigitalOutputAbstraction::private_modemPowerChanged() @@ -87,7 +87,7 @@ void DigitalOutputAbstraction::private_modemPowerChanged() auto modemPower = modemPowerFile.readAll(); if (!modemPower.isEmpty()) { int state = modemPower.at(0); - //qCritical() << "INFO: modemPower = " << modemPower; + // qCritical() << "INFO: modemPower = " << state; switch (state) { case 0x30: // '0' qCritical() << "INFO: modemPower -> off"; @@ -126,7 +126,7 @@ void DigitalOutputAbstraction::private_ccPowerChanged() }; - //qCritical() << "INFO: modemPower = " << modemPower; + //qCritical() << "INFO: ccPower = " << state; switch (state) { case 0x30: // '0' qCritical() << "INFO: ccPower -> off";