Fix for #1176 improved
This commit is contained in:
@@ -168,7 +168,7 @@ set(companion_SRCS
|
||||
splashlibrary.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
taranisnotfound.cpp
|
||||
radionotfound.cpp
|
||||
qcustomplot.cpp
|
||||
wizarddata.cpp
|
||||
wizarddialog.cpp
|
||||
@@ -193,7 +193,7 @@ set(companion_MOC_HDRS
|
||||
modelslist.h
|
||||
mdichild.h
|
||||
mainwindow.h
|
||||
taranisnotfound.h
|
||||
radionotfound.h
|
||||
qcustomplot.h
|
||||
qautocombobox.h
|
||||
helpers.h
|
||||
@@ -216,7 +216,7 @@ set(companion_UIS
|
||||
customizesplashdialog.ui
|
||||
splashlibrary.ui
|
||||
burndialog.ui
|
||||
taranisnotfound.ui
|
||||
radionotfound.ui
|
||||
)
|
||||
|
||||
set(companion_RCS
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
#include "warnings.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "taranisnotfound.h"
|
||||
#include "radionotfound.h"
|
||||
#include "googleanalytics.h"
|
||||
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
|
||||
|
||||
@@ -1056,11 +1056,7 @@ bool MainWindow::readEepromFromRadio(const QString filename, const QString messa
|
||||
// Mike's bootloader calls the EEPROM file "ERSKY9X.BIN" :(
|
||||
path = FindMassstoragePath("ERSKY9X.BIN");
|
||||
}
|
||||
if (path.isEmpty()) {
|
||||
taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
|
||||
tnfd->exec();
|
||||
}
|
||||
else {
|
||||
if (!path.isEmpty()) {
|
||||
QStringList str;
|
||||
str << path << filename;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, "", str, message);
|
||||
@@ -1071,7 +1067,8 @@ bool MainWindow::readEepromFromRadio(const QString filename, const QString messa
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (result == false && !IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
QStringList str = GetReceiveEEpromCommand(filename);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, message);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
@@ -1081,22 +1078,30 @@ bool MainWindow::readEepromFromRadio(const QString filename, const QString messa
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (!QFileInfo(filename).exists())
|
||||
if (result == false && IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
RadioNotFoundDialog *dialog = new RadioNotFoundDialog(this);
|
||||
dialog->exec();
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
if (!QFileInfo(filename).exists()) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MainWindow::writeEepromToRadio(const QString filename, const QString message)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
QString path = FindMassstoragePath("EEPROM.BIN");
|
||||
if (path.isEmpty()) {
|
||||
taranisNotFoundDialog *tnfd = new taranisNotFoundDialog(this);
|
||||
tnfd->exec();
|
||||
return false;
|
||||
// Mike's bootloader calls the EEPROM file "ERSKY9X.BIN" :(
|
||||
path = FindMassstoragePath("ERSKY9X.BIN");
|
||||
}
|
||||
else {
|
||||
if (!path.isEmpty()) {
|
||||
QStringList str;
|
||||
str << filename << path;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, "", str, message);
|
||||
@@ -1104,17 +1109,27 @@ bool MainWindow::writeEepromToRadio(const QString filename, const QString messag
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (result == false && !IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
QStringList str = GetSendEEpromCommand(filename);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Backup To Radio", AVR_DIALOG_SHOW_DONE);
|
||||
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
return true;
|
||||
sleep(1);
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (result == false && IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
RadioNotFoundDialog *dialog = new RadioNotFoundDialog(this);
|
||||
dialog->exec();
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void MainWindow::writeBackup()
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "wizarddialog.h"
|
||||
#include "taranisnotfound.h"
|
||||
#include <QFileInfo>
|
||||
#include "googleanalytics.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "radionotfound.h"
|
||||
#include "ui_radionotfound.h"
|
||||
|
||||
RadioNotFoundDialog::RadioNotFoundDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RadioNotFoundDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
RadioNotFoundDialog::~RadioNotFoundDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RadioNotFoundDialog::on_OK_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef _RADIONOTFOUNDDIALOG_H
|
||||
#define _RADIONOTFOUNDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class RadioNotFoundDialog;
|
||||
}
|
||||
|
||||
class RadioNotFoundDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RadioNotFoundDialog(QWidget *parent = 0);
|
||||
~RadioNotFoundDialog();
|
||||
private:
|
||||
Ui::RadioNotFoundDialog *ui;
|
||||
private slots:
|
||||
void on_OK_clicked();
|
||||
};
|
||||
|
||||
#endif // _RADIONOTFOUNDDIALOG_H
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>taranisNotFoundDialog</class>
|
||||
<widget class="QDialog" name="taranisNotFoundDialog">
|
||||
<class>RadioNotFoundDialog</class>
|
||||
<widget class="QDialog" name="RadioNotFoundDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -29,7 +29,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>No Taranis Radio Found</string>
|
||||
<string>No Radio Found</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
@@ -37,7 +37,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>No Taranis Radio was found!</p><p>Make sure that you hold the lower trim buttons towards the center while you turn it on.</p><p>Then connect the USB wire.</p></body></html></string>
|
||||
<string><html><head/><body><p>No Radio was found!</p><p>Make sure that you hold the lower trim buttons towards the center while you turn it on.</p><p>Then connect the USB wire.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "taranisnotfound.h"
|
||||
#include "ui_taranisnotfound.h"
|
||||
|
||||
taranisNotFoundDialog::taranisNotFoundDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::taranisNotFoundDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
taranisNotFoundDialog::~taranisNotFoundDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void taranisNotFoundDialog::on_OK_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef TARANISNOTFOUNDDIALOG_H
|
||||
#define TARANISNOTFOUNDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class taranisNotFoundDialog;
|
||||
}
|
||||
|
||||
class taranisNotFoundDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit taranisNotFoundDialog(QWidget *parent = 0);
|
||||
~taranisNotFoundDialog();
|
||||
private:
|
||||
Ui::taranisNotFoundDialog *ui;
|
||||
private slots:
|
||||
void on_OK_clicked();
|
||||
};
|
||||
|
||||
#endif // TARANISNOTFOUNDDIALOG_H
|
||||
Reference in New Issue
Block a user