Rework machine diag:
- allways check for whole system state (all errors / warnings) -> e.g. an error does not hide an other error or warning - send machine event only once - store sent events in a QSet-container - clear this container if no error / warning is detected Note: there is currently no message for releasing a certain single error / warning. So it is no worth in removing a single entry in QSet-container. This is a task for later program versions.
This commit is contained in:
parent
df3a83521f
commit
0fd20d1dc4
@ -54,7 +54,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
||||||
this->private_finishedDiag(DeviceController::State::E255);
|
this->private_sendDiagEvent(DeviceController::State::E255);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
||||||
this->private_finishedDiag(DeviceController::State::E255);
|
this->private_sendDiagEvent(DeviceController::State::E255);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
{
|
{
|
||||||
// es gibt keinerlei gültige Daten vom DC
|
// es gibt keinerlei gültige Daten vom DC
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
||||||
this->private_finishedDiag(DeviceController::State::E254);
|
this->private_sendDiagEvent(DeviceController::State::E254);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,29 +121,26 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
|
if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
|
||||||
// Service or battery door is open, goto INTRUSION MODE
|
// Service or battery door is open, goto INTRUSION MODE
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
||||||
this->private_finishedDiag(DeviceController::State::E253);
|
this->private_sendDiagEvent(DeviceController::State::E253);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dynMaCond.middleDoor) {
|
if (dynMaCond.middleDoor) {
|
||||||
// vault door is open, goto INTRUSION MODE
|
// vault door is open, goto INTRUSION MODE
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
||||||
this->private_finishedDiag(DeviceController::State::E252);
|
this->private_sendDiagEvent(DeviceController::State::E252);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << " --> call sub_componentAssessment()";
|
qCritical() << " --> call sub_componentAssessment()";
|
||||||
|
|
||||||
DeviceController::State proposedError = sub_componentAssessment();
|
sub_componentAssessment();
|
||||||
|
|
||||||
this->private_finishedDiag(proposedError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DeviceController::State DeviceControllerDiag::sub_componentAssessment()
|
void DeviceControllerDiag::sub_componentAssessment()
|
||||||
{
|
{
|
||||||
// this function decides if vending mode is possible, independant from door
|
bool flag_sendOperate = true;
|
||||||
// return >0 in case of error
|
|
||||||
|
|
||||||
struct T_moduleCondition modCond;
|
struct T_moduleCondition modCond;
|
||||||
hw->sys_getDeviceConditions(&modCond);
|
hw->sys_getDeviceConditions(&modCond);
|
||||||
@ -160,72 +157,90 @@ DeviceController::State DeviceControllerDiag::sub_componentAssessment()
|
|||||||
emit newVoltage(voltage);
|
emit newVoltage(voltage);
|
||||||
|
|
||||||
|
|
||||||
|
// check for alarm:
|
||||||
|
|
||||||
|
if (dynMaCond.onAlarm>0) {
|
||||||
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::A000);
|
||||||
|
}
|
||||||
|
|
||||||
// check for invalid states:
|
// check for invalid states:
|
||||||
|
|
||||||
if (modCond.rtc>=200)
|
if (modCond.rtc>=200) {
|
||||||
return DeviceController::State::E002;
|
flag_sendOperate = false;
|
||||||
if (modCond.printer==200 || modCond.printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
this->private_sendDiagEvent(DeviceController::State::E002);
|
||||||
return DeviceController::State::E020;
|
}
|
||||||
if (modCond.printer==202)
|
if (modCond.printer==200 || modCond.printer==201) { // 200: not connected 201: printer-HW-error 202: no paper
|
||||||
return DeviceController::State::E018;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E020);
|
||||||
|
}
|
||||||
|
if (modCond.printer==202) {
|
||||||
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E018);
|
||||||
|
}
|
||||||
|
|
||||||
if (modCond.coinBlocker>=200)
|
if (modCond.coinBlocker>=200) {
|
||||||
return DeviceController::State::E025;
|
flag_sendOperate = false;
|
||||||
if (modCond.mdbBus>=200)
|
this->private_sendDiagEvent(DeviceController::State::E025);
|
||||||
return DeviceController::State::E034;
|
}
|
||||||
if (modCond.intEe>=200)
|
if (modCond.mdbBus>=200) {
|
||||||
return DeviceController::State::E011;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E034);
|
||||||
|
}
|
||||||
|
if (modCond.intEe>=200) {
|
||||||
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E011);
|
||||||
|
}
|
||||||
|
|
||||||
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
||||||
// because we need certain errors and we do get for 'kindOfCoinChecker' -> 16 !
|
// because we need certain errors and we do get for 'kindOfCoinChecker' -> 16 !
|
||||||
qCritical() << "-----------diag: kindOfCoinChecker = " << devPara.kindOfCoinChecker;
|
qCritical() << "-----------diag: kindOfCoinChecker = " << devPara.kindOfCoinChecker;
|
||||||
qCritical() << " modCond.coinSafe = " << modCond.coinSafe;
|
qCritical() << " modCond.coinSafe = " << modCond.coinSafe;
|
||||||
if (devPara.kindOfCoinChecker > 0) {
|
if (devPara.kindOfCoinChecker > 0) {
|
||||||
if (modCond.coinSafe==201) // full
|
if (modCond.coinSafe==201) { // full
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E007;
|
this->private_sendDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E009;
|
this->private_sendDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
if (modCond.coinEscrow>=200)
|
if (modCond.coinEscrow>=200) {
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E010;
|
this->private_sendDiagEvent(DeviceController::State::E010);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (devPara.kindOfCoinChecker==1 || devPara.kindOfCoinChecker==2) // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
if (devPara.kindOfCoinChecker==1 || devPara.kindOfCoinChecker==2) // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
||||||
{
|
{
|
||||||
if (modCond.coinEscrow>=200)
|
if (modCond.coinEscrow>=200) {
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E010;
|
this->private_sendDiagEvent(DeviceController::State::E010);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) // full
|
if (modCond.coinSafe==201) { // full
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E007;
|
this->private_sendDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E009;
|
this->private_sendDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (devPara.kindOfCoinChecker==3)
|
if (devPara.kindOfCoinChecker==3)
|
||||||
{
|
{
|
||||||
if (modCond.changer>=200)
|
if (modCond.changer>=200) {
|
||||||
{
|
|
||||||
// Fehler Münzver.
|
// Fehler Münzver.
|
||||||
return DeviceController::State::E026;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E026);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) // full
|
if (modCond.coinSafe==201) { // full
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E007;
|
this->private_sendDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe == 200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe == 200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
{
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E009;
|
this->private_sendDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,44 +258,56 @@ DeviceController::State DeviceControllerDiag::sub_componentAssessment()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (dynMaCond.onAlarm>0)
|
if (dynMaCond.modeAbrech>0) {
|
||||||
return DeviceController::State::A000;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E011);
|
||||||
|
}
|
||||||
|
|
||||||
if (dynMaCond.modeAbrech>0)
|
if (dynMaCond.nowCardTest>0) {
|
||||||
return DeviceController::State::E011;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E072);
|
||||||
|
}
|
||||||
|
|
||||||
if (dynMaCond.nowCardTest>0)
|
if (dynMaCond.startupTestIsRunning>0) {
|
||||||
return DeviceController::State::E072;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E073);
|
||||||
|
}
|
||||||
|
|
||||||
if (dynMaCond.startupTestIsRunning>0)
|
if (modCond.voltage>=200) {
|
||||||
return DeviceController::State::E073;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::E003);
|
||||||
if (modCond.voltage>=200)
|
}
|
||||||
return DeviceController::State::E003;
|
if (modCond.temper>=200) {
|
||||||
if (modCond.temper>=200)
|
flag_sendOperate = false;
|
||||||
return DeviceController::State::E004;
|
this->private_sendDiagEvent(DeviceController::State::E004);
|
||||||
|
}
|
||||||
|
|
||||||
// check for warnings
|
// check for warnings
|
||||||
if (modCond.printer>=100 && modCond.printer<200)
|
if (modCond.printer>=100 && modCond.printer<200) {
|
||||||
return DeviceController::State::W001;
|
flag_sendOperate = false;
|
||||||
if (modCond.coinSafe>=100 && modCond.coinSafe<200)
|
this->private_sendDiagEvent(DeviceController::State::W001);
|
||||||
return DeviceController::State::W002;
|
}
|
||||||
if (modCond.voltage>=100 && modCond.voltage<200)
|
if (modCond.coinSafe>=100 && modCond.coinSafe<200) {
|
||||||
return DeviceController::State::W003;
|
flag_sendOperate = false;
|
||||||
if (modCond.temper>=100 && modCond.temper<200)
|
this->private_sendDiagEvent(DeviceController::State::W002);
|
||||||
return DeviceController::State::W004;
|
}
|
||||||
|
if (modCond.voltage>=100 && modCond.voltage<200) {
|
||||||
return DeviceController::State::O000;
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::W003);
|
||||||
|
}
|
||||||
|
if (modCond.temper>=100 && modCond.temper<200) {
|
||||||
|
flag_sendOperate = false;
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag_sendOperate) {
|
||||||
DeviceController::State DeviceControllerDiag::sys_getSystemErrors()
|
this->private_sendDiagEvent(DeviceController::State::O000);
|
||||||
{
|
|
||||||
return this->sub_componentAssessment();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeviceControllerDiag::private_finishedDiag
|
* @brief DeviceControllerDiag::private_sendDiagEvent
|
||||||
* @param result - result value from 'sub_componentAssessment()',
|
* @param result - result value from 'sub_componentAssessment()',
|
||||||
* - 0x00 everything is fine
|
* - 0x00 everything is fine
|
||||||
* - 0xFF on timer interrupt
|
* - 0xFF on timer interrupt
|
||||||
@ -288,13 +315,13 @@ DeviceController::State DeviceControllerDiag::sys_getSystemErrors()
|
|||||||
* - 0xFD Service or battery door is open
|
* - 0xFD Service or battery door is open
|
||||||
* - 0xFE vault door is open
|
* - 0xFE vault door is open
|
||||||
*/
|
*/
|
||||||
void DeviceControllerDiag::private_finishedDiag(DeviceController::State result)
|
void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
||||||
{
|
{
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
|
|
||||||
qCritical() << "DeviceControllerDiag::private_finishedDiag() result: " << result;
|
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
|
||||||
|
|
||||||
|
|
||||||
if (this->eventReceiver == nullptr) {
|
if (this->eventReceiver == nullptr) {
|
||||||
@ -302,6 +329,15 @@ void DeviceControllerDiag::private_finishedDiag(DeviceController::State result)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (machineEventSet.contains(result)) {
|
||||||
|
// do not send already sent events
|
||||||
|
qCritical() << " ... is in machineEventList";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
machineEventSet.insert(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
||||||
|
|
||||||
@ -380,14 +416,14 @@ void DeviceControllerDiag::private_finishedDiag(DeviceController::State result)
|
|||||||
parameter = "startup-test is running";
|
parameter = "startup-test is running";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceController::State::E252: // oper door / lower door open
|
case DeviceController::State::E252: // cash box door open
|
||||||
eventClass = EVENT_CLASS::STATE;
|
|
||||||
parameter = "oper door / lower door open";
|
|
||||||
break;
|
|
||||||
case DeviceController::State::E253: // cash box door open
|
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "cash box door open";
|
parameter = "cash box door open";
|
||||||
break;
|
break;
|
||||||
|
case DeviceController::State::E253: // service or battery door open
|
||||||
|
eventClass = EVENT_CLASS::STATE;
|
||||||
|
parameter = "service or battery door open";
|
||||||
|
break;
|
||||||
case DeviceController::State::E254: // no valid data from DeviceController
|
case DeviceController::State::E254: // no valid data from DeviceController
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "no valid data from DeviceController";
|
parameter = "no valid data from DeviceController";
|
||||||
@ -399,6 +435,7 @@ void DeviceControllerDiag::private_finishedDiag(DeviceController::State result)
|
|||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::O000: // everything is fine
|
case DeviceController::State::O000: // everything is fine
|
||||||
|
this->machineEventSet.clear();
|
||||||
eventClass = EVENT_CLASS::OPERATE;
|
eventClass = EVENT_CLASS::OPERATE;
|
||||||
parameter = "";
|
parameter = "";
|
||||||
qCritical() << " ... everything fine";
|
qCritical() << " ... everything fine";
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define DEVICECONTROLLERDIAG_H
|
#define DEVICECONTROLLERDIAG_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QSet>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "ATBMachineEvent.h"
|
#include "ATBMachineEvent.h"
|
||||||
@ -78,17 +79,17 @@ private:
|
|||||||
|
|
||||||
QTimer *diagRequestTimeoutTimer;
|
QTimer *diagRequestTimeoutTimer;
|
||||||
|
|
||||||
//uint8_t sub_componentAssessment();
|
void sub_componentAssessment(); // diag exit method
|
||||||
DeviceController::State sub_componentAssessment();
|
|
||||||
DeviceController::State sys_getSystemErrors();
|
|
||||||
|
|
||||||
int lastVoltage;
|
int lastVoltage;
|
||||||
|
|
||||||
|
QSet<DeviceController::State> machineEventSet;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDiagRequestTimeoutTimerTimeout();
|
void onDiagRequestTimeoutTimerTimeout();
|
||||||
|
|
||||||
void private_startDiag(); // diag entry method
|
void private_startDiag(); // diag entry method
|
||||||
void private_finishedDiag(DeviceController::State result); // diag exit method
|
void private_sendDiagEvent(DeviceController::State result);
|
||||||
|
|
||||||
void sys_superviseSystem();
|
void sys_superviseSystem();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user