Compare commits
9 Commits
78700e7bea
...
27c0aa56ee
Author | SHA1 | Date | |
---|---|---|---|
27c0aa56ee | |||
6377c6c18f | |||
e906213441 | |||
57b4ade2e5 | |||
f817d07e8c | |||
fc2bc6bafc | |||
7f672db841 | |||
d8232e0163 | |||
fc2132184e |
@ -1,6 +1,7 @@
|
||||
#ifndef DATEI_H
|
||||
#define DATEI_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
@ -26,6 +26,8 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
||||
#ifndef hwapi_H
|
||||
#define hwapi_H
|
||||
|
||||
#include <stdint.h>
|
||||
//#include <QTabWidget>
|
||||
#include <QtPlugin>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
@ -72,6 +74,9 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
||||
//#undef THIS_IS_CA_MASTER
|
||||
|
||||
//for CAmaster:
|
||||
#define THIS_IS_CA_MASTER
|
||||
|
||||
|
||||
|
||||
class QSharedMemory;
|
||||
|
||||
@ -1305,31 +1310,35 @@ public:
|
||||
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
// already declared in interfaces.h
|
||||
void hwapi_templatePrintFinished_OK(void) const;
|
||||
void hwapi_templatePrintFinished_Err(void) const;
|
||||
void hwapi_templatePrintFinished_OK(void) const override;
|
||||
void hwapi_templatePrintFinished_Err(void) const override;
|
||||
|
||||
void hwapi_coinCollectionJustStarted(void) const;
|
||||
void hwapi_coinCollectionAborted(void) const;
|
||||
void hwapi_coinCollectionJustStarted(void) const override;
|
||||
void hwapi_coinCollectionAborted(void) const override;
|
||||
|
||||
void hwapi_gotNewCoin(void) const;
|
||||
void hwapi_payStopByMax(void) const;
|
||||
void hwapi_payStopByPushbutton(void) const;
|
||||
void hwapi_gotNewCoin(void) const override;
|
||||
void hwapi_payStopByMax(void) const override;
|
||||
void hwapi_payStopByPushbutton(void) const override;
|
||||
|
||||
void hwapi_payStopByEscrow(void) const;
|
||||
void hwapi_payStopByError(void) const;
|
||||
void hwapi_payStopByTimeout(void) const;
|
||||
void hwapi_payCancelled(void) const;
|
||||
void hwapi_coinProcessJustStopped(void) const;
|
||||
void hwapi_payStopByEscrow(void) const override;
|
||||
void hwapi_payStopByError(void) const override;
|
||||
void hwapi_payStopByTimeout(void) const override;
|
||||
void hwapi_payCancelled(void) const override;
|
||||
void hwapi_coinProcessJustStopped(void) const override;
|
||||
|
||||
// new from 2023.06.12
|
||||
void hwapi_doorServiceDoorOpened(void) const;
|
||||
void hwapi_doorVaultDoorOpened(void) const;
|
||||
void hwapi_doorCoinBoxRemoved(void) const;
|
||||
void hwapi_doorCoinBoxInserted(void) const;
|
||||
void hwapi_doorCBinAndAllDoorsClosed(void) const;
|
||||
void hwapi_doorAllDoorsClosed(void) const;
|
||||
void hwapi_doorServiceDoorOpened(void) const override;
|
||||
void hwapi_doorVaultDoorOpened(void) const override;
|
||||
void hwapi_doorCoinBoxRemoved(void) const override;
|
||||
void hwapi_doorCoinBoxInserted(void) const override;
|
||||
void hwapi_doorCBinAndAllDoorsClosed(void) const override;
|
||||
void hwapi_doorAllDoorsClosed(void) const override;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
//void hwapi_slotPrintFinished_OK(void);
|
||||
|
@ -2276,7 +2276,32 @@ public:
|
||||
|
||||
|
||||
signals:
|
||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||
|
||||
virtual void hwapi_coinCollectionJustStarted(void) const=0;
|
||||
virtual void hwapi_coinCollectionAborted(void) const=0;
|
||||
|
||||
virtual void hwapi_gotNewCoin(void) const=0;
|
||||
virtual void hwapi_payStopByMax(void) const=0;
|
||||
virtual void hwapi_payStopByPushbutton(void) const=0;
|
||||
|
||||
virtual void hwapi_payStopByEscrow(void) const=0;
|
||||
virtual void hwapi_payStopByError(void) const=0;
|
||||
virtual void hwapi_payStopByTimeout(void) const=0;
|
||||
virtual void hwapi_payCancelled(void) const=0;
|
||||
virtual void hwapi_coinProcessJustStopped(void) const=0;
|
||||
|
||||
virtual void hwapi_doorServiceDoorOpened(void) const=0;
|
||||
virtual void hwapi_doorVaultDoorOpened(void) const=0;
|
||||
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
|
||||
virtual void hwapi_doorCoinBoxInserted(void) const=0;
|
||||
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
|
||||
virtual void hwapi_doorAllDoorsClosed(void) const=0;
|
||||
|
||||
|
||||
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
|
||||
/* GH Version, bringt Fehler
|
||||
void hwapi_templatePrintFinished_OK() const;
|
||||
void hwapi_templatePrintFinished_Err() const;
|
||||
|
||||
@ -2299,6 +2324,7 @@ signals:
|
||||
void hwapi_doorCoinBoxInserted() const;
|
||||
void hwapi_doorCBinAndAllDoorsClosed() const;
|
||||
void hwapi_doorAllDoorsClosed() const;
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#ifndef RUN_PROCESS_H
|
||||
#define RUN_PROCESS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
@ -25,7 +26,7 @@
|
||||
class T_runProc : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QTimer *hwapi_TimerPayment, *hwapi_triggerBL;
|
||||
QTimer *hwapi_TimerPayment, *hwapi_triggerBL, *myTO;
|
||||
|
||||
void sub_emp_getAllParameters(struct T_emp *emp);
|
||||
void changer_getAllParameters(struct T_changer *mw);
|
||||
|
@ -350,9 +350,20 @@ char T_datif::datif_cycleSend()
|
||||
char T_datif::sendINrequestsAutomatic(void)
|
||||
{
|
||||
//qDebug() << "send IN request " << dif_scanStep;
|
||||
// uint8_t datif_autoRequCommandList[50]={11, 12, 18, 104, 106, 103, 14, 27, 109, 17, 19, 23, 30, 31, 32, 33, 114, 35};
|
||||
uint8_t datif_autoRequCommandList[30]={11, 12, 14, 17, 18, 19, 22, 23, 27, 30, 31, 32, 33, 35, 102, 103, 104, 106, 107, 109, 114,0,0,0,0,0,0,0,0,0};
|
||||
uint8_t datif_maxNrCommands=21, datif_sendNow;
|
||||
//uint8_t datif_autoRequCommandList[30]={11, 12, 14, 17, 18, 19, 22, 23, 27, 30,
|
||||
// 31, 32, 33, 35, 102, 103, 104, 106, 107, 109,
|
||||
// 114,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
// extension 6.12.23, complete list:
|
||||
uint8_t datif_autoRequCommandList[40]={11, 12, 13, 14, 17, 18, 19, 21, 22, 23,
|
||||
24, 25, 27, 30, 31, 32, 33, 35, 39, 40,
|
||||
41, 42, 102,103,104,106,107,108,109,110,
|
||||
112,113,114,115,116,0, 0, 0, 0, 0};
|
||||
uint8_t datif_maxNrCommands=35, datif_sendNow;
|
||||
|
||||
// send quicker while transaction is ongoing:
|
||||
uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,0,0,0};
|
||||
uint8_t datif_maxVendingCmds=12;
|
||||
|
||||
// special commands:
|
||||
// 102: get IOs run constantly!!!
|
||||
@ -362,40 +373,44 @@ char T_datif::sendINrequestsAutomatic(void)
|
||||
// 107, 22: MDB: poll if needed
|
||||
|
||||
doRepeat=true; // 20.9.23 15uhr (after release)
|
||||
if (datif_sendSlowCmd>0)
|
||||
{
|
||||
// send special command, slowly
|
||||
datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++];
|
||||
if (datif_pNextCmd >= datif_maxNrCommands)
|
||||
datif_pNextCmd=0;
|
||||
if (datif_sendNow>0) // never send Command 0
|
||||
datif_sendIOrequest(0, datif_sendNow, 0);
|
||||
else
|
||||
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
||||
|
||||
//qDebug()<< "datif send request " << datif_sendNow;
|
||||
if (gpi_getNowCoinPay())
|
||||
{
|
||||
// send only important commands while transaction in progress
|
||||
if (datif_pNextCmd>=datif_maxVendingCmds ) datif_pNextCmd=0;
|
||||
datif_sendNow=datif_vendRequCommandList[datif_pNextCmd++];
|
||||
if (datif_sendNow>0) // never send Command 0
|
||||
{
|
||||
datif_sendIOrequest(0, datif_sendNow, 0);
|
||||
//qDebug() << "datif, VEND-request: " << datif_sendNow;
|
||||
} else
|
||||
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
||||
|
||||
} else
|
||||
{
|
||||
if (gpi_getNowCoinPay())
|
||||
// no transaction, request all but request DI's more frequently
|
||||
if (datif_sendSlowCmd>0) // send slow and fast commands alternating
|
||||
{
|
||||
// request coin input, high priority
|
||||
datif_sendIOrequest(0, 112, 0);
|
||||
//qDebug()<< "datif send request 112 get coins";
|
||||
// send special command, slowly
|
||||
if (datif_pNextCmd>=datif_maxNrCommands ) datif_pNextCmd=0;
|
||||
datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++];
|
||||
if (datif_sendNow>0) // never send Command 0
|
||||
{
|
||||
datif_sendIOrequest(0, datif_sendNow, 0);
|
||||
// qDebug() << "datif, auto-requ: " << datif_sendNow;
|
||||
} else
|
||||
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
|
||||
} else
|
||||
{
|
||||
// request inputs, high priority
|
||||
datif_sendIOrequest(0, 31, 0); // 102
|
||||
// while coin collection DIs are polled slowly with datif_autoRequCommandList[]
|
||||
|
||||
//qDebug()<< "datif send request 102 get DIs";
|
||||
// while coin collection DIs are polled slower
|
||||
//qDebug()<< "datif send requ.31 get DIs";
|
||||
}
|
||||
}
|
||||
|
||||
if (++datif_sendSlowCmd>1) datif_sendSlowCmd=0; // 0,1,0,1,0,1,0....
|
||||
}
|
||||
|
||||
return 0; // 25.9.2023, wichtig sonst bleibt die komplette PTU stehen!!!!
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -439,7 +454,7 @@ char T_datif::loadRecDataFromFrame()
|
||||
uint32_t ultmp;
|
||||
//int portNr;
|
||||
bool ret;
|
||||
uint8_t uctmp; //, res; // maxai
|
||||
uint8_t uctmp; //, nn; //, res; // maxai
|
||||
char ctmp;
|
||||
//static uint8_t lastResult;
|
||||
//uint8_t prnResult;
|
||||
@ -1105,9 +1120,7 @@ char T_datif::loadRecDataFromFrame()
|
||||
break;
|
||||
|
||||
case 42: // get BNA box content and value of types
|
||||
// qDebug()<< "CAmaster datif_got 42 ";
|
||||
// for (uctmp=0; uctmp<64; uctmp++)
|
||||
// qDebug()<<receivedData[uctmp]<<" ";
|
||||
//qDebug()<< "CAslave datif_got 42";
|
||||
|
||||
if (RdDleng>60)
|
||||
{
|
||||
|
@ -109,10 +109,6 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
|
||||
|
||||
void hwapi::hwapi_slotPayProc(void)
|
||||
{
|
||||
//cash_paymentProcessing();
|
||||
//doors_supervise();
|
||||
//dcBL_cycle();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -3056,7 +3052,9 @@ bool hwapi::cash_cancelPayment(void) const
|
||||
{
|
||||
// DB1: 1=encash 2=cancel & return coins
|
||||
// 3=stop and keep coins in escrow
|
||||
epi_setNowCoinPay(false); // new since 20.9.23
|
||||
//epi_setNowCoinPay(false); // new since 20.9.23
|
||||
// am 6.12.23 wieder raus, waehrend Druck und wechseln auch schnell abfragen
|
||||
|
||||
//qCritical() << "cash cancel payment and return coins";
|
||||
return sendFDcmd_set(156, 0,0, 2,0,0,0);
|
||||
}
|
||||
@ -3066,7 +3064,8 @@ bool hwapi::cash_stopPayment(void) const
|
||||
{
|
||||
// DB1: 1=encash 2=cancel & return coins
|
||||
// 3=stop and keep coins in escrow
|
||||
epi_setNowCoinPay(false); // new since 20.9.23
|
||||
//epi_setNowCoinPay(false); // new since 20.9.23
|
||||
// am 6.12.23 wieder raus, waehrend Druck und wechseln auch schnell abfragen
|
||||
//qCritical() << "cash stop payment and keep coins in escrow";
|
||||
// qCritical() << "emitting signal StopByPushbutton 2";
|
||||
emit hwapi_payStopByPushbutton();
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -1,5 +1,16 @@
|
||||
#ifdef WIN32
|
||||
|
||||
#ifndef WIN32
|
||||
#include <QCoreApplication>
|
||||
#include "tslib.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#undef _FORTIFY_SOURCE
|
||||
|
||||
|
@ -29,25 +29,31 @@ T_runProc::T_runProc()
|
||||
QTimer *runProc_callProcesses = new QTimer();
|
||||
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
|
||||
runProc_callProcesses->setSingleShot(false);
|
||||
runProc_callProcesses->start(100); // in ms
|
||||
runProc_callProcesses->start(10); // in ms
|
||||
|
||||
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
|
||||
// bit0: upper door 1:middle 2:lower 3=cash-box out
|
||||
|
||||
hwapi_triggerBL = new QTimer();
|
||||
connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
||||
hwapi_triggerBL->setSingleShot(false);
|
||||
hwapi_triggerBL->stop();
|
||||
// hwapi_triggerBL = new QTimer();
|
||||
// connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
||||
// hwapi_triggerBL->setSingleShot(false);
|
||||
// hwapi_triggerBL->stop();
|
||||
|
||||
myTO = new QTimer();
|
||||
myTO->setSingleShot(true);
|
||||
myTO->start(200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void T_runProc::runProc_slotProcess(void)
|
||||
{
|
||||
#ifndef THIS_IS_CA_MASTER
|
||||
cash_paymentProcessing();
|
||||
doors_supervise();
|
||||
bl_performComplStart(); // neu 1.12.23
|
||||
dcBL_cycle();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool T_runProc::cash_startPayment(uint32_t amount)
|
||||
@ -654,7 +660,7 @@ bool T_runProc::bl_isUp(void)
|
||||
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
|
||||
{
|
||||
qDebug() << "got BL response to readFWversion";
|
||||
epi_clrRawReceivedString();
|
||||
//epi_clrRawReceivedString();
|
||||
return true;
|
||||
}
|
||||
// response to "start BL"
|
||||
@ -662,7 +668,7 @@ bool T_runProc::bl_isUp(void)
|
||||
receivedData[3]==223 && receivedData[4] ==131 )
|
||||
{
|
||||
qDebug() << "hwapi_bl_isUp: got BL response to start";
|
||||
epi_clrRawReceivedString();
|
||||
//epi_clrRawReceivedString();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -677,7 +683,8 @@ void T_runProc::bl_completeStart(void)
|
||||
|
||||
bool T_runProc::bl_performComplStart(void)
|
||||
{
|
||||
// must be called cyclic by timer
|
||||
bool result;
|
||||
|
||||
static uint8_t retryCtr;
|
||||
|
||||
if ((bl_startupStep<1) || (bl_startupStep>10))
|
||||
@ -691,58 +698,69 @@ bool T_runProc::bl_performComplStart(void)
|
||||
|
||||
if (bl_startupStep==2)
|
||||
{
|
||||
qDebug()<<"rebooting";
|
||||
bl_rebootDC();
|
||||
hwapi_triggerBL->stop();
|
||||
hwapi_triggerBL->start(1000); // call next step in 1s
|
||||
myTO->stop();
|
||||
myTO->start(500);
|
||||
retryCtr=0;
|
||||
bl_startupStep++;
|
||||
} else
|
||||
|
||||
if (bl_startupStep==3)
|
||||
{
|
||||
//qDebug()<<"starting BL";
|
||||
if (!myTO->isActive())
|
||||
{
|
||||
qDebug()<<"starting BL";
|
||||
bl_startBL();
|
||||
hwapi_triggerBL->stop();
|
||||
hwapi_triggerBL->start(100);
|
||||
myTO->stop();
|
||||
myTO->start(500);
|
||||
bl_startupStep++;
|
||||
|
||||
}
|
||||
} else
|
||||
|
||||
if (bl_startupStep==4)
|
||||
{
|
||||
//if (!myTO->isActive())
|
||||
//{
|
||||
if (!myTO->isActive())
|
||||
{
|
||||
qDebug()<<"checking BL";
|
||||
bl_checkBL();
|
||||
hwapi_triggerBL->stop();
|
||||
hwapi_triggerBL->start(100);
|
||||
myTO->stop();
|
||||
myTO->start(200);
|
||||
bl_startupStep++;
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
} else
|
||||
|
||||
if (bl_startupStep==5)
|
||||
{
|
||||
hwapi_triggerBL->stop();
|
||||
if (bl_isUp())
|
||||
if (!myTO->isActive())
|
||||
{
|
||||
qDebug()<<"step 5";
|
||||
result = bl_isUp();
|
||||
qDebug()<<"BL result: "<< result;
|
||||
if (result)
|
||||
{
|
||||
bl_startupStep=99;
|
||||
qDebug()<<"BL is working now...";
|
||||
// BL is up and running
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
retryCtr++; // start again
|
||||
if (retryCtr>=15)
|
||||
if (retryCtr>=10)
|
||||
{
|
||||
bl_startupStep=99;
|
||||
//qDebug()<<"BL error!!!";
|
||||
qDebug()<<"BL error!!!";
|
||||
} else
|
||||
{
|
||||
bl_startupStep=3;
|
||||
//qDebug()<<"BL retry...";
|
||||
myTO->stop();
|
||||
myTO->start(200);
|
||||
qDebug()<<"BL retry...";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user