PX4FirmwareUpgrader.cc 1.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#include "PX4FirmwareUpgrader.h"
#include "ui_PX4FirmwareUpgrader.h"

#include <QGC.h>
#include <QDebug>

PX4FirmwareUpgrader::PX4FirmwareUpgrader(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PX4FirmwareUpgrader)
{
    ui->setupUi(this);

    connect(ui->selectFileButton, SIGNAL(clicked()), this, SLOT(selectFirmwareFile()));
    connect(ui->flashButton, SIGNAL(clicked()), this, SIGNAL(upgrade()));
}

PX4FirmwareUpgrader::~PX4FirmwareUpgrader()
{
    delete ui;
}

void PX4FirmwareUpgrader::selectFirmwareFile()
{

}

void PX4FirmwareUpgrader::setDetectionStatusText(const QString &text)
{
    ui->detectionStatusLabel->setText(text);
}

void PX4FirmwareUpgrader::setFlashStatusText(const QString &text)
{
    ui->flashProgressLabel->setText(text);
}

void PX4FirmwareUpgrader::setFlashProgress(int percent)
{
    ui->flashProgressBar->setValue(percent);
}

void PX4FirmwareUpgrader::setPortName(const QString &portname)
{
    // Prepend newly found port to the list
    if (ui->serialPortComboBox->findText(portname) == -1)
    {
        ui->serialPortComboBox->insertItem(0, portname);
        ui->serialPortComboBox->setEditText(portname);
    }
}