Merge pull request #2330 from opentx/romolo/writeerrors
Write errors to the radio are not correctly handled
This commit is contained in:
@@ -200,6 +200,9 @@ void FlashProcess::analyseStandardError(const QString &text)
|
|||||||
if (text.contains("-E-") && !text.contains("-E- No receive file name")) {
|
if (text.contains("-E-") && !text.contains("-E- No receive file name")) {
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
if (text.contains("No DFU capable USB device found")) {
|
||||||
|
hasErrors = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlashProcess::onReadyReadStandardOutput()
|
void FlashProcess::onReadyReadStandardOutput()
|
||||||
@@ -218,7 +221,8 @@ void FlashProcess::onReadyReadStandardError()
|
|||||||
|
|
||||||
void FlashProcess::errorWizard()
|
void FlashProcess::errorWizard()
|
||||||
{
|
{
|
||||||
QString output; // TODO = ui->plainTextEdit->toPlainText();
|
QString output=progress->getText(); // TODO = ui->plainTextEdit->toPlainText();
|
||||||
|
|
||||||
if (output.contains("avrdude: Expected signature for")) { // wrong signature
|
if (output.contains("avrdude: Expected signature for")) { // wrong signature
|
||||||
int pos=output.indexOf("avrdude: Device signature = ");
|
int pos=output.indexOf("avrdude: Device signature = ");
|
||||||
bool fwexist=false;
|
bool fwexist=false;
|
||||||
@@ -259,6 +263,12 @@ void FlashProcess::errorWizard()
|
|||||||
Firmware *firmware = GetCurrentFirmware();
|
Firmware *firmware = GetCurrentFirmware();
|
||||||
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName()));
|
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName()));
|
||||||
}
|
}
|
||||||
|
} else if (output.contains("No DFU capable USB device found")){
|
||||||
|
#if defined WIN32 || !defined __GNUC__
|
||||||
|
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio does not seem connected to USB or the driver is not installed!!!\n\nPlease use ZADIG to properly install the driver."));
|
||||||
|
#else
|
||||||
|
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio does not seem connected to USB or the driver is not initialized!!!."));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +280,7 @@ void FlashProcess::onFinished(int code=0)
|
|||||||
}
|
}
|
||||||
if (code) {
|
if (code) {
|
||||||
progress->setInfo(tr("Flashing done (exit code = %1)").arg(code));
|
progress->setInfo(tr("Flashing done (exit code = %1)").arg(code));
|
||||||
if (cmd.toLower().contains("avrdude")) {
|
if (cmd.toLower().contains("avrdude") || cmd.toLower().contains("dfu")) {
|
||||||
errorWizard();
|
errorWizard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ void ProgressWidget::addText(const QString &text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ProgressWidget::getText()
|
||||||
|
{
|
||||||
|
return ui->textEdit->toPlainText();
|
||||||
|
}
|
||||||
|
|
||||||
void ProgressWidget::setProgressColor(const QColor &color)
|
void ProgressWidget::setProgressColor(const QColor &color)
|
||||||
{
|
{
|
||||||
ui->progressBar->setStyleSheet(QString("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: %1; text-align:center;}:").arg(color.name()));
|
ui->progressBar->setStyleSheet(QString("QProgressBar {text-align: center;} QProgressBar::chunk { background-color: %1; text-align:center;}:").arg(color.name()));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class ProgressWidget : public QWidget
|
|||||||
~ProgressWidget();
|
~ProgressWidget();
|
||||||
void lock(bool lock);
|
void lock(bool lock);
|
||||||
void addText(const QString &text);
|
void addText(const QString &text);
|
||||||
|
QString getText();
|
||||||
void setInfo(const QString &text);
|
void setInfo(const QString &text);
|
||||||
void setMaximum(int value);
|
void setMaximum(int value);
|
||||||
int maximum();
|
int maximum();
|
||||||
|
|||||||
Reference in New Issue
Block a user