Compare commits

..

No commits in common. "27c0aa56ee73aaae37287a8482ff5b24065c3037" and "78700e7beaa405403608c61b18df6be76308d770" have entirely different histories.

8 changed files with 96 additions and 174 deletions

View File

@ -1,7 +1,6 @@
#ifndef DATEI_H #ifndef DATEI_H
#define DATEI_H #define DATEI_H
#include <stdint.h>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QDebug>

View File

@ -26,8 +26,6 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
#ifndef hwapi_H #ifndef hwapi_H
#define hwapi_H #define hwapi_H
#include <stdint.h>
//#include <QTabWidget>
#include <QtPlugin> #include <QtPlugin>
#include <QTimer> #include <QTimer>
#include <QObject> #include <QObject>
@ -71,12 +69,9 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
*/ */
//for CAslave: //for CAslave:
//#undef THIS_IS_CA_MASTER //#undef THIS_IS_CA_MASTER
//for CAmaster: //for CAmaster:
#define THIS_IS_CA_MASTER
class QSharedMemory; class QSharedMemory;
@ -1310,35 +1305,31 @@ public:
signals: signals:
void hwapi_templatePrintFinished_OK(void) const override; // already declared in interfaces.h
void hwapi_templatePrintFinished_Err(void) const override; void hwapi_templatePrintFinished_OK(void) const;
void hwapi_templatePrintFinished_Err(void) const;
void hwapi_coinCollectionJustStarted(void) const override; void hwapi_coinCollectionJustStarted(void) const;
void hwapi_coinCollectionAborted(void) const override; void hwapi_coinCollectionAborted(void) const;
void hwapi_gotNewCoin(void) const override; void hwapi_gotNewCoin(void) const;
void hwapi_payStopByMax(void) const override; void hwapi_payStopByMax(void) const;
void hwapi_payStopByPushbutton(void) const override; void hwapi_payStopByPushbutton(void) const;
void hwapi_payStopByEscrow(void) const override; void hwapi_payStopByEscrow(void) const;
void hwapi_payStopByError(void) const override; void hwapi_payStopByError(void) const;
void hwapi_payStopByTimeout(void) const override; void hwapi_payStopByTimeout(void) const;
void hwapi_payCancelled(void) const override; void hwapi_payCancelled(void) const;
void hwapi_coinProcessJustStopped(void) const override; void hwapi_coinProcessJustStopped(void) const;
// new from 2023.06.12 // new from 2023.06.12
void hwapi_doorServiceDoorOpened(void) const override; void hwapi_doorServiceDoorOpened(void) const;
void hwapi_doorVaultDoorOpened(void) const override; void hwapi_doorVaultDoorOpened(void) const;
void hwapi_doorCoinBoxRemoved(void) const override; void hwapi_doorCoinBoxRemoved(void) const;
void hwapi_doorCoinBoxInserted(void) const override; void hwapi_doorCoinBoxInserted(void) const;
void hwapi_doorCBinAndAllDoorsClosed(void) const override; void hwapi_doorCBinAndAllDoorsClosed(void) const;
void hwapi_doorAllDoorsClosed(void) const override; void hwapi_doorAllDoorsClosed(void) const;
private slots: private slots:
//void hwapi_slotPrintFinished_OK(void); //void hwapi_slotPrintFinished_OK(void);

View File

@ -2276,32 +2276,7 @@ public:
signals: 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. // 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_OK() const;
void hwapi_templatePrintFinished_Err() const; void hwapi_templatePrintFinished_Err() const;
@ -2324,7 +2299,6 @@ signals:
void hwapi_doorCoinBoxInserted() const; void hwapi_doorCoinBoxInserted() const;
void hwapi_doorCBinAndAllDoorsClosed() const; void hwapi_doorCBinAndAllDoorsClosed() const;
void hwapi_doorAllDoorsClosed() const; void hwapi_doorAllDoorsClosed() const;
*/
}; };

View File

@ -2,7 +2,6 @@
#ifndef RUN_PROCESS_H #ifndef RUN_PROCESS_H
#define RUN_PROCESS_H #define RUN_PROCESS_H
#include <stdint.h>
#include <QMainWindow> #include <QMainWindow>
#include <QString> #include <QString>
#include <QTimer> #include <QTimer>
@ -26,7 +25,7 @@
class T_runProc : public QObject class T_runProc : public QObject
{ {
Q_OBJECT Q_OBJECT
QTimer *hwapi_TimerPayment, *hwapi_triggerBL, *myTO; QTimer *hwapi_TimerPayment, *hwapi_triggerBL;
void sub_emp_getAllParameters(struct T_emp *emp); void sub_emp_getAllParameters(struct T_emp *emp);
void changer_getAllParameters(struct T_changer *mw); void changer_getAllParameters(struct T_changer *mw);

View File

@ -350,20 +350,9 @@ char T_datif::datif_cycleSend()
char T_datif::sendINrequestsAutomatic(void) char T_datif::sendINrequestsAutomatic(void)
{ {
//qDebug() << "send IN request " << dif_scanStep; //qDebug() << "send IN request " << dif_scanStep;
//uint8_t datif_autoRequCommandList[30]={11, 12, 14, 17, 18, 19, 22, 23, 27, 30, // uint8_t datif_autoRequCommandList[50]={11, 12, 18, 104, 106, 103, 14, 27, 109, 17, 19, 23, 30, 31, 32, 33, 114, 35};
// 31, 32, 33, 35, 102, 103, 104, 106, 107, 109, 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};
// 114,0,0,0,0,0,0,0,0,0}; uint8_t datif_maxNrCommands=21, datif_sendNow;
// 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: // special commands:
// 102: get IOs run constantly!!! // 102: get IOs run constantly!!!
@ -373,44 +362,40 @@ char T_datif::sendINrequestsAutomatic(void)
// 107, 22: MDB: poll if needed // 107, 22: MDB: poll if needed
doRepeat=true; // 20.9.23 15uhr (after release) doRepeat=true; // 20.9.23 15uhr (after release)
if (datif_sendSlowCmd>0)
if (gpi_getNowCoinPay())
{ {
// send only important commands while transaction in progress // send special command, slowly
if (datif_pNextCmd>=datif_maxVendingCmds ) datif_pNextCmd=0; datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++];
datif_sendNow=datif_vendRequCommandList[datif_pNextCmd++]; if (datif_pNextCmd >= datif_maxNrCommands)
datif_pNextCmd=0;
if (datif_sendNow>0) // never send Command 0 if (datif_sendNow>0) // never send Command 0
{
datif_sendIOrequest(0, datif_sendNow, 0); datif_sendIOrequest(0, datif_sendNow, 0);
//qDebug() << "datif, VEND-request: " << datif_sendNow; else
} else
datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen datif_pNextCmd=0; // falls in der Liste 0 vorkommt dann von vorne beginnen
//qDebug()<< "datif send request " << datif_sendNow;
} else } else
{ {
// no transaction, request all but request DI's more frequently if (gpi_getNowCoinPay())
if (datif_sendSlowCmd>0) // send slow and fast commands alternating
{ {
// send special command, slowly // request coin input, high priority
if (datif_pNextCmd>=datif_maxNrCommands ) datif_pNextCmd=0; datif_sendIOrequest(0, 112, 0);
datif_sendNow=datif_autoRequCommandList[datif_pNextCmd++]; //qDebug()<< "datif send request 112 get coins";
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 } else
{ {
// request inputs, high priority // request inputs, high priority
datif_sendIOrequest(0, 31, 0); // 102 datif_sendIOrequest(0, 31, 0); // 102
// while coin collection DIs are polled slower // while coin collection DIs are polled slowly with datif_autoRequCommandList[]
//qDebug()<< "datif send requ.31 get DIs";
//qDebug()<< "datif send request 102 get DIs";
} }
if (++datif_sendSlowCmd>1) datif_sendSlowCmd=0; // 0,1,0,1,0,1,0....
} }
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!!!! return 0; // 25.9.2023, wichtig sonst bleibt die komplette PTU stehen!!!!
} }
@ -454,7 +439,7 @@ char T_datif::loadRecDataFromFrame()
uint32_t ultmp; uint32_t ultmp;
//int portNr; //int portNr;
bool ret; bool ret;
uint8_t uctmp; //, nn; //, res; // maxai uint8_t uctmp; //, res; // maxai
char ctmp; char ctmp;
//static uint8_t lastResult; //static uint8_t lastResult;
//uint8_t prnResult; //uint8_t prnResult;
@ -1076,11 +1061,11 @@ char T_datif::loadRecDataFromFrame()
/* /*
qDebug()<<"datif cmd38 got vault data. blockNr: "<<readAddress; qDebug()<<"datif cmd38 got vault data. blockNr: "<<readAddress;
if (readAddress==0) if (readAddress==0)
for (nn=0; nn<64; nn+=8) for (nn=0; nn<64; nn+=8)
{ {
qDebug()<<receivedData[nn]<<" "<<receivedData[nn+1]<<" "<<receivedData[nn+2]<<" "<<receivedData[nn+3]<<" " qDebug()<<receivedData[nn]<<" "<<receivedData[nn+1]<<" "<<receivedData[nn+2]<<" "<<receivedData[nn+3]<<" "
<<receivedData[nn+4]<<" "<<receivedData[nn+5]<<" "<<receivedData[nn+6]<<" "<<receivedData[nn+7]; <<receivedData[nn+4]<<" "<<receivedData[nn+5]<<" "<<receivedData[nn+6]<<" "<<receivedData[nn+7];
} }
*/ */
//} //}
break; break;
@ -1120,7 +1105,9 @@ char T_datif::loadRecDataFromFrame()
break; break;
case 42: // get BNA box content and value of types case 42: // get BNA box content and value of types
//qDebug()<< "CAslave datif_got 42"; // qDebug()<< "CAmaster datif_got 42 ";
// for (uctmp=0; uctmp<64; uctmp++)
// qDebug()<<receivedData[uctmp]<<" ";
if (RdDleng>60) if (RdDleng>60)
{ {

View File

@ -109,6 +109,10 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
void hwapi::hwapi_slotPayProc(void) void hwapi::hwapi_slotPayProc(void)
{ {
//cash_paymentProcessing();
//doors_supervise();
//dcBL_cycle();
} }
@ -3052,9 +3056,7 @@ bool hwapi::cash_cancelPayment(void) const
{ {
// DB1: 1=encash 2=cancel & return coins // DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow // 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"; //qCritical() << "cash cancel payment and return coins";
return sendFDcmd_set(156, 0,0, 2,0,0,0); return sendFDcmd_set(156, 0,0, 2,0,0,0);
} }
@ -3064,8 +3066,7 @@ bool hwapi::cash_stopPayment(void) const
{ {
// DB1: 1=encash 2=cancel & return coins // DB1: 1=encash 2=cancel & return coins
// 3=stop and keep coins in escrow // 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() << "cash stop payment and keep coins in escrow";
// qCritical() << "emitting signal StopByPushbutton 2"; // qCritical() << "emitting signal StopByPushbutton 2";
emit hwapi_payStopByPushbutton(); emit hwapi_payStopByPushbutton();

View File

@ -1,16 +1,5 @@
#ifdef WIN32
#include <QCoreApplication> #ifndef WIN32
#include "tslib.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
#else
#undef _FORTIFY_SOURCE #undef _FORTIFY_SOURCE

View File

@ -29,31 +29,25 @@ T_runProc::T_runProc()
QTimer *runProc_callProcesses = new QTimer(); QTimer *runProc_callProcesses = new QTimer();
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess())); connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
runProc_callProcesses->setSingleShot(false); runProc_callProcesses->setSingleShot(false);
runProc_callProcesses->start(10); // in ms runProc_callProcesses->start(100); // in ms
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
// bit0: upper door 1:middle 2:lower 3=cash-box out // bit0: upper door 1:middle 2:lower 3=cash-box out
// hwapi_triggerBL = new QTimer(); hwapi_triggerBL = new QTimer();
// connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart())); connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
// hwapi_triggerBL->setSingleShot(false); hwapi_triggerBL->setSingleShot(false);
// hwapi_triggerBL->stop(); hwapi_triggerBL->stop();
myTO = new QTimer();
myTO->setSingleShot(true);
myTO->start(200);
} }
void T_runProc::runProc_slotProcess(void) void T_runProc::runProc_slotProcess(void)
{ {
#ifndef THIS_IS_CA_MASTER
cash_paymentProcessing(); cash_paymentProcessing();
doors_supervise(); doors_supervise();
bl_performComplStart(); // neu 1.12.23
dcBL_cycle(); dcBL_cycle();
#endif
} }
bool T_runProc::cash_startPayment(uint32_t amount) bool T_runProc::cash_startPayment(uint32_t amount)
@ -660,7 +654,7 @@ bool T_runProc::bl_isUp(void)
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176) receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
{ {
qDebug() << "got BL response to readFWversion"; qDebug() << "got BL response to readFWversion";
//epi_clrRawReceivedString(); epi_clrRawReceivedString();
return true; return true;
} }
// response to "start BL" // response to "start BL"
@ -668,7 +662,7 @@ bool T_runProc::bl_isUp(void)
receivedData[3]==223 && receivedData[4] ==131 ) receivedData[3]==223 && receivedData[4] ==131 )
{ {
qDebug() << "hwapi_bl_isUp: got BL response to start"; qDebug() << "hwapi_bl_isUp: got BL response to start";
//epi_clrRawReceivedString(); epi_clrRawReceivedString();
return true; return true;
} }
} }
@ -683,8 +677,7 @@ void T_runProc::bl_completeStart(void)
bool T_runProc::bl_performComplStart(void) bool T_runProc::bl_performComplStart(void)
{ {
bool result; // must be called cyclic by timer
static uint8_t retryCtr; static uint8_t retryCtr;
if ((bl_startupStep<1) || (bl_startupStep>10)) if ((bl_startupStep<1) || (bl_startupStep>10))
@ -698,69 +691,58 @@ bool T_runProc::bl_performComplStart(void)
if (bl_startupStep==2) if (bl_startupStep==2)
{ {
qDebug()<<"rebooting";
bl_rebootDC(); bl_rebootDC();
myTO->stop(); hwapi_triggerBL->stop();
myTO->start(500); hwapi_triggerBL->start(1000); // call next step in 1s
retryCtr=0; retryCtr=0;
bl_startupStep++; bl_startupStep++;
} else } else
if (bl_startupStep==3) if (bl_startupStep==3)
{ {
if (!myTO->isActive()) //qDebug()<<"starting BL";
{ bl_startBL();
qDebug()<<"starting BL"; hwapi_triggerBL->stop();
bl_startBL(); hwapi_triggerBL->start(100);
myTO->stop(); bl_startupStep++;
myTO->start(500);
bl_startupStep++;
}
} else } else
if (bl_startupStep==4) if (bl_startupStep==4)
{ {
if (!myTO->isActive()) //if (!myTO->isActive())
{ //{
qDebug()<<"checking BL"; bl_checkBL();
bl_checkBL(); hwapi_triggerBL->stop();
myTO->stop(); hwapi_triggerBL->start(100);
myTO->start(200); bl_startupStep++;
bl_startupStep++;
} //}
} else } else
if (bl_startupStep==5) if (bl_startupStep==5)
{ {
if (!myTO->isActive()) hwapi_triggerBL->stop();
if (bl_isUp())
{ {
qDebug()<<"step 5"; bl_startupStep=99;
result = bl_isUp(); // BL is up and running
qDebug()<<"BL result: "<< result; } else
if (result) {
retryCtr++; // start again
if (retryCtr>=15)
{ {
bl_startupStep=99; bl_startupStep=99;
qDebug()<<"BL is working now..."; //qDebug()<<"BL error!!!";
// BL is up and running
return true;
} else } else
{ {
retryCtr++; // start again bl_startupStep=3;
if (retryCtr>=10) //qDebug()<<"BL retry...";
{
bl_startupStep=99;
qDebug()<<"BL error!!!";
} else
{
bl_startupStep=3;
myTO->stop();
myTO->start(200);
qDebug()<<"BL retry...";
}
} }
} }
} }
return false; return true;
} }