From 91d8eb03b3ec876d8bbc7886a5a1978b3f98d88d Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 12 Jun 2025 10:50:29 +0200 Subject: [PATCH 1/6] Diag: clear machineEventSet on diagRequest --- src/ATBAPP/DeviceControllerDiag.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index be93ab3..94ce4c9 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -62,6 +62,7 @@ void DeviceControllerDiag::diagRequest() qCritical() << "DeviceControllerDiag::diagRequest() is already running"; return; } + this->machineEventSet.clear(); this->isRequestRunning = true; this->diagRequestTimeoutTimer->start(); From cc6dfee0e29eea2d861d4cb59fe87c3f68306201 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 12 Jun 2025 16:33:32 +0200 Subject: [PATCH 2/6] Diag: set E255 only once --- src/ATBAPP/DeviceControllerDiag.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index 94ce4c9..bc47ec4 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -113,8 +113,10 @@ void DeviceControllerDiag::private_startDiag() if (this->flagInterruptDiag) { qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!"; DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); - machineEventSet.insert(E255Event); - private_sendDiagEvent(E255Event, DeviceController::Action::SET); + if (!this->previousMachineEventSet.contains(E255Event)) { + machineEventSet.insert(E255Event); + private_sendDiagEvent(E255Event, DeviceController::Action::SET); + } if (this->E255counter > 5) { this->restartCArun(); // try it again, until success: @@ -174,8 +176,10 @@ void DeviceControllerDiag::sys_superviseSystem() qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!"; // send DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); - machineEventSet.insert(E255Event); - private_sendDiagEvent(E255Event, DeviceController::Action::SET); + if (!this->previousMachineEventSet.contains(E255Event)) { + machineEventSet.insert(E255Event); + private_sendDiagEvent(E255Event, DeviceController::Action::SET); + } if (this->E255counter > 5) { this->restartCArun(); } else { this->E255counter++; } QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); From fe3696ce9c376da5c75ccc098654467746fb06a6 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Tue, 24 Jun 2025 14:18:35 +0200 Subject: [PATCH 3/6] Diag: E255 - handle E255 in previousMachineEventSet (because machineEventSet will be cleared regularely) - do not call finishDiag() on E255 because this will interscect previous- with current machineEventSet and thus remove all Errors/ Warnings because machineEventSet was cleared and includes only E255! --- src/ATBAPP/DeviceControllerDiag.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index bc47ec4..1af4ff3 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -114,7 +114,7 @@ void DeviceControllerDiag::private_startDiag() qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!"; DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); if (!this->previousMachineEventSet.contains(E255Event)) { - machineEventSet.insert(E255Event); + previousMachineEventSet.insert(E255Event); private_sendDiagEvent(E255Event, DeviceController::Action::SET); } if (this->E255counter > 5) { @@ -133,7 +133,9 @@ void DeviceControllerDiag::private_startDiag() * - diag is called again in ModeOOO wokeup() */ } - this->private_finishDiag(); + this->diagRequestTimeoutTimer->stop(); + this->isRequestRunning = false; + this->flagInterruptDiag = false; return; } @@ -177,13 +179,15 @@ void DeviceControllerDiag::sys_superviseSystem() // send DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); if (!this->previousMachineEventSet.contains(E255Event)) { - machineEventSet.insert(E255Event); + previousMachineEventSet.insert(E255Event); private_sendDiagEvent(E255Event, DeviceController::Action::SET); } if (this->E255counter > 5) { this->restartCArun(); } else { this->E255counter++; } QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); - this->private_finishDiag(); + this->diagRequestTimeoutTimer->stop(); + this->isRequestRunning = false; + this->flagInterruptDiag = false; return; } @@ -194,13 +198,15 @@ void DeviceControllerDiag::sys_superviseSystem() hw->dc_autoRequest(true); DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254); - machineEventSet.insert(E255Event); + previousMachineEventSet.insert(E255Event); private_sendDiagEvent(E255Event, DeviceController::Action::SET); if (this->E255counter > 5) { this->restartCArun(); } else { this->E255counter++; } QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); - this->private_finishDiag(); + this->diagRequestTimeoutTimer->stop(); + this->isRequestRunning = false; + this->flagInterruptDiag = false; return; } From cc27b982ff5dd620f1d07d54290720c9cb8bfbfa Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 23 Jul 2025 09:23:47 +0200 Subject: [PATCH 4/6] Add/Track: currentProgramMode --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 8 ++++++-- src/ATBAPP/ATBDeviceControllerPlugin.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 2f7bce7..6ae0441 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -24,7 +24,8 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) - : isMaster(false) + : currentProgramMode(PROGRAM_MODE::INIT) + , isMaster(false) , pluginState(PLUGIN_STATE::NOT_INITIALIZED) , eventReceiver(nullptr) { @@ -290,12 +291,14 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToSELL() hw->dc_autoRequest(true); hw->rtc_setDateTime(); hw->mdb_switchWake(0); // wakeup MDB components + this->currentProgramMode = PROGRAM_MODE::SELL; } void ATBDeviceControllerPlugin::onChangedProgramModeToSERVICE() { hw->dc_autoRequest(true); hw->mdb_switchWake(0); // wakeup MDB components + this->currentProgramMode = PROGRAM_MODE::SERVICE; } void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE() @@ -303,12 +306,13 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE() hw->dc_autoRequest(true); this->diag->diagRequest(); hw->mdb_switchWake(1); + this->currentProgramMode = PROGRAM_MODE::IDLE; } void ATBDeviceControllerPlugin::onChangedProgramModeToOOO() { - + this->currentProgramMode = PROGRAM_MODE::OOO; } diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index 649100a..111b5df 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -25,6 +25,16 @@ using namespace nsDeviceControllerInterface; class QSettings; +enum class PROGRAM_MODE { + INIT, + IDLE, + SELL, + SERVICE, + OOO, + NOT_DEFINED +}; + + class ATBDeviceControllerPlugin : public DeviceControllerInterface @@ -100,6 +110,8 @@ private: QString serialPortName; + PROGRAM_MODE currentProgramMode; + bool useDebug; bool isMaster; From 577411289eb5bbe5656e79461bdd12918303031b Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 23 Jul 2025 09:24:24 +0200 Subject: [PATCH 5/6] Trigger diagRequest() on MODE SERVICE => MODE OOO --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 6ae0441..1126967 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -312,6 +312,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE() void ATBDeviceControllerPlugin::onChangedProgramModeToOOO() { + // trigger diagRequest on SERVICE -> IDLE + if (this->currentProgramMode == PROGRAM_MODE::SERVICE) { + hw->dc_autoRequest(true); + this->diag->diagRequest(); + hw->mdb_switchWake(1); + } this->currentProgramMode = PROGRAM_MODE::OOO; } From 5c40e088aa2457b4eab7eb709605c382c73721ee Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Tue, 29 Jul 2025 15:46:26 +0200 Subject: [PATCH 6/6] Diag: restart carun is M0255 (was W255) --- src/ATBAPP/DeviceControllerDiag.cpp | 14 +++++++------- src/ATBAPP/DeviceControllerDiag.h | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ATBAPP/DeviceControllerDiag.cpp b/src/ATBAPP/DeviceControllerDiag.cpp index ffff726..70658fb 100644 --- a/src/ATBAPP/DeviceControllerDiag.cpp +++ b/src/ATBAPP/DeviceControllerDiag.cpp @@ -144,7 +144,7 @@ void DeviceControllerDiag::private_startDiag() if (result) { qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid"; this->machineEventSet.remove(DCMachineEvent(DeviceController::State::E255)); - this->machineEventSet.remove(DCMachineEvent(DeviceController::State::W255)); + this->machineEventSet.remove(DCMachineEvent(DeviceController::State::M0255)); QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem); } else { @@ -680,8 +680,8 @@ void DeviceControllerDiag::private_sendDiagEvent(DCMachineEvent result, DeviceCo eventClass = EVENT_CLASS::WARNING; parameter = "temperatur warning"; break; - case DeviceController::State::W255: // restart carun - eventClass = EVENT_CLASS::WARNING; + case DeviceController::State::M0255: // restart carun + eventClass = EVENT_CLASS::STATE; parameter = "restart carun"; break; } @@ -722,10 +722,10 @@ void DeviceControllerDiag::restartCArun() this->E255counter = 0; - DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255); - if (!this->previousMachineEventSet.contains(W255Event)) { - machineEventSet.insert(W255Event); - private_sendDiagEvent(W255Event, DeviceController::Action::SET); + DCMachineEvent M0255Event = DCMachineEvent(DeviceController::State::M0255); + if (!this->previousMachineEventSet.contains(M0255Event)) { + machineEventSet.insert(M0255Event); + private_sendDiagEvent(M0255Event, DeviceController::Action::SET); } QProcess::startDetached("/bin/systemctl", {"restart", "carun"}); diff --git a/src/ATBAPP/DeviceControllerDiag.h b/src/ATBAPP/DeviceControllerDiag.h index 0b4ddf7..a228960 100644 --- a/src/ATBAPP/DeviceControllerDiag.h +++ b/src/ATBAPP/DeviceControllerDiag.h @@ -49,6 +49,7 @@ namespace DeviceController { M0252, // cashbox door open M0253, // service or battery door is open M0254, // no valid data from DC + M0255, // restart carun E255, @@ -57,8 +58,6 @@ namespace DeviceController { W003, W004, - W255, - INITIAL_STATE }; Q_ENUM_NS(State)