From 57eac0f46ecc47c40e1f01342c44bd8d6e64a4fe Mon Sep 17 00:00:00 2001 From: Chris Esposito Date: Sun, 24 Dec 2017 11:13:06 +1100 Subject: [PATCH] Firmware Flashing Message in Linux --- Desktop_Interface/mainwindow.cpp | 3 +++ Desktop_Interface/unixusbdriver.cpp | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Desktop_Interface/mainwindow.cpp b/Desktop_Interface/mainwindow.cpp index 71272d4b..43c2ecb6 100644 --- a/Desktop_Interface/mainwindow.cpp +++ b/Desktop_Interface/mainwindow.cpp @@ -1121,6 +1121,9 @@ void MainWindow::readSettingsFile(){ ui->controller_iso->internalBuffer375_CH1->frontendGain = calibrate_gain_ch1; ui->controller_iso->internalBuffer750->frontendGain = calibrate_gain_ch1; ui->controller_iso->internalBuffer375_CH2->frontendGain = calibrate_gain_ch2; + + //Prompt user to calibrate if no calibration data found. + } void MainWindow::on_actionRecord_triggered(bool checked) diff --git a/Desktop_Interface/unixusbdriver.cpp b/Desktop_Interface/unixusbdriver.cpp index f9b72afe..ac942d8c 100644 --- a/Desktop_Interface/unixusbdriver.cpp +++ b/Desktop_Interface/unixusbdriver.cpp @@ -1,5 +1,6 @@ #include "unixusbdriver.h" #include "platformspecific.h" +#include unixUsbDriver::unixUsbDriver(QWidget *parent) : genericUsbDriver(parent) { @@ -310,11 +311,14 @@ int unixUsbDriver::flashFirmware(void){ sprintf(fname, "/firmware/labrafirm_%04x_%02x.hex", EXPECTED_FIRMWARE_VERSION, DEFINED_EXPECTED_VARIANT); qDebug() << "FLASHING " << fname; + signalFirmwareFlash(); + QApplication::processEvents(); + + //Go to bootloader mode bootloaderJump(); qDebug() << "BA94 closed"; - QThread::msleep(2000); - + //Get location of firmware file QString dirString = QCoreApplication::applicationDirPath(); dirString.append(fname); QByteArray array = dirString.toLocal8Bit(); @@ -333,10 +337,11 @@ int unixUsbDriver::flashFirmware(void){ char command4[256]; sprintf(command4, "dfu-programmer atxmega32a4u launch"); - //Run stage 1 + //Run stage 1, until there's a success while(exit_code){ - QThread::msleep(250); + QThread::msleep(200); exit_code = dfuprog_virtual_cmd(command1); + QApplication::processEvents(); } //Run stage 2 @@ -351,13 +356,12 @@ int unixUsbDriver::flashFirmware(void){ return exit_code+300; } - QThread::msleep(2000); - //Run stage 4 - double launch to clear the eeprom flag from bootloaderJump. exit_code = 1; while(exit_code){ - QThread::msleep(250); + QThread::msleep(200); exit_code = dfuprog_virtual_cmd(command4); + QApplication::processEvents(); } libusb_release_interface(handle, 0);