Compare commits
9 Commits
cea817cbcb
...
8c261af1a7
Author | SHA1 | Date | |
---|---|---|---|
8c261af1a7 | |||
e0346e0a9b | |||
16b6ea8087 | |||
9bdc08f6fc | |||
a3bc3d53cd | |||
9971b7ac2e | |||
15ada1ad26 | |||
1811842082 | |||
13ff32b108 |
@ -1,6 +1,13 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
CONFIG += ordered
|
||||
SUBDIRS = lib_ca_master lib_ca_slave CArunGUI dCArun
|
||||
|
||||
CArunGUI.depends = lib_ca_master lib_ca_slave
|
||||
dCArun.depends = lib_ca_master lib_ca_slave
|
||||
|
||||
TEMPLATE = lib
|
||||
INCLUDEPATH += $${PWD}/plugins
|
||||
INCLUDEPATH += $${PWD}/include
|
||||
QT -= gui
|
||||
QT += widgets serialport
|
||||
|
@ -39,9 +39,10 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
||||
#include "controlBus.h"
|
||||
#include "storeINdata.h"
|
||||
#include "dcBL.h"
|
||||
#include "interfaces.h"
|
||||
//#include <../plugins/interfaces.h>
|
||||
#include "shared_mem_buffer.h"
|
||||
#include "runProc.h"
|
||||
#include "interfaces.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -74,9 +75,7 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
|
||||
//#undef THIS_IS_CA_MASTER
|
||||
|
||||
//for CAmaster:
|
||||
#ifndef THIS_IS_CA_MASTER
|
||||
#define THIS_IS_CA_MASTER
|
||||
#endif
|
||||
//#define THIS_IS_CA_MASTER
|
||||
|
||||
|
||||
|
||||
@ -1300,8 +1299,15 @@ public:
|
||||
|
||||
uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const override;
|
||||
// returns number of collected bank notes since start-command (current transaction)
|
||||
// latestBill: last accepted bank note, value in cent
|
||||
// currentNotes an array with up to 16 (further) notes collected
|
||||
// return value: numbers of bills or 99 in case of error
|
||||
// latestBill: not used
|
||||
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
|
||||
// in normal case:
|
||||
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
|
||||
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
|
||||
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
|
||||
// currentNotes[2]: total sum of bills in cent, low word (16bit)
|
||||
// currentNotes[3]: total sum of bills in cent, high word (16bit)
|
||||
|
||||
void bna_requestStackerLevel(void) const override;
|
||||
|
||||
|
@ -527,6 +527,9 @@ void gpi_storeDcDataValid(bool isVal);
|
||||
|
||||
bool epi_areDcDataValid();
|
||||
|
||||
void epi_setDcDataValid(void);
|
||||
|
||||
void epi_resetDcDataValid(void);
|
||||
|
||||
|
||||
void epi_clearDynData(void);
|
||||
|
@ -5,6 +5,7 @@ VERSION="1.0.0"
|
||||
include(../DCLibraries.pri)
|
||||
|
||||
DEFINES+=THIS_IS_CA_MASTER
|
||||
DEFINES-=THIS_IS_CA_SLAVE
|
||||
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
||||
|
||||
unix {
|
||||
|
@ -4,6 +4,15 @@ VERSION="1.0.0"
|
||||
|
||||
include(../DCLibraries.pri)
|
||||
|
||||
HEADERS -= $$PWD/include/com.h \
|
||||
$$PWD/include/datIf.h \
|
||||
$$PWD/include/prot.h
|
||||
|
||||
SOURCES -= \
|
||||
$${PWD}/src/datIf.cpp \
|
||||
$${PWD}/src/prot.cpp \
|
||||
$${PWD}/src/com.cpp
|
||||
|
||||
DEFINES+=THIS_IS_CA_SLAVE
|
||||
DESTDIR=$${_PRO_FILE_PWD_}/../build
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
History:
|
||||
06.12.2023: weitere IN-requests in Autorequest übernommen
|
||||
Umschaltung mit/ohne Verkauf, während VK nur 12 wichtige, sonst alle 36
|
||||
|
||||
|
||||
*/
|
||||
#include "datIf.h"
|
||||
#include "sendWRcmd.h"
|
||||
#include "controlBus.h"
|
||||
@ -81,7 +88,8 @@ T_datif::T_datif(QObject *parent) : QObject(parent)
|
||||
dif_scanStep=0;
|
||||
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
||||
cycl_running=0;
|
||||
gpi_storeDcDataValid(0); // data are not yet valid, no response from DC by now
|
||||
epi_resetDcDataValid(); // data are not yet valid, no response from DC by now
|
||||
|
||||
datif_noResponseCtr=0;
|
||||
|
||||
datif_repeatCtr=0;
|
||||
@ -137,14 +145,14 @@ char T_datif::datif_cycleSend()
|
||||
if ( !myDCIF->isPortOpen())
|
||||
{
|
||||
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
|
||||
gpi_storeDcDataValid(0); // DC data not valid
|
||||
epi_resetDcDataValid(); // DC data not valid
|
||||
return 0;
|
||||
}
|
||||
|
||||
// supervise if DC data are valid
|
||||
datif_noResponseCtr++; // inc every 20ms
|
||||
if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s
|
||||
gpi_storeDcDataValid(0); // DC data has not updated for >=5s -> no longer valid!
|
||||
epi_resetDcDataValid(); // DC data has not updated for >=5s -> no longer valid!
|
||||
|
||||
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
|
||||
if (gpi_wantToResetSupervision())
|
||||
@ -337,7 +345,7 @@ char T_datif::datif_cycleSend()
|
||||
else
|
||||
{
|
||||
dif_scanStep=0; // always start from beginning
|
||||
gpi_storeDcDataValid(0);
|
||||
epi_resetDcDataValid();
|
||||
}
|
||||
|
||||
datif_cmdWasPerformed=0; // 0: no response by now
|
||||
@ -362,8 +370,8 @@ char T_datif::sendINrequestsAutomatic(void)
|
||||
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;
|
||||
uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,23,0,0};
|
||||
uint8_t datif_maxVendingCmds=13;
|
||||
|
||||
// special commands:
|
||||
// 102: get IOs run constantly!!!
|
||||
@ -1029,7 +1037,7 @@ char T_datif::loadRecDataFromFrame()
|
||||
case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
|
||||
if (RdDleng>50)
|
||||
{
|
||||
gpi_storeDcDataValid(1); // DC-Data are valid as DC responded.
|
||||
epi_setDcDataValid(); // DC-Data are valid as DC responded.
|
||||
// Could be set to every response but this (31)
|
||||
// is a very common and very important request
|
||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
||||
|
@ -49,9 +49,19 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
|
||||
// {
|
||||
|
||||
#ifdef THIS_IS_CA_MASTER
|
||||
|
||||
#ifdef THIS_IS_CA_SLAVE
|
||||
#error "SLAVE LIB COMPILED INTO MASTER"
|
||||
#endif
|
||||
|
||||
myDatif = new T_datif(); // für die CAslave-Lib auskommentieren!
|
||||
|
||||
#else
|
||||
qCritical()<<"hwapi: error CAslave cannot include T_datif";
|
||||
|
||||
#ifdef THIS_IS_CA_MASTER
|
||||
#error "MASTER LIB COMPILED INTO MASTER"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// }
|
||||
|
@ -269,14 +269,14 @@ uint8_t T_runProc::cash_paymentProcessing(void)
|
||||
emit runProc_payStopByEscrow();
|
||||
}
|
||||
|
||||
/* 5.10.23 raus, geht auf 99 wenn Betrag erreicht, ist aber kein fehler
|
||||
// 5.10.23 raus, geht auf 99 wenn Betrag erreicht, ist aber kein fehler
|
||||
if ( (empState<10) || (empState>12)) // error
|
||||
{
|
||||
collActiv=13;
|
||||
hwapi_paymentStarted=90;
|
||||
qCritical() << "emitting signal payStopByError" << empState;
|
||||
emit runProc_payStopByError();
|
||||
} */
|
||||
//collActiv=13;
|
||||
//hwapi_paymentStarted=90;
|
||||
//qCritical() << "emitting signal payStopByError" << empState;
|
||||
//emit runProc_payStopByError();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1984,7 +1984,7 @@ void epi_iniVRstorage(void)
|
||||
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data )
|
||||
{
|
||||
uint16_t start=blkNr, ii;
|
||||
//qDebug()<<"storing vault data "<<blkNr;
|
||||
qDebug()<<"storing vault data "<<blkNr;
|
||||
SharedMem::write()->store_gotNrBlocksOfVaultRec |= (1<<start); // setze pro Block ein bit, wir brauchen block 0...5
|
||||
// also muss store_gotNrBlocksOfVaultRec auf 0x1F stehen
|
||||
start<<=6; // *64
|
||||
@ -2054,13 +2054,50 @@ uint16_t epi_getNrOfCoinsInCashBox(void)
|
||||
|
||||
void gpi_storeDcDataValid(bool isVal)
|
||||
{
|
||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
||||
if (isVal != now)
|
||||
{
|
||||
SharedMem::write()->store_DcDataAreValid = isVal;
|
||||
#ifdef THIS_IS_CA_MASTER
|
||||
qDebug()<<"master lib sets DcDataValid to "<<isVal;
|
||||
#else
|
||||
qDebug()<<"slave lib sets DcDataValid to "<<isVal;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void epi_setDcDataValid(void)
|
||||
{
|
||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
||||
if (now==false)
|
||||
{
|
||||
SharedMem::write()->store_DcDataAreValid = true;
|
||||
#ifdef THIS_IS_CA_MASTER
|
||||
qDebug()<<"master lib SET DcDataValid";
|
||||
#else
|
||||
qDebug()<<"slave lib SET DcDataValid";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void epi_resetDcDataValid(void)
|
||||
{
|
||||
bool now=SharedMem::read()->store_DcDataAreValid;
|
||||
if (now==true)
|
||||
{
|
||||
SharedMem::write()->store_DcDataAreValid = false;
|
||||
#ifdef THIS_IS_CA_MASTER
|
||||
qDebug()<<"master lib RESET DcDataValid";
|
||||
#else
|
||||
qDebug()<<"slave lib RESET DcDataValid";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool epi_areDcDataValid()
|
||||
{
|
||||
return SharedMem::read()->store_DcDataAreValid;
|
||||
|
||||
}
|
||||
|
||||
// ....................................................................................
|
||||
|
Loading…
x
Reference in New Issue
Block a user