From 492d30aaf09df40fed39cce4b56524b82e8af335 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Wed, 24 Jul 2024 17:22:17 +0200 Subject: [PATCH] Fix: T.S.: set DCdataValid --- include/datIf.h | 2 ++ src/datIf.cpp | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/datIf.h b/include/datIf.h index 42e442c..566f068 100644 --- a/include/datIf.h +++ b/include/datIf.h @@ -161,6 +161,8 @@ class T_datif : public QObject // blockNr=transmitted in WRITEADDRESS low byte int datif_noResponseCtr; + int datif_nowNewDyns; + int datif_nowNewStats; T_prot *myDCIF; QTimer *datif_trigger; diff --git a/src/datIf.cpp b/src/datIf.cpp index 26ccdd2..9b30965 100755 --- a/src/datIf.cpp +++ b/src/datIf.cpp @@ -91,6 +91,8 @@ T_datif::T_datif(QObject *parent) : QObject(parent) epi_resetDcDataValid(1); // data are not yet valid, no response from DC by now datif_noResponseCtr=0; + datif_nowNewDyns=0; + datif_nowNewStats=0; datif_repeatCtr=0; datif_cmdWasPerformed=0; // 0: no response by now @@ -151,13 +153,24 @@ char T_datif::datif_cycleSend() { //qDebug() << "com port not available"; // wird ununterbrochen ausgegeben epi_resetDcDataValid(2); // DC data not valid + datif_nowNewDyns=0; + datif_nowNewStats=0; + 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 + if (datif_noResponseCtr>50) // no life sign from device controller (DC) for about a sec + { epi_resetDcDataValid(3); // DC data has not updated for >=5s -> no longer valid! + datif_nowNewDyns=0; + datif_nowNewStats=0; + + } + // 24.7.24 new, data are valid if dynamic machine conditions AND dyn machine states came in + if (datif_nowNewDyns && datif_nowNewStats && !epi_areDcDataValid() ) + epi_setDcDataValid(); // Ueberwachung ob ein oder mehrere Commands am Stueck erfolgreich waren if (gpi_wantToResetSupervision()) @@ -360,6 +373,9 @@ char T_datif::datif_cycleSend() { dif_scanStep=0; // always start from beginning epi_resetDcDataValid(4); + datif_nowNewDyns=0; + datif_nowNewStats=0; + } datif_cmdWasPerformed=0; // 0: no response by now @@ -1035,6 +1051,7 @@ char T_datif::loadRecDataFromFrame() if (RdDleng>28) { gpi_storeDeviceConditions(RdDleng, receivedData); + datif_nowNewStats=1; // 24.7.24 new } break; @@ -1043,9 +1060,9 @@ char T_datif::loadRecDataFromFrame() if (RdDleng>60) { - 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 + //epi_setDcDataValid(); // 24.7.24 remove here + datif_nowNewDyns=1; // 24.7.24 new + gpi_storeDynMachineConditions(RdDleng, receivedData); gpi_storeDI_CoinAttach(receivedData[6]); // new, 14.2.24 needed for direct coin insertion