Diag: first working version to detect some system errors
Drawbacks: - has to be called extra, no events or signals - lot of integer result values (where are they documented? Mapping?)
This commit is contained in:
parent
ba3eabec2c
commit
9cd10bfed8
@ -61,25 +61,26 @@ void DeviceControllerDiag::private_startDiag()
|
||||
result = hw->sys_areDCdataValid();
|
||||
|
||||
if (result) {
|
||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid";
|
||||
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
||||
}
|
||||
else {
|
||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is not valid";
|
||||
|
||||
|
||||
this->private_finishedDiag(0xfe);
|
||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is +++not+++ valid";
|
||||
|
||||
// try it again
|
||||
// -> this results in a seg. fault after ~10 loops!
|
||||
//QTimer::singleShot(200, this, &DeviceControllerDiag::private_startDiag);
|
||||
QTimer::singleShot(200, this, &DeviceControllerDiag::private_startDiag);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceControllerDiag::sys_superviseSystem()
|
||||
{ // this function proofs if vending is possible depending of doors state
|
||||
|
||||
struct T_dynamicCondition *dynMaCond=0;
|
||||
struct T_moduleCondition *modCond=0;
|
||||
struct T_dynamicCondition dynMaCond;
|
||||
struct T_moduleCondition modCond;
|
||||
|
||||
|
||||
qCritical() << " sys_superviseSystem()";
|
||||
|
||||
|
||||
// check for DiagRequestTimeoutTimerTimeout:
|
||||
if (this->flagInterruptDiag) {
|
||||
@ -97,34 +98,40 @@ void DeviceControllerDiag::sys_superviseSystem()
|
||||
}
|
||||
|
||||
// jetzt sind die DC-Daten aktuell, also reinholen:
|
||||
hw->sys_getDynMachineConditions(dynMaCond);
|
||||
hw->sys_getDeviceConditions(modCond);
|
||||
hw->sys_getDynMachineConditions(&dynMaCond);
|
||||
hw->sys_getDeviceConditions(&modCond);
|
||||
|
||||
if (!modCond->allModulesChecked)
|
||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() get condition data";
|
||||
if (!modCond.allModulesChecked)
|
||||
{
|
||||
// noch keine Testergebnisse
|
||||
if (dynMaCond->startupTestIsRunning) {
|
||||
if (dynMaCond.startupTestIsRunning) {
|
||||
// TODO?
|
||||
}
|
||||
|
||||
|
||||
qCritical() << " allModulesChecked is false --> call again";
|
||||
|
||||
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
||||
return;
|
||||
}
|
||||
|
||||
// all doors: 99: undefined 0:closed 1:open
|
||||
if (dynMaCond->lowerDoor || dynMaCond->upperDoor) {
|
||||
if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
|
||||
// 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(0xFD);
|
||||
return;
|
||||
}
|
||||
if (dynMaCond->middleDoor) {
|
||||
if (dynMaCond.middleDoor) {
|
||||
// vault door is open, goto INTRUSION MODE
|
||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
||||
this->private_finishedDiag(0xFE);
|
||||
this->private_finishedDiag(0xFC);
|
||||
return;
|
||||
}
|
||||
|
||||
qCritical() << " --> call sub_componentAssessment()";
|
||||
|
||||
uint8_t proposedError = sub_componentAssessment();
|
||||
if (proposedError) {
|
||||
// All doors are closed but errors found, goto OOO MODE (out-of-order)
|
||||
@ -145,73 +152,75 @@ uint8_t DeviceControllerDiag::sub_componentAssessment()
|
||||
// this function decides if vending mode is possible, independant from door
|
||||
// return >0 in case of error
|
||||
|
||||
struct T_moduleCondition *modCond=0;
|
||||
hw->sys_getDeviceConditions(modCond);
|
||||
struct T_moduleCondition modCond;
|
||||
hw->sys_getDeviceConditions(&modCond);
|
||||
|
||||
struct T_dynamicCondition *dynMaCond=0;
|
||||
hw->sys_getDynMachineConditions(dynMaCond);
|
||||
struct T_dynamicCondition dynMaCond;
|
||||
hw->sys_getDynMachineConditions(&dynMaCond);
|
||||
|
||||
struct T_devices *devPara=0;
|
||||
if (modCond->rtc>=200)
|
||||
struct T_devices devPara;
|
||||
hw->sys_restoreDeviceParameter(&devPara);
|
||||
|
||||
if (modCond.rtc>=200)
|
||||
return 1;
|
||||
if (modCond->printer==200 || modCond->printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
||||
if (modCond.printer==200 || modCond.printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
||||
return 2;
|
||||
if (modCond->printer==202)
|
||||
if (modCond.printer==202)
|
||||
return 3;
|
||||
|
||||
if (modCond->coinBlocker>=200)
|
||||
if (modCond.coinBlocker>=200)
|
||||
return 4;
|
||||
if (modCond->mdbBus>=200)
|
||||
if (modCond.mdbBus>=200)
|
||||
return 5;
|
||||
if (modCond->intEe>=200)
|
||||
if (modCond.intEe>=200)
|
||||
return 6;
|
||||
|
||||
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->coinChecker>=200 || modCond->coinEscrow>=200)
|
||||
if (modCond.coinChecker>=200 || modCond.coinEscrow>=200)
|
||||
{
|
||||
// Fehler Münzver.
|
||||
return 7;
|
||||
}
|
||||
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
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
} else
|
||||
if (devPara->kindOfCoinChecker==3)
|
||||
if (devPara.kindOfCoinChecker==3)
|
||||
{
|
||||
if (modCond->changer>=200)
|
||||
if (modCond.changer>=200)
|
||||
{
|
||||
// Fehler Münzver.
|
||||
return 7;
|
||||
}
|
||||
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
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
if ( modCond->billReader>=200 && devPara->BillAcceptor>0)
|
||||
if ( modCond.billReader>=200 && devPara.BillAcceptor>0)
|
||||
{
|
||||
// Fehler BNA
|
||||
return 9;
|
||||
}
|
||||
|
||||
if (dynMaCond->onAlarm>0)
|
||||
if (dynMaCond.onAlarm>0)
|
||||
return 10;
|
||||
|
||||
if (dynMaCond->modeAbrech>0)
|
||||
if (dynMaCond.modeAbrech>0)
|
||||
return 11;
|
||||
|
||||
if (dynMaCond->nowCardTest>0)
|
||||
if (dynMaCond.nowCardTest>0)
|
||||
return 12;
|
||||
|
||||
if (dynMaCond->startupTestIsRunning>0)
|
||||
if (dynMaCond.startupTestIsRunning>0)
|
||||
return 13;
|
||||
|
||||
if (modCond->voltage>=200)
|
||||
if (modCond.voltage>=200)
|
||||
return 14;
|
||||
if (modCond->temper>=200)
|
||||
if (modCond.temper>=200)
|
||||
return 15;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user