Compare commits

..

No commits in common. "8c261af1a76a077cd0bd0d1e15fedd626f71043e" and "cea817cbcbb9787460749f9135e159e4d73810b7" have entirely different histories.

9 changed files with 22 additions and 103 deletions

View File

@ -1,13 +1,6 @@
TEMPLATE = subdirs TEMPLATE = subdirs
CONFIG += ordered CONFIG += ordered
SUBDIRS = lib_ca_master lib_ca_slave CArunGUI dCArun SUBDIRS = lib_ca_master lib_ca_slave CArunGUI dCArun
CArunGUI.depends = lib_ca_master lib_ca_slave CArunGUI.depends = lib_ca_master lib_ca_slave
dCArun.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

View File

@ -39,10 +39,9 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
#include "controlBus.h" #include "controlBus.h"
#include "storeINdata.h" #include "storeINdata.h"
#include "dcBL.h" #include "dcBL.h"
//#include <../plugins/interfaces.h> #include "interfaces.h"
#include "shared_mem_buffer.h" #include "shared_mem_buffer.h"
#include "runProc.h" #include "runProc.h"
#include "interfaces.h"
/* /*
@ -75,7 +74,9 @@ V4.0 6.9.2023: activating DC-Bootloader in slve-lib (SM)
//#undef THIS_IS_CA_MASTER //#undef THIS_IS_CA_MASTER
//for CAmaster: //for CAmaster:
//#define THIS_IS_CA_MASTER #ifndef THIS_IS_CA_MASTER
#define THIS_IS_CA_MASTER
#endif
@ -1299,15 +1300,8 @@ public:
uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const override; uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const override;
// returns number of collected bank notes since start-command (current transaction) // returns number of collected bank notes since start-command (current transaction)
// return value: numbers of bills or 99 in case of error // latestBill: last accepted bank note, value in cent
// latestBill: not used // currentNotes an array with up to 16 (further) notes collected
// 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; void bna_requestStackerLevel(void) const override;

View File

@ -527,9 +527,6 @@ void gpi_storeDcDataValid(bool isVal);
bool epi_areDcDataValid(); bool epi_areDcDataValid();
void epi_setDcDataValid(void);
void epi_resetDcDataValid(void);
void epi_clearDynData(void); void epi_clearDynData(void);

View File

@ -5,7 +5,6 @@ VERSION="1.0.0"
include(../DCLibraries.pri) include(../DCLibraries.pri)
DEFINES+=THIS_IS_CA_MASTER DEFINES+=THIS_IS_CA_MASTER
DEFINES-=THIS_IS_CA_SLAVE
DESTDIR=$${_PRO_FILE_PWD_}/../build DESTDIR=$${_PRO_FILE_PWD_}/../build
unix { unix {

View File

@ -4,15 +4,6 @@ VERSION="1.0.0"
include(../DCLibraries.pri) 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 DEFINES+=THIS_IS_CA_SLAVE
DESTDIR=$${_PRO_FILE_PWD_}/../build DESTDIR=$${_PRO_FILE_PWD_}/../build

View File

@ -1,10 +1,3 @@
/*
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 "datIf.h"
#include "sendWRcmd.h" #include "sendWRcmd.h"
#include "controlBus.h" #include "controlBus.h"
@ -88,8 +81,7 @@ T_datif::T_datif(QObject *parent) : QObject(parent)
dif_scanStep=0; dif_scanStep=0;
selectedSlaveAddr=FIX_SLAVE_ADDR; selectedSlaveAddr=FIX_SLAVE_ADDR;
cycl_running=0; cycl_running=0;
epi_resetDcDataValid(); // data are not yet valid, no response from DC by now gpi_storeDcDataValid(0); // data are not yet valid, no response from DC by now
datif_noResponseCtr=0; datif_noResponseCtr=0;
datif_repeatCtr=0; datif_repeatCtr=0;
@ -145,14 +137,14 @@ char T_datif::datif_cycleSend()
if ( !myDCIF->isPortOpen()) if ( !myDCIF->isPortOpen())
{ {
//qDebug() << "com port not available"; // wird ununterbrochen ausgegeben //qDebug() << "com port not available"; // wird ununterbrochen ausgegeben
epi_resetDcDataValid(); // DC data not valid gpi_storeDcDataValid(0); // DC data not valid
return 0; return 0;
} }
// supervise if DC data are valid // supervise if DC data are valid
datif_noResponseCtr++; // inc every 20ms datif_noResponseCtr++; // inc every 20ms
if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s if (datif_noResponseCtr>250) // no life sign from device controller (DC) for about 3s
epi_resetDcDataValid(); // DC data has not updated for >=5s -> no longer valid! gpi_storeDcDataValid(0); // DC data has not updated for >=5s -> no longer valid!
// Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren // Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
if (gpi_wantToResetSupervision()) if (gpi_wantToResetSupervision())
@ -345,7 +337,7 @@ char T_datif::datif_cycleSend()
else else
{ {
dif_scanStep=0; // always start from beginning dif_scanStep=0; // always start from beginning
epi_resetDcDataValid(); gpi_storeDcDataValid(0);
} }
datif_cmdWasPerformed=0; // 0: no response by now datif_cmdWasPerformed=0; // 0: no response by now
@ -370,8 +362,8 @@ char T_datif::sendINrequestsAutomatic(void)
uint8_t datif_maxNrCommands=35, datif_sendNow; uint8_t datif_maxNrCommands=35, datif_sendNow;
// send quicker while transaction is ongoing: // send quicker while transaction is ongoing:
uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,23,0,0}; uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,0,0,0};
uint8_t datif_maxVendingCmds=13; uint8_t datif_maxVendingCmds=12;
// special commands: // special commands:
// 102: get IOs run constantly!!! // 102: get IOs run constantly!!!
@ -1037,7 +1029,7 @@ char T_datif::loadRecDataFromFrame()
case 31: // Get dynamic machine conditions (doors, voltage, alarm….) case 31: // Get dynamic machine conditions (doors, voltage, alarm….)
if (RdDleng>50) if (RdDleng>50)
{ {
epi_setDcDataValid(); // DC-Data are valid as DC responded. gpi_storeDcDataValid(1); // DC-Data are valid as DC responded.
// Could be set to every response but this (31) // Could be set to every response but this (31)
// is a very common and very important request // is a very common and very important request
gpi_storeDynMachineConditions(RdDleng, receivedData); gpi_storeDynMachineConditions(RdDleng, receivedData);

View File

@ -49,19 +49,9 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
// { // {
#ifdef THIS_IS_CA_MASTER #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! myDatif = new T_datif(); // für die CAslave-Lib auskommentieren!
#else #else
qCritical()<<"hwapi: error CAslave cannot include T_datif";
#ifdef THIS_IS_CA_MASTER
#error "MASTER LIB COMPILED INTO MASTER"
#endif
#endif #endif
// } // }

View File

@ -269,14 +269,14 @@ uint8_t T_runProc::cash_paymentProcessing(void)
emit runProc_payStopByEscrow(); 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 if ( (empState<10) || (empState>12)) // error
{ {
//collActiv=13; collActiv=13;
//hwapi_paymentStarted=90; hwapi_paymentStarted=90;
//qCritical() << "emitting signal payStopByError" << empState; qCritical() << "emitting signal payStopByError" << empState;
//emit runProc_payStopByError(); emit runProc_payStopByError();
} } */
} }

View File

@ -1984,7 +1984,7 @@ void epi_iniVRstorage(void)
void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data ) void gpi_storeVaultRecord(uint8_t blkNr, uint8_t *data )
{ {
uint16_t start=blkNr, ii; 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 SharedMem::write()->store_gotNrBlocksOfVaultRec |= (1<<start); // setze pro Block ein bit, wir brauchen block 0...5
// also muss store_gotNrBlocksOfVaultRec auf 0x1F stehen // also muss store_gotNrBlocksOfVaultRec auf 0x1F stehen
start<<=6; // *64 start<<=6; // *64
@ -2054,50 +2054,13 @@ uint16_t epi_getNrOfCoinsInCashBox(void)
void gpi_storeDcDataValid(bool isVal) void gpi_storeDcDataValid(bool isVal)
{ {
bool now=SharedMem::read()->store_DcDataAreValid; SharedMem::write()->store_DcDataAreValid = isVal;
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() bool epi_areDcDataValid()
{ {
return SharedMem::read()->store_DcDataAreValid; return SharedMem::read()->store_DcDataAreValid;
} }
// .................................................................................... // ....................................................................................