Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
dad0ef4299
|
@@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
||||||
: currentProgramMode(PROGRAM_MODE::INIT)
|
: isMaster(false)
|
||||||
, isMaster(false)
|
|
||||||
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
{
|
{
|
||||||
@@ -291,14 +290,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToSELL()
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
hw->rtc_setDateTime();
|
hw->rtc_setDateTime();
|
||||||
hw->mdb_switchWake(0); // wakeup MDB components
|
hw->mdb_switchWake(0); // wakeup MDB components
|
||||||
this->currentProgramMode = PROGRAM_MODE::SELL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToSERVICE()
|
void ATBDeviceControllerPlugin::onChangedProgramModeToSERVICE()
|
||||||
{
|
{
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
hw->mdb_switchWake(0); // wakeup MDB components
|
hw->mdb_switchWake(0); // wakeup MDB components
|
||||||
this->currentProgramMode = PROGRAM_MODE::SERVICE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
||||||
@@ -306,19 +303,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
this->diag->diagRequest();
|
this->diag->diagRequest();
|
||||||
hw->mdb_switchWake(1);
|
hw->mdb_switchWake(1);
|
||||||
this->currentProgramMode = PROGRAM_MODE::IDLE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -25,16 +25,6 @@ using namespace nsDeviceControllerInterface;
|
|||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
enum class PROGRAM_MODE {
|
|
||||||
INIT,
|
|
||||||
IDLE,
|
|
||||||
SELL,
|
|
||||||
SERVICE,
|
|
||||||
OOO,
|
|
||||||
NOT_DEFINED
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ATBDeviceControllerPlugin :
|
class ATBDeviceControllerPlugin :
|
||||||
public DeviceControllerInterface
|
public DeviceControllerInterface
|
||||||
@@ -110,8 +100,6 @@ private:
|
|||||||
|
|
||||||
QString serialPortName;
|
QString serialPortName;
|
||||||
|
|
||||||
PROGRAM_MODE currentProgramMode;
|
|
||||||
|
|
||||||
bool useDebug;
|
bool useDebug;
|
||||||
|
|
||||||
bool isMaster;
|
bool isMaster;
|
||||||
|
@@ -62,6 +62,7 @@ void DeviceControllerDiag::diagRequest()
|
|||||||
qCritical() << "DeviceControllerDiag::diagRequest() is already running";
|
qCritical() << "DeviceControllerDiag::diagRequest() is already running";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this->machineEventSet.clear();
|
||||||
this->isRequestRunning = true;
|
this->isRequestRunning = true;
|
||||||
this->diagRequestTimeoutTimer->start();
|
this->diagRequestTimeoutTimer->start();
|
||||||
|
|
||||||
@@ -132,9 +133,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
* - diag is called again in ModeOOO wokeup()
|
* - diag is called again in ModeOOO wokeup()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->private_finishDiag();
|
||||||
this->isRequestRunning = false;
|
|
||||||
this->flagInterruptDiag = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +143,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
if (result) {
|
if (result) {
|
||||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid";
|
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid";
|
||||||
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::E255));
|
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::E255));
|
||||||
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::M0255));
|
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::W255));
|
||||||
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -184,9 +183,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
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();
|
||||||
this->isRequestRunning = false;
|
|
||||||
this->flagInterruptDiag = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,15 +194,13 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
|
|
||||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
|
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
|
||||||
previousMachineEventSet.insert(E255Event);
|
machineEventSet.insert(E255Event);
|
||||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
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->private_finishDiag();
|
||||||
this->isRequestRunning = false;
|
|
||||||
this->flagInterruptDiag = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,8 +232,6 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
|
|
||||||
void DeviceControllerDiag::sub_componentAssessment()
|
void DeviceControllerDiag::sub_componentAssessment()
|
||||||
{
|
{
|
||||||
this->machineEventSet.clear();
|
|
||||||
|
|
||||||
bool flag_sendOperate = true;
|
bool flag_sendOperate = true;
|
||||||
|
|
||||||
struct T_moduleCondition modCond = {};
|
struct T_moduleCondition modCond = {};
|
||||||
@@ -680,8 +673,8 @@ void DeviceControllerDiag::private_sendDiagEvent(DCMachineEvent result, DeviceCo
|
|||||||
eventClass = EVENT_CLASS::WARNING;
|
eventClass = EVENT_CLASS::WARNING;
|
||||||
parameter = "temperatur warning";
|
parameter = "temperatur warning";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::M0255: // restart carun
|
case DeviceController::State::W255: // restart carun
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::WARNING;
|
||||||
parameter = "restart carun";
|
parameter = "restart carun";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -722,11 +715,9 @@ void DeviceControllerDiag::restartCArun()
|
|||||||
this->E255counter = 0;
|
this->E255counter = 0;
|
||||||
|
|
||||||
|
|
||||||
DCMachineEvent M0255Event = DCMachineEvent(DeviceController::State::M0255);
|
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
|
||||||
if (!this->previousMachineEventSet.contains(M0255Event)) {
|
machineEventSet.insert(W255Event);
|
||||||
machineEventSet.insert(M0255Event);
|
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
|
||||||
private_sendDiagEvent(M0255Event, DeviceController::Action::SET);
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@ namespace DeviceController {
|
|||||||
M0252, // cashbox door open
|
M0252, // cashbox door open
|
||||||
M0253, // service or battery door is open
|
M0253, // service or battery door is open
|
||||||
M0254, // no valid data from DC
|
M0254, // no valid data from DC
|
||||||
M0255, // restart carun
|
|
||||||
|
|
||||||
E255,
|
E255,
|
||||||
|
|
||||||
@@ -58,6 +57,8 @@ namespace DeviceController {
|
|||||||
W003,
|
W003,
|
||||||
W004,
|
W004,
|
||||||
|
|
||||||
|
W255,
|
||||||
|
|
||||||
INITIAL_STATE
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
|
Reference in New Issue
Block a user