forked from GerhardHoffmann/DCLibraries
Prepare new implementation of downloading the bootloader.
This commit is contained in:
parent
6377c6c18f
commit
27c0aa56ee
@ -29,25 +29,31 @@ T_runProc::T_runProc()
|
|||||||
QTimer *runProc_callProcesses = new QTimer();
|
QTimer *runProc_callProcesses = new QTimer();
|
||||||
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
|
connect(runProc_callProcesses, SIGNAL(timeout()), this, SLOT(runProc_slotProcess()));
|
||||||
runProc_callProcesses->setSingleShot(false);
|
runProc_callProcesses->setSingleShot(false);
|
||||||
runProc_callProcesses->start(100); // in ms
|
runProc_callProcesses->start(10); // in ms
|
||||||
|
|
||||||
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
|
hwapi_lastDoorState=0; // default: all doors (should be) closed, coin box inserted
|
||||||
// bit0: upper door 1:middle 2:lower 3=cash-box out
|
// bit0: upper door 1:middle 2:lower 3=cash-box out
|
||||||
|
|
||||||
hwapi_triggerBL = new QTimer();
|
// hwapi_triggerBL = new QTimer();
|
||||||
connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
// connect(hwapi_triggerBL, SIGNAL(timeout()), this, SLOT(bl_performComplStart()));
|
||||||
hwapi_triggerBL->setSingleShot(false);
|
// hwapi_triggerBL->setSingleShot(false);
|
||||||
hwapi_triggerBL->stop();
|
// hwapi_triggerBL->stop();
|
||||||
|
|
||||||
|
myTO = new QTimer();
|
||||||
|
myTO->setSingleShot(true);
|
||||||
|
myTO->start(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void T_runProc::runProc_slotProcess(void)
|
void T_runProc::runProc_slotProcess(void)
|
||||||
{
|
{
|
||||||
|
#ifndef THIS_IS_CA_MASTER
|
||||||
cash_paymentProcessing();
|
cash_paymentProcessing();
|
||||||
doors_supervise();
|
doors_supervise();
|
||||||
|
bl_performComplStart(); // neu 1.12.23
|
||||||
dcBL_cycle();
|
dcBL_cycle();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool T_runProc::cash_startPayment(uint32_t amount)
|
bool T_runProc::cash_startPayment(uint32_t amount)
|
||||||
@ -654,7 +660,7 @@ bool T_runProc::bl_isUp(void)
|
|||||||
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
|
receivedData[3]==45 && receivedData[4] ==95 && receivedData[5]==176)
|
||||||
{
|
{
|
||||||
qDebug() << "got BL response to readFWversion";
|
qDebug() << "got BL response to readFWversion";
|
||||||
epi_clrRawReceivedString();
|
//epi_clrRawReceivedString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// response to "start BL"
|
// response to "start BL"
|
||||||
@ -662,7 +668,7 @@ bool T_runProc::bl_isUp(void)
|
|||||||
receivedData[3]==223 && receivedData[4] ==131 )
|
receivedData[3]==223 && receivedData[4] ==131 )
|
||||||
{
|
{
|
||||||
qDebug() << "hwapi_bl_isUp: got BL response to start";
|
qDebug() << "hwapi_bl_isUp: got BL response to start";
|
||||||
epi_clrRawReceivedString();
|
//epi_clrRawReceivedString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -677,7 +683,8 @@ void T_runProc::bl_completeStart(void)
|
|||||||
|
|
||||||
bool T_runProc::bl_performComplStart(void)
|
bool T_runProc::bl_performComplStart(void)
|
||||||
{
|
{
|
||||||
// must be called cyclic by timer
|
bool result;
|
||||||
|
|
||||||
static uint8_t retryCtr;
|
static uint8_t retryCtr;
|
||||||
|
|
||||||
if ((bl_startupStep<1) || (bl_startupStep>10))
|
if ((bl_startupStep<1) || (bl_startupStep>10))
|
||||||
@ -691,58 +698,69 @@ bool T_runProc::bl_performComplStart(void)
|
|||||||
|
|
||||||
if (bl_startupStep==2)
|
if (bl_startupStep==2)
|
||||||
{
|
{
|
||||||
|
qDebug()<<"rebooting";
|
||||||
bl_rebootDC();
|
bl_rebootDC();
|
||||||
hwapi_triggerBL->stop();
|
myTO->stop();
|
||||||
hwapi_triggerBL->start(1000); // call next step in 1s
|
myTO->start(500);
|
||||||
retryCtr=0;
|
retryCtr=0;
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==3)
|
if (bl_startupStep==3)
|
||||||
{
|
{
|
||||||
//qDebug()<<"starting BL";
|
if (!myTO->isActive())
|
||||||
|
{
|
||||||
|
qDebug()<<"starting BL";
|
||||||
bl_startBL();
|
bl_startBL();
|
||||||
hwapi_triggerBL->stop();
|
myTO->stop();
|
||||||
hwapi_triggerBL->start(100);
|
myTO->start(500);
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==4)
|
if (bl_startupStep==4)
|
||||||
{
|
{
|
||||||
//if (!myTO->isActive())
|
if (!myTO->isActive())
|
||||||
//{
|
{
|
||||||
|
qDebug()<<"checking BL";
|
||||||
bl_checkBL();
|
bl_checkBL();
|
||||||
hwapi_triggerBL->stop();
|
myTO->stop();
|
||||||
hwapi_triggerBL->start(100);
|
myTO->start(200);
|
||||||
bl_startupStep++;
|
bl_startupStep++;
|
||||||
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (bl_startupStep==5)
|
if (bl_startupStep==5)
|
||||||
{
|
{
|
||||||
hwapi_triggerBL->stop();
|
if (!myTO->isActive())
|
||||||
if (bl_isUp())
|
{
|
||||||
|
qDebug()<<"step 5";
|
||||||
|
result = bl_isUp();
|
||||||
|
qDebug()<<"BL result: "<< result;
|
||||||
|
if (result)
|
||||||
{
|
{
|
||||||
bl_startupStep=99;
|
bl_startupStep=99;
|
||||||
|
qDebug()<<"BL is working now...";
|
||||||
// BL is up and running
|
// BL is up and running
|
||||||
|
return true;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
retryCtr++; // start again
|
retryCtr++; // start again
|
||||||
if (retryCtr>=15)
|
if (retryCtr>=10)
|
||||||
{
|
{
|
||||||
bl_startupStep=99;
|
bl_startupStep=99;
|
||||||
//qDebug()<<"BL error!!!";
|
qDebug()<<"BL error!!!";
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
bl_startupStep=3;
|
bl_startupStep=3;
|
||||||
//qDebug()<<"BL retry...";
|
myTO->stop();
|
||||||
|
myTO->start(200);
|
||||||
|
qDebug()<<"BL retry...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user