mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-458 uploadtool: added threading related TODOs
This commit is contained in:
parent
ba793682a5
commit
6f806b6c49
@ -62,6 +62,7 @@ int16_t port::pfSerialRead(void)
|
||||
{
|
||||
char c[1];
|
||||
|
||||
// TODO why the wait ? (gcs uploader dfu does not have it)
|
||||
sport->waitForBytesWritten(1);
|
||||
if (sport->bytesAvailable() || sport->waitForReadyRead(0)) {
|
||||
sport->read(c, 1);
|
||||
@ -91,6 +92,7 @@ void port::pfSerialWrite(uint8_t c)
|
||||
}
|
||||
txDebugBuff.append(cc[0]);
|
||||
}
|
||||
// TODO why the wait ? (gcs uploader dfu does not have it)
|
||||
sport->waitForBytesWritten(1);
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,7 @@ uint16_t qssp::ssp_SendDataBlock(uint8_t *data, uint16_t length)
|
||||
uint16_t retval = FALSE;
|
||||
|
||||
packet_status = ssp_SendData(data, length); // send the data
|
||||
// TODO the loop is non blocking and will spin as fast as the CPU allows
|
||||
while (packet_status == SSP_TX_WAITING) { // check the status
|
||||
(void)ssp_ReceiveProcess(); // process any bytes received.
|
||||
packet_status = ssp_SendProcess(); // check the send status
|
||||
|
@ -41,6 +41,7 @@ qsspt::~qsspt()
|
||||
|
||||
void qsspt::run()
|
||||
{
|
||||
// TODO the loop is non blocking and will spin as fast as the CPU allows
|
||||
while (!endthread) {
|
||||
receivestatus = ssp_ReceiveProcess();
|
||||
sendstatus = ssp_SendProcess();
|
||||
@ -70,6 +71,8 @@ bool qsspt::sendData(uint8_t *buf, uint16_t size)
|
||||
mbuf = buf;
|
||||
msize = size;
|
||||
sendbufmutex.unlock();
|
||||
// TODO why do we wait 10 seconds ? why do we then ignore the timeout ?
|
||||
// There is a ssp_SendDataBlock method...
|
||||
msendwait.lock();
|
||||
sendwait.wait(&msendwait, 10000);
|
||||
msendwait.unlock();
|
||||
|
@ -234,6 +234,9 @@ int main(int argc, char *argv[])
|
||||
return false;
|
||||
}
|
||||
standardOutput << "Uploading..." << endl;
|
||||
|
||||
// this call is asynchronous so the only false status it will report
|
||||
// is when it is already running...
|
||||
bool retstatus = dfu.UploadFirmware(file.toLatin1(), verify, device);
|
||||
|
||||
if (!retstatus) {
|
||||
@ -243,6 +246,7 @@ int main(int argc, char *argv[])
|
||||
while (!dfu.isFinished()) {
|
||||
QThread::msleep(500);
|
||||
}
|
||||
// TODO check if upload went well...
|
||||
if (file.endsWith("opfw")) {
|
||||
QFile fwfile(file);
|
||||
if (!fwfile.open(QIODevice::ReadOnly)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user