Compare commits

...

10 Commits

Author SHA1 Message Date
2452499073 Diag: call diagRequest() on wokeup from rtc 2025-09-03 13:42:30 +02:00
5c40e088aa Diag: restart carun is M0255 (was W255) 2025-07-29 15:46:26 +02:00
577411289e Trigger diagRequest() on MODE SERVICE => MODE OOO 2025-07-23 09:29:16 +02:00
cc27b982ff Add/Track: currentProgramMode 2025-07-23 09:28:53 +02:00
a87a4e6c14 Merge branch 'improveDeviceControllerDiag' into pu/integration 2025-06-25 10:38:31 +02:00
0467db23d1 Merge branch 'ImproveE255Handling' into improveDeviceControllerDiag 2025-06-25 10:36:19 +02:00
e1470d13f1 Diag: clear machine machineEventSet on valid data
This is allowed only here: dc-data is valid (i.e. check for E255 was
sucessfull).
This method sub_componentAssessment() will check all criteria of
dc-module conditions.
2025-06-25 10:29:58 +02:00
1165c4b92f Diag: set W255 only once 2025-06-24 15:03:21 +02:00
40acd0e0c4 Diag: set E255 only once 2025-06-24 14:25:52 +02:00
fe3696ce9c 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!
2025-06-24 14:18:35 +02:00
4 changed files with 56 additions and 17 deletions

View File

@@ -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,19 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
hw->dc_autoRequest(true);
this->diag->diagRequest();
hw->mdb_switchWake(1);
this->currentProgramMode = PROGRAM_MODE::IDLE;
}
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;
}
@@ -1899,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();
}

View File

@@ -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;

View File

@@ -62,7 +62,6 @@ void DeviceControllerDiag::diagRequest()
qCritical() << "DeviceControllerDiag::diagRequest() is already running";
return;
}
this->machineEventSet.clear();
this->isRequestRunning = true;
this->diagRequestTimeoutTimer->start();
@@ -133,7 +132,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;
}
@@ -143,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 {
@@ -183,7 +184,9 @@ void DeviceControllerDiag::sys_superviseSystem()
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 +197,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;
}
@@ -232,6 +237,8 @@ void DeviceControllerDiag::sys_superviseSystem()
void DeviceControllerDiag::sub_componentAssessment()
{
this->machineEventSet.clear();
bool flag_sendOperate = true;
struct T_moduleCondition modCond = {};
@@ -673,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;
}
@@ -715,9 +722,11 @@ void DeviceControllerDiag::restartCArun()
this->E255counter = 0;
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
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"});
}

View File

@@ -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)