Diag: E255 / W255 / M0254 -> set, send and finish diag

This states are rather meta infos about dc condition. Therefore the
where created and sent outside of superviseSystem()-method.
This commit should ensure that:
 - this states are sent to ISMAS
 - this states are inserted in machineEventSet in order to enable
   a reset in next diagRun
This commit is contained in:
Siegfried Siegert 2025-06-12 08:35:58 +02:00
parent 18a35acf20
commit f75f2c57df
Signed by: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03

View File

@ -111,9 +111,9 @@ void DeviceControllerDiag::private_startDiag()
// check for DiagRequestTimeoutTimerTimeout:
if (this->flagInterruptDiag) {
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
this->private_setDiagEvent(DeviceController::State::E255);
this->isRequestRunning = false;
this->flagInterruptDiag = false;
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
machineEventSet.insert(E255Event);
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
if (this->E255counter > 5) {
this->restartCArun();
// try it again, until success:
@ -169,9 +169,10 @@ void DeviceControllerDiag::sys_superviseSystem()
// check for DiagRequestTimeoutTimerTimeout:
if (this->flagInterruptDiag) {
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
this->private_setDiagEvent(DeviceController::State::E255);
this->flagInterruptDiag = false;
this->isRequestRunning = false;
// send
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
machineEventSet.insert(E255Event);
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
@ -184,9 +185,11 @@ void DeviceControllerDiag::sys_superviseSystem()
// es gibt keinerlei gültige Daten vom DC
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
hw->dc_autoRequest(true);
this->private_setDiagEvent(DeviceController::State::M0254);
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false;
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
machineEventSet.insert(E255Event);
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
@ -457,9 +460,8 @@ void DeviceControllerDiag::sub_componentAssessment()
// send Operate if there is no error
if (flag_sendOperate) {
// O000 must not be part of event set
DCMachineEvent O000DCMachineEvent = DCMachineEvent(DeviceController::State::O000,
QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8));
// O000 must not be part of machineEventSet
DCMachineEvent O000DCMachineEvent = DCMachineEvent(DeviceController::State::O000);
this->private_sendDiagEvent(O000DCMachineEvent, DeviceController::Action::SET);
}
@ -509,7 +511,7 @@ void DeviceControllerDiag::private_setDiagEvent(DeviceController::State result)
return;
}
DCMachineEvent newState = DCMachineEvent(result, QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8));
DCMachineEvent newState = DCMachineEvent(result);
// DEBUG
qCritical() << "----> setDiagEvent: " << newState.state << " with id: " << newState.eventId;
@ -708,7 +710,12 @@ void DeviceControllerDiag::private_sendDiagEvent(DCMachineEvent result, DeviceCo
void DeviceControllerDiag::restartCArun()
{
this->E255counter = 0;
this->private_setDiagEvent(DeviceController::State::W255);
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
machineEventSet.insert(W255Event);
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
}