start download thread in cycleSend() when reuested

This commit is contained in:
Gerhard Hoffmann 2023-12-02 09:46:18 +01:00
parent cd4bddd169
commit 6b2830ee83

View File

@ -2,6 +2,9 @@
#include "sendWRcmd.h"
#include "controlBus.h"
#include "storeINdata.h"
#include "download_thread.h"
#include "hwapi.h"
#include <QDebug>
#include <datei.h>
#include <QDir>
@ -47,8 +50,10 @@ static uint8_t datif_pNextCmd, datif_sendSlowCmd;
//#define DATIF_CTR_GOTRESPVAL 100
T_datif::T_datif(QObject *parent) : QObject(parent)
T_datif::T_datif(hwinf *hw, QObject *parent) : QObject(parent)
{
m_hw = hw;
QByteArray myBA;
QDir myDir("../dmd");
@ -198,8 +203,21 @@ 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