diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 47e88ceea..f9acd90b8 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -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 diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 1938a17e7..ef62abfa2 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -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() diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index e1b2a37c2..fdbfaef60 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -53,7 +53,6 @@ #include "helpers.h" #include "appdata.h" #include "wizarddialog.h" -#include "taranisnotfound.h" #include #include "googleanalytics.h" diff --git a/companion/src/radionotfound.cpp b/companion/src/radionotfound.cpp new file mode 100644 index 000000000..bf562364a --- /dev/null +++ b/companion/src/radionotfound.cpp @@ -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(); +} diff --git a/companion/src/radionotfound.h b/companion/src/radionotfound.h new file mode 100644 index 000000000..65537e598 --- /dev/null +++ b/companion/src/radionotfound.h @@ -0,0 +1,22 @@ +#ifndef _RADIONOTFOUNDDIALOG_H +#define _RADIONOTFOUNDDIALOG_H + +#include + +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 diff --git a/companion/src/taranisnotfound.ui b/companion/src/radionotfound.ui similarity index 88% rename from companion/src/taranisnotfound.ui rename to companion/src/radionotfound.ui index 2e84ab038..d1f3ff06d 100644 --- a/companion/src/taranisnotfound.ui +++ b/companion/src/radionotfound.ui @@ -1,7 +1,7 @@ - taranisNotFoundDialog - + RadioNotFoundDialog + 0 @@ -29,7 +29,7 @@ - No Taranis Radio Found + No Radio Found @@ -37,7 +37,7 @@ - <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> + <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> Qt::RichText diff --git a/companion/src/taranisnotfound.cpp b/companion/src/taranisnotfound.cpp deleted file mode 100644 index aa01ca84e..000000000 --- a/companion/src/taranisnotfound.cpp +++ /dev/null @@ -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(); -} diff --git a/companion/src/taranisnotfound.h b/companion/src/taranisnotfound.h deleted file mode 100644 index 8b4d964b9..000000000 --- a/companion/src/taranisnotfound.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TARANISNOTFOUNDDIALOG_H -#define TARANISNOTFOUNDDIALOG_H - -#include - -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