From 119f3ef88cb8141bee3e2cfa8c056310af816f66 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 4 Dec 2016 12:18:57 +0100 Subject: [PATCH] Fix tricky access to Horus settings (#4094) --- companion/src/modeledit/modeledit.cpp | 16 +++++++++++----- companion/src/simulator.cpp | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index 8d90cffd2..c5642ed24 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -47,8 +47,11 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw ui->setupUi(this); setWindowIcon(CompanionIcon("edit.png")); - restoreGeometry(g.modelEditGeo()); + restoreGeometry(g.modelEditGeo()); ui->pushButton->setIcon(CompanionIcon("simulate.png")); + if(GetCurrentFirmware()->getBoard() == BOARD_HORUS && !HORUS_READY_FOR_RELEASE()) { + ui->pushButton->setEnabled(false); + } SetupPanel * setupPanel = new SetupPanel(this, model, generalSettings, firmware); addTab(setupPanel, tr("Setup")); if (firmware->getCapability(Heli)) @@ -68,7 +71,7 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw s1.report("CF"); if (firmware->getCapability(Telemetry) & TM_HASTELEMETRY) addTab(new TelemetryPanel(this, model, generalSettings, firmware), tr("Telemetry")); - + connect(setupPanel, SIGNAL(extendedLimitsToggled()), chnPanel, SLOT(refreshExtendedLimits())); s1.report("end"); gStopwatch.report("ModelEdit end constructor"); @@ -107,7 +110,12 @@ void ModelEdit::on_tabWidget_currentChanged(int index) void ModelEdit::on_pushButton_clicked() { - launchSimulation(); + if (GetCurrentFirmware()->getBoard() == BOARD_HORUS && !HORUS_READY_FOR_RELEASE()) { + QMessageBox::warning(this, "Unavailable", "Horus simulation not currently supported within Companion"); + } + else { + launchSimulation(); + } } void ModelEdit::launchSimulation() @@ -118,5 +126,3 @@ void ModelEdit::launchSimulation() startSimulation(this, *simuData, 0); delete simuData; } - - diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index 7ba096ba5..0f48ca128 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) showMessage(QObject::tr("ERROR: Simulator %1 not found").arg(firmwareId), QMessageBox::Critical); return 2; } - if (factory->type() == BOARD_HORUS && HORUS_READY_FOR_RELEASE()) + if (factory->type() == BOARD_HORUS) dialog = new SimulatorDialogHorus(NULL, factory->create()); else if (factory->type() == BOARD_FLAMENCO) dialog = new SimulatorDialogFlamenco(NULL, factory->create());