Extend sendINrequestsAutomatic(): add several requests.

This commit is contained in:
Thomas Sax 2023-12-06 14:33:30 +01:00
parent fc2bc6bafc
commit f817d07e8c

View File

@ -350,9 +350,20 @@ 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[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,
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}; // 31, 32, 33, 35, 102, 103, 104, 106, 107, 109,
uint8_t datif_maxNrCommands=21, datif_sendNow; // 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: // special commands:
// 102: get IOs run constantly!!! // 102: get IOs run constantly!!!
@ -362,40 +373,44 @@ 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)
{
// 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 } 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 // send special command, slowly
datif_sendIOrequest(0, 112, 0); if (datif_pNextCmd>=datif_maxNrCommands ) datif_pNextCmd=0;
//qDebug()<< "datif send request 112 get coins"; 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 } 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 slowly with datif_autoRequCommandList[] // while coin collection DIs are polled slower
//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!!!!
} }
@ -439,7 +454,7 @@ char T_datif::loadRecDataFromFrame()
uint32_t ultmp; uint32_t ultmp;
//int portNr; //int portNr;
bool ret; bool ret;
uint8_t uctmp; //, res; // maxai uint8_t uctmp; //, nn; //, res; // maxai
char ctmp; char ctmp;
//static uint8_t lastResult; //static uint8_t lastResult;
//uint8_t prnResult; //uint8_t prnResult;
@ -1061,11 +1076,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;
@ -1105,9 +1120,7 @@ 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()<< "CAmaster datif_got 42 "; //qDebug()<< "CAslave datif_got 42";
// for (uctmp=0; uctmp<64; uctmp++)
// qDebug()<<receivedData[uctmp]<<" ";
if (RdDleng>60) if (RdDleng>60)
{ {