Compare commits

..

No commits in common. "fd58f41c87c78e4a50938311a61f3b1f76dd40ce" and "ee26eef50f267d95b7128bbfe12f5bb4df744d3f" have entirely different histories.

9 changed files with 21 additions and 55 deletions

View File

@ -133,8 +133,8 @@
#define SENDCOMBINED 0
class hwinf;
class DownloadThread;
class T_datif : public QObject
{
Q_OBJECT
@ -165,15 +165,13 @@ class T_datif : public QObject
T_prot *myDCIF;
QTimer *datif_trigger;
uint8_t selectedSlaveAddr;
DownloadThread *m_downloadThread;
hwinf *m_hw;
private slots:
char datif_cycleSend();
void StoredRecData();
public:
T_datif(hwinf *hw, QObject *parent = nullptr);
T_datif(QObject *parent = nullptr);
void resetChain(void);
char isPortOpen(void);

View File

@ -9,7 +9,7 @@ class DownloadThread : public QThread {
Q_OBJECT
public:
DownloadThread(hwinf *hw);
DownloadThread(hwinf *hw, QString const &fileToDownload);
~DownloadThread();
protected:

View File

@ -1307,11 +1307,8 @@ public:
// download device controller
void dcDownloadInit(QString const &fileToDownload) override;
void dcDownloadStart() override;
bool dcDownloadRequested() const override;
QString dcDownloadFileName() const override;
void dcDownloadResetRequest() override;
void dcDownloadReportStart() override;
void dcDownloadStart(QString const &fileToDownload) override;
void dcDownloadReportStart(QString const &fileToDownload) override;
bool dcDownloadStarted() const override;
bool dcDownloadRunning() const override;
bool dcDownloadFinished() const override;

View File

@ -2277,11 +2277,12 @@ public:
virtual void dcDownloadInit(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadStart() {}
virtual bool dcDownloadRequested() const { return false; }
virtual void dcDownloadResetRequest() {}
virtual QString dcDownloadFileName() const { return ""; }
virtual void dcDownloadReportStart() {}
virtual void dcDownloadStart(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadReportStart(QString const &fileToDownload) {
Q_UNUSED(fileToDownload);
}
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
Q_UNUSED(totalBlockNumber);
}

View File

@ -9,7 +9,7 @@ class ReportingThread : public QThread {
Q_OBJECT
public:
ReportingThread(hwinf *hw);
ReportingThread(hwinf *hw, QString const &fileToDownload);
~ReportingThread();
protected:

View File

@ -2,9 +2,6 @@
#include "sendWRcmd.h"
#include "controlBus.h"
#include "storeINdata.h"
#include "download_thread.h"
#include "hwapi.h"
#include <QDebug>
#include <datei.h>
#include <QDir>
@ -50,10 +47,8 @@ static uint8_t datif_pNextCmd, datif_sendSlowCmd;
//#define DATIF_CTR_GOTRESPVAL 100
T_datif::T_datif(hwinf *hw, QObject *parent) : QObject(parent)
T_datif::T_datif(QObject *parent) : QObject(parent)
{
m_hw = hw;
QByteArray myBA;
QDir myDir("../dmd");
@ -203,21 +198,8 @@ char T_datif::datif_cycleSend()
return 0;
}
if (m_hw->dcDownloadRequested()) { // only happens in ca-master
m_hw->dcDownloadResetRequest();
// start download-thread.
m_downloadThread = new DownloadThread(m_hw);
m_downloadThread->start();
int cnt = 10;
while (--cnt > 0 && !m_downloadThread->isRunning()) {
QThread::msleep(100);
}
if (cnt <= 0) {
qCritical() << "DOWNLOAD-THREAD NOT RUNNING WITHIN 1000ms";
}
}
// 17.7.2023: repeat commands if result was !=OK -------------------------------------------------------------------
if (datif_cmdWasPerformed==2 && doRepeat) // Cmd was not or false performed und Wiederholen erwuenscht

View File

@ -2,9 +2,9 @@
#include "shared_mem_buffer.h"
#include "hwapi.h"
DownloadThread::DownloadThread(hwinf *hw)
DownloadThread::DownloadThread(hwinf *hw, QString const &fileToDownload)
: m_hw(hw)
, m_fileToDownload(m_hw->dcDownloadFileName()) {
, m_fileToDownload(fileToDownload) {
}
DownloadThread::~DownloadThread() {
@ -12,7 +12,7 @@ DownloadThread::~DownloadThread() {
// download thread running in ca-master sends the dc-file down to firmware
void DownloadThread::run() {
// m_hw->dcDownloadInit(m_fileToDownload);
m_hw->dcDownloadInit(m_fileToDownload);
// hier dann den eigentlichen download-process eintragen

View File

@ -51,7 +51,7 @@ hwapi::hwapi(QWidget *parent) : QObject(parent)
// {
#ifdef THIS_IS_CA_MASTER
myDatif = new T_datif(this); // für die CAslave-Lib auskommentieren!
myDatif = new T_datif(); // für die CAslave-Lib auskommentieren!
#else
qCritical()<<"hwapi: error CAslave cannot include T_datif";
#endif
@ -4383,7 +4383,7 @@ void hwapi::dcDownloadInit(QString const &dcFileToDownload) {
SharedMem::getData()->m_downLoadDC.m_totalBlocks = 0;
SharedMem::getData()->m_downLoadDC.m_currentblockNumber = 0;
SharedMem::getData()->m_downLoadDC.m_started = true;
SharedMem::getData()->m_downLoadDC.m_started = false;
SharedMem::getData()->m_downLoadDC.m_running = false;
SharedMem::getData()->m_downLoadDC.m_finished = false;
}
@ -4395,18 +4395,6 @@ void hwapi::dcDownloadReportStart() {
}
bool hwapi::dcDownloadRequested() const {
return SharedMem::getDataConst()->m_downLoadDC.m_started;
}
void hwapi::dcDownloadResetRequest() {
SharedMem::getData()->m_downLoadDC.m_started = false;
}
QString hwapi::dcDownloadFileName() const {
return SharedMem::getDataConst()->m_downLoadDC.m_filename;
}
void hwapi::dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
SharedMem::getData()->m_downLoadDC.m_totalBlocks = totalBlockNumber;
}

View File

@ -2,9 +2,9 @@
#include "shared_mem_buffer.h"
#include "hwapi.h"
ReportingThread::ReportingThread(hwinf *hw)
ReportingThread::ReportingThread(hwinf *hw, QString const &fileToDownload)
: m_hw(hw)
, m_fileToDownload(m_hw->dcDownloadFileName()) {
, m_fileToDownload(fileToDownload) {
}
ReportingThread::~ReportingThread() {