From 420ca94f41bf20a3ec740592c4ee226e8571b318 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 3 Sep 2025 13:33:56 +0200 Subject: [PATCH 1/2] Diag: call diagRequest() on wokeup from rtc --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 1126967..f64572e 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -1909,8 +1909,17 @@ int ATBDeviceControllerPlugin::init_sc_dbus() void ATBDeviceControllerPlugin::onWokeUp(uchar source) { - if (source == 0x01 || source == 0xFE) { - // woke up from device controller + /* PTU5 wakeup sources: + * 0x01 - on wakeup from DeviceController + * 0x02 - on wakeup from WakeupButton + * 0x03 - on wakeup from ResetKey + * 0x04 - on wakeup from rtc + * 0xFE - signal emitted by timer (on mains powered machines) + * 0xFF - unknown wakeup source + */ + + if (source == 0x01 || source == 0x03 || source == 0xFE) { + // woke up from device controller, rtc or timer hw->dc_autoRequest(true); this->diag->diagRequest(); } From 26c2120743f9fc94218e3166b14c71441c9c944c Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 3 Sep 2025 13:33:56 +0200 Subject: [PATCH 2/2] Diag: improve E255 handling: - allways run through finishDiag() method - on finishing diag: only remove elements in previousMachineEventSet if data is valid --- src/ATBAPP/DeviceControllerDiag.cpp | 45 ++++++++++++++++------------- src/ATBAPP/DeviceControllerDiag.h | 2 +- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index 70658fb..e90e434 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -113,8 +113,8 @@ void DeviceControllerDiag::private_startDiag() qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!"; DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); if (!this->previousMachineEventSet.contains(E255Event)) { - machineEventSet.insert(E255Event); - private_sendDiagEvent(E255Event, DeviceController::Action::SET); + this->private_setDiagEvent(DeviceController::State::E255); + this->private_sendDiagEvent(E255Event, DeviceController::Action::SET); } if (this->E255counter > 5) { this->restartCArun(); @@ -132,9 +132,9 @@ void DeviceControllerDiag::private_startDiag() * - diag is called again in ModeOOO wokeup() */ } - this->diagRequestTimeoutTimer->stop(); - this->isRequestRunning = false; - this->flagInterruptDiag = false; + + this->private_finishDiag(false); + return; } @@ -178,15 +178,16 @@ void DeviceControllerDiag::sys_superviseSystem() // send DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); if (!this->previousMachineEventSet.contains(E255Event)) { - machineEventSet.insert(E255Event); - private_sendDiagEvent(E255Event, DeviceController::Action::SET); + this->private_setDiagEvent(DeviceController::State::E255); + this->private_sendDiagEvent(E255Event, DeviceController::Action::SET); } if (this->E255counter > 5) { this->restartCArun(); } else { this->E255counter++; } + QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); - this->diagRequestTimeoutTimer->stop(); - this->isRequestRunning = false; - this->flagInterruptDiag = false; + + this->private_finishDiag(false); + return; } @@ -196,16 +197,14 @@ void DeviceControllerDiag::sys_superviseSystem() qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!"; hw->dc_autoRequest(true); - DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254); - previousMachineEventSet.insert(E255Event); - private_sendDiagEvent(E255Event, DeviceController::Action::SET); + DCMachineEvent M0254Event = DCMachineEvent(DeviceController::State::M0254); + this->private_setDiagEvent(DeviceController::State::M0254); + this->private_sendDiagEvent(M0254Event, DeviceController::Action::SET); if (this->E255counter > 5) { this->restartCArun(); } else { this->E255counter++; } QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); - this->diagRequestTimeoutTimer->stop(); - this->isRequestRunning = false; - this->flagInterruptDiag = false; + this->private_finishDiag(false); return; } @@ -477,7 +476,7 @@ void DeviceControllerDiag::sub_componentAssessment() // finish diag - this->private_finishDiag(); + this->private_finishDiag(true); } /** @@ -486,14 +485,20 @@ void DeviceControllerDiag::sub_componentAssessment() * Single point to finish a diag process: * - */ -void DeviceControllerDiag::private_finishDiag() +void DeviceControllerDiag::private_finishDiag(bool dataValid) { this->diagRequestTimeoutTimer->stop(); this->isRequestRunning = false; this->flagInterruptDiag = false; - this->previousMachineEventSet.unite(machineEventSet); // add new elements from machineEventSet - this->previousMachineEventSet.intersect(machineEventSet); // remove elements not in machineEventSet + // add new elements from machineEventSet + this->previousMachineEventSet.unite(machineEventSet); + + if (dataValid) { + // remove elements not in machineEventSet + // ... only if data is valid + this->previousMachineEventSet.intersect(machineEventSet); + } if (this->isDiagBackgroundTask) { this->isDiagBackgroundTask = false; diff --git a/src/ATBAPP/DeviceControllerDiag.h b/src/ATBAPP/DeviceControllerDiag.h index a228960..a46224d 100644 --- a/src/ATBAPP/DeviceControllerDiag.h +++ b/src/ATBAPP/DeviceControllerDiag.h @@ -170,7 +170,7 @@ private slots: void private_setDiagEvent(DeviceController::State result); void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action); - void private_finishDiag(); + void private_finishDiag(bool dataValid = false); void sys_superviseSystem();