Add updated sources of thomas.

This commit is contained in:
2023-03-29 14:32:22 +02:00
parent 49396c22ee
commit 7f23e3ea46
15 changed files with 2036 additions and 756 deletions

View File

@@ -99,13 +99,13 @@ QString epi_getSlaveParamSTR()
static QString genStrings[3];
static QString genStrings[MAXNROF_GENSTR];
// 0=HW 1=SW 2=State
void gpi_storeGenerals(uint8_t genNr, QString text)
{
// 0=HW 1=SW 2=State
if (genNr<3)
if (genNr<MAXNROF_GENSTR)
{
genStrings[genNr]=text;
//qDebug() << "store gen's: " << genNr << " " <<text;
@@ -116,7 +116,13 @@ void gpi_storeGenerals(uint8_t genNr, QString text)
QString epi_loadGenerals(uint8_t genNr)
{
if (genNr<MAXNROF_GENSTR)
{
if (genNr==2) // DC2 State is shorter (8byte, not 64)
//genStrings[2][8]=0;
genStrings[2].chop(8);
return genStrings[genNr];
}
return " ";
}
@@ -132,8 +138,12 @@ void gpi_storeUID(uint8_t *buf8byteUid)
{
uint64_t udltmp=0;
//qDebug()<< "store UID ";
for (int ii=0; ii<8; ii++)
{
//qDebug()<< buf8byteUid[ii] << " ";
Sdata_UIDstr[ii]=buf8byteUid[ii];
udltmp|=buf8byteUid[ii];
udltmp<<=8;
@@ -143,8 +153,10 @@ void gpi_storeUID(uint8_t *buf8byteUid)
void epi_getUIDdec(uint8_t *buf8byteUid)
{
//qDebug()<< "get UID ";
for (int ii=0; ii<8; ii++)
{
//qDebug()<<Sdata_UIDstr[ii] << " ";
buf8byteUid[ii]=Sdata_UIDstr[ii];
}
}
@@ -156,8 +168,12 @@ QString epi_getUIDstr()
QString myStr;
for (int ii=0;ii<8; ii++)
{
myStr+=QString::number(Sdata_UIDstr[ii],16);
return myStr;
myStr+=" ";
}
return myStr;
}
@@ -232,6 +248,7 @@ uint8_t epi_getSquareMode()
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng)
{
/*
// Daten kommen in gleicher Reihenfolge vom Slave
uint8_t *pTime;
pTime=&getGlobalTime.hour;
@@ -239,7 +256,20 @@ void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng)
for (int nn=0; nn<Leng; nn++)
{
*pTime++=timeBuffer[nn];
}
}*/
// new, FastProt: 0=dayOfWeek 1=min 2=sec 3=hours 4=year 5=month 6=dayOfMonth
getGlobalTime.second=Leng; // nur damit CompilerWarnung weg ist
getGlobalTime.DayOfWeek=timeBuffer[0];
getGlobalTime.minute=timeBuffer[1];
getGlobalTime.second=timeBuffer[2];
getGlobalTime.hour=timeBuffer[3];
getGlobalTime.Year=timeBuffer[4];
getGlobalTime.Month=timeBuffer[5];
getGlobalTime.DayOfMonth=timeBuffer[6];
}
void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss)
@@ -604,6 +634,9 @@ void gpi_storeDI_doorSwitches(uint8_t upperDoor, uint8_t lowerDoor, uint8_t vaul
if (lowerDoor) di_doorSwitch |=2;
if (vaultDoor) di_doorSwitch |=4;
// qDebug()<<"storeINdata: "<<upperDoor << lowerDoor << vaultDoor;
// qDebug()<<"storeINdata: "<<di_doorSwitch;
}
uint8_t epi_getDI_doorSwitches(void)
@@ -897,14 +930,15 @@ bool epi_getDI_rejectMotor_homepos(void)
return di_rejMot_home;
}
static bool di_npe_sensor;
static uint8_t di_npe_sensor;
void gpi_storeDI_paperLow(bool di)
void gpi_storeDI_paperLow(uint8_t di)
{
// 0: Sensor sees paper 1: no paper 99: off
di_npe_sensor=di;
}
bool epi_getDI_npe_sensor(void)
uint8_t epi_getDI_npe_sensor(void)
{
return di_npe_sensor;
}
@@ -966,8 +1000,8 @@ uint8_t epi_getDO_motorOuts(void)
static uint8_t do_serialSwitch; // serial drv on/off, Serial mux1, Serial mux2
void gpi_storeDO_serialSwitch(uint8_t state)// serial drv on/off, Serial mux1, Serial mux2
static uint8_t do_serialSwitch; // serial drv on/off, Serial mux1, Serial mux2
void gpi_storeDO_serialSwitch(uint8_t state) // serial drv on/off, Serial mux1, Serial mux2
{
do_serialSwitch=state;
}
@@ -1026,6 +1060,7 @@ bool epi_getDO_serialMux2isSetToMifare(void)
static uint8_t do_ledsAndFan;
void gpi_storeDO_ledsAndFan(uint8_t ledState)
{
// bit0: coinled 1:front_illu 2: paper-led 3:pinpad-led 4:start-led 5:service-led 6:fan
do_ledsAndFan=ledState;
}
@@ -1083,6 +1118,7 @@ bool epi_getDO_fan(void)
static uint8_t do_laermUndRelay;
void gpi_storeDO_sirenAndRelay(uint8_t sirenRelay)
{
// bit0: siren 1:relay
do_laermUndRelay=sirenRelay;
}
@@ -1190,11 +1226,31 @@ uint8_t gpi_storeMifReaderStateAndCardType(uint8_t *buf)
{
// retval 0=OK 1=error host buffer too small
for (uint8_t nn=0; nn<NROFMIFSTATEBYTES; nn++)
Sdata_MIF_STATE[nn]=0;
for (uint8_t nn=0; nn<8; nn++)
Sdata_MIF_STATE[nn]=buf[nn];
return 0; // OK
}
/* data description:
new fast version:
byte 0= still the same: current read state:
0=power off 1=reader-fault 2=ready
3=just reading 4=read complete
5=read partial, removed too early
6=state unknown
byte 1: reader state 1=ok 0=nok
byte 2: card preent (0,1)
byte 3: card selected (0)
byte 4: card type: 0...5
byte 5: card allowed (0=no 1=MifareClassic 1k or 4k)
byte 6: CardSize: 1 or 4 (kB)
byte 7: length of UID 4 or 7 (byte)
old long version
byte 0: current read state: 0=power off 1=reader-fault 2=ready
3=just reading 4=read complete
5=read partial, removed too early
@@ -1217,10 +1273,10 @@ byte 32: result, always 0
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize)
{
// HWapi can read States from DC
if (maxBufferSize<NROFMIFSTATEBYTES)
if (maxBufferSize<8)
return 1; // error
for (uint8_t nn=0; nn<NROFMIFSTATEBYTES; nn++)
for (uint8_t nn=0; nn<8; nn++)
buf[nn]=Sdata_MIF_STATE[nn];
return 0; // OK
@@ -1425,15 +1481,15 @@ void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data)
uint8_t LL=leng; // nr of coin records
uint16_t vv, pp=0;
qDebug()<<"store emp data, len: "<<LL;
//qDebug()<<"store emp data, len: "<<LL;
while (LL>0)
//while (LL>0) // with FastProtocol only one coin
{
vv=uchar2uint(data[pp+4], data[pp+3]);
sub_enterData(data[pp], data[pp+1], data[pp+2], vv );
qDebug()<< "emp IN data: " << data[pp] << " " << data[pp+1]
<< " " <<data[pp+2] <<" " <<data[pp+3] <<" " <<data[pp+4] <<" ";
//qDebug()<< "emp IN data: " << data[pp] << " " << data[pp+1]
// << " " <<data[pp+2] <<" " <<data[pp+3] <<" " <<data[pp+4] <<" ";
pp+=5;
LL--;
@@ -1456,12 +1512,12 @@ void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, u
*error=gotCoin[ctr_gotCoin].error;
*value=gotCoin[ctr_gotCoin].value;
}
/*
qDebug()<<"read emp data, nr "<<ctr_gotCoin << "valid: " << *valid
<< "signal: " << *signal
<< "error: " << *error
<< "value: " << *value;
*/
}