Merge branch 'ImproveE255Handling' into pu/integration

This commit is contained in:
2025-09-29 15:24:22 +02:00
2 changed files with 26 additions and 21 deletions

View File

@@ -113,8 +113,8 @@ void DeviceControllerDiag::private_startDiag()
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!"; qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
if (!this->previousMachineEventSet.contains(E255Event)) { if (!this->previousMachineEventSet.contains(E255Event)) {
machineEventSet.insert(E255Event); this->private_setDiagEvent(DeviceController::State::E255);
private_sendDiagEvent(E255Event, DeviceController::Action::SET); this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
} }
if (this->E255counter > 5) { if (this->E255counter > 5) {
this->restartCArun(); this->restartCArun();
@@ -132,9 +132,9 @@ void DeviceControllerDiag::private_startDiag()
* - diag is called again in ModeOOO wokeup() * - diag is called again in ModeOOO wokeup()
*/ */
} }
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false; this->private_finishDiag(false);
this->flagInterruptDiag = false;
return; return;
} }
@@ -178,15 +178,16 @@ void DeviceControllerDiag::sys_superviseSystem()
// send // send
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255); DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
if (!this->previousMachineEventSet.contains(E255Event)) { if (!this->previousMachineEventSet.contains(E255Event)) {
machineEventSet.insert(E255Event); this->private_setDiagEvent(DeviceController::State::E255);
private_sendDiagEvent(E255Event, DeviceController::Action::SET); this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
} }
if (this->E255counter > 5) { this->restartCArun(); } if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; } else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false; this->private_finishDiag(false);
this->flagInterruptDiag = false;
return; return;
} }
@@ -196,16 +197,14 @@ void DeviceControllerDiag::sys_superviseSystem()
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!"; qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
hw->dc_autoRequest(true); hw->dc_autoRequest(true);
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254); DCMachineEvent M0254Event = DCMachineEvent(DeviceController::State::M0254);
previousMachineEventSet.insert(E255Event); this->private_setDiagEvent(DeviceController::State::M0254);
private_sendDiagEvent(E255Event, DeviceController::Action::SET); this->private_sendDiagEvent(M0254Event, DeviceController::Action::SET);
if (this->E255counter > 5) { this->restartCArun(); } if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; } else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest); QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
this->diagRequestTimeoutTimer->stop(); this->private_finishDiag(false);
this->isRequestRunning = false;
this->flagInterruptDiag = false;
return; return;
} }
@@ -477,7 +476,7 @@ void DeviceControllerDiag::sub_componentAssessment()
// finish diag // finish diag
this->private_finishDiag(); this->private_finishDiag(true);
} }
/** /**
@@ -486,14 +485,20 @@ void DeviceControllerDiag::sub_componentAssessment()
* Single point to finish a diag process: * Single point to finish a diag process:
* - * -
*/ */
void DeviceControllerDiag::private_finishDiag() void DeviceControllerDiag::private_finishDiag(bool dataValid)
{ {
this->diagRequestTimeoutTimer->stop(); this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false; this->isRequestRunning = false;
this->flagInterruptDiag = false; this->flagInterruptDiag = false;
this->previousMachineEventSet.unite(machineEventSet); // add new elements from machineEventSet // add new elements from machineEventSet
this->previousMachineEventSet.intersect(machineEventSet); // remove elements not in machineEventSet this->previousMachineEventSet.unite(machineEventSet);
if (dataValid) {
// remove elements not in machineEventSet
// ... only if data is valid
this->previousMachineEventSet.intersect(machineEventSet);
}
if (this->isDiagBackgroundTask) { if (this->isDiagBackgroundTask) {
this->isDiagBackgroundTask = false; this->isDiagBackgroundTask = false;

View File

@@ -170,7 +170,7 @@ private slots:
void private_setDiagEvent(DeviceController::State result); void private_setDiagEvent(DeviceController::State result);
void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action); void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action);
void private_finishDiag(); void private_finishDiag(bool dataValid = false);
void sys_superviseSystem(); void sys_superviseSystem();