Compare commits

...

9 Commits

Author SHA1 Message Date
8c261af1a7 Remove com, datif and prot (so we cannot link). 2023-12-18 10:44:08 +01:00
e0346e0a9b Explicitlz remove define THIS_IS_CA_SLAVE. 2023-12-18 10:43:01 +01:00
16b6ea8087 Add COMPILER-CHECKS: datif is only valid inside the master-lib. 2023-12-18 10:41:56 +01:00
9bdc08f6fc no change 2023-12-16 09:39:51 +01:00
a3bc3d53cd diagnosis 2023-12-16 09:39:36 +01:00
9971b7ac2e diagnosis 2023-12-16 09:38:29 +01:00
15ada1ad26 diagnosis 2023-12-16 09:37:50 +01:00
1811842082 no more define 2023-12-16 09:36:53 +01:00
13ff32b108 no change 2023-12-16 09:36:19 +01:00
9 changed files with 103 additions and 22 deletions

View File

@ -1,6 +1,13 @@
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,9 +39,10 @@ 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 "interfaces.h" //#include <../plugins/interfaces.h>
#include "shared_mem_buffer.h" #include "shared_mem_buffer.h"
#include "runProc.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 //#undef THIS_IS_CA_MASTER
//for CAmaster: //for CAmaster:
#ifndef THIS_IS_CA_MASTER //#define THIS_IS_CA_MASTER
#define THIS_IS_CA_MASTER
#endif
@ -1300,8 +1299,15 @@ 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)
// latestBill: last accepted bank note, value in cent // return value: numbers of bills or 99 in case of error
// currentNotes an array with up to 16 (further) notes collected // 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; void bna_requestStackerLevel(void) const override;

View File

@ -527,6 +527,9 @@ 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,6 +5,7 @@ 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,6 +4,15 @@ 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,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 "datIf.h"
#include "sendWRcmd.h" #include "sendWRcmd.h"
#include "controlBus.h" #include "controlBus.h"
@ -81,7 +88,8 @@ 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;
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_noResponseCtr=0;
datif_repeatCtr=0; datif_repeatCtr=0;
@ -137,14 +145,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
gpi_storeDcDataValid(0); // DC data not valid epi_resetDcDataValid(); // 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
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 // Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren
if (gpi_wantToResetSupervision()) if (gpi_wantToResetSupervision())
@ -337,7 +345,7 @@ char T_datif::datif_cycleSend()
else else
{ {
dif_scanStep=0; // always start from beginning dif_scanStep=0; // always start from beginning
gpi_storeDcDataValid(0); epi_resetDcDataValid();
} }
datif_cmdWasPerformed=0; // 0: no response by now datif_cmdWasPerformed=0; // 0: no response by now
@ -362,8 +370,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,0,0,0}; uint8_t datif_vendRequCommandList[15]={102,107,108,110,112,115,116,31,32,40,41,42,23,0,0};
uint8_t datif_maxVendingCmds=12; uint8_t datif_maxVendingCmds=13;
// special commands: // special commands:
// 102: get IOs run constantly!!! // 102: get IOs run constantly!!!
@ -1029,7 +1037,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)
{ {
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) // 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,9 +49,19 @@ 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,13 +2054,50 @@ uint16_t epi_getNrOfCoinsInCashBox(void)
void gpi_storeDcDataValid(bool isVal) void gpi_storeDcDataValid(bool isVal)
{ {
SharedMem::write()->store_DcDataAreValid = 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() bool epi_areDcDataValid()
{ {
return SharedMem::read()->store_DcDataAreValid; return SharedMem::read()->store_DcDataAreValid;
} }
// .................................................................................... // ....................................................................................