diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc
index 9fb054ce9..0b8688d97 100644
--- a/companion/src/companion.qrc
+++ b/companion/src/companion.qrc
@@ -71,6 +71,7 @@
images/wizard/models.png
images/wizard/multirotor.png
images/wizard/rudder.png
+ images/wizard/options.png
images/wizard/simpletail.png
images/wizard/tail.png
images/wizard/tails.png
diff --git a/companion/src/images/wizard/options.png b/companion/src/images/wizard/options.png
new file mode 100644
index 000000000..39d6190e7
Binary files /dev/null and b/companion/src/images/wizard/options.png differ
diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp
index 28b028cd1..8b43edd9e 100644
--- a/companion/src/wizarddata.cpp
+++ b/companion/src/wizarddata.cpp
@@ -67,35 +67,60 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
}
else if (input==FLAPS_INPUT){
// There ought to be some kind of constants for switches somewhere...
- maxMixSwitch((char *)"Flaps Up", model.mixData[mixIndex++], channel+1, isTaranis ? 1 :-3 , weight); //SA-UP or ELE-UP
- maxMixSwitch((char *)"Flaps Down", model.mixData[mixIndex++], channel+1, isTaranis ? 3 : 3 , -weight); //SA-DOWN or ELE-DOWN
+ maxMixSwitch((char *)"Flaps Up", model.mixData[mixIndex++], channel+1, isTaranis ? 1 :-3 , weight); //Taranis SA-UP, 9X ELE-UP
+ maxMixSwitch((char *)"Flaps Down", model.mixData[mixIndex++], channel+1, isTaranis ? 3 : 3 , -weight); //Taranis SA-DOWN, 9X ELE-DOWN
}
else if (input==AIRBRAKES_INPUT){
- maxMixSwitch((char *)"Airbrk Off", model.mixData[mixIndex++], channel+1, isTaranis ? 13 :-2 , -weight); //SE-UP or RUD-UP
- maxMixSwitch((char *)"Airbrk On", model.mixData[mixIndex++], channel+1, isTaranis ? 15 : 2 , weight); //SE-DOWN or RUD-DOWN
+ maxMixSwitch((char *)"Airbrk Off", model.mixData[mixIndex++], channel+1, isTaranis ? 13 :-2 , -weight); //Taranis SE-UP, 9X RUD-UP
+ maxMixSwitch((char *)"Airbrk On", model.mixData[mixIndex++], channel+1, isTaranis ? 15 : 2 , weight); //Tatanis SE-DOWN, 9X RUD-DOWN
}
}
}
WizMix::operator ModelData()
{
+ int throttleChannel = -1;
+ bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard());
+
ModelData model;
model.used = true;
model.modelId = modelId;
model.setDefaultInputs(settings);
+ int mixIndex = 0;
+ int switchIndex = 0;
+ int timerIndex = 0;
+
// Safe copy model name
strncpy(model.name, name, WIZ_MODEL_NAME_LENGTH);
model.name[WIZ_MODEL_NAME_LENGTH] = 0;
- int mixIndex = 0;
+ // Add the channel mixes
for (int i=0; i=0 ){
+ model.funcSw[switchIndex].swtch.type = SWITCH_TYPE_SWITCH;
+ model.funcSw[switchIndex].swtch.index = isTaranis ? 16 : 1; // Taranis SF-UP, 9X THR-UP
+ model.funcSw[switchIndex].enabled = 1;
+ model.funcSw[switchIndex].func = (AssignFunc)throttleChannel;
+ }
+
+ // Add the Throttle Timer option
+ if (options[THROTTLE_TIMER_OPTION] && throttleChannel >=0 ){
+ model.timers[timerIndex].mode.type = SWITCH_TYPE_SWITCH;
+ model.timers[timerIndex].mode.index = isTaranis ? -16 : -1; // Taranis !SF-UP, 9X THR-DOWN
+ timerIndex++;
+ }
return model;
}
diff --git a/companion/src/wizarddata.h b/companion/src/wizarddata.h
index f361f7e88..72b9d9fbb 100644
--- a/companion/src/wizarddata.h
+++ b/companion/src/wizarddata.h
@@ -18,7 +18,7 @@
#include "eeprominterface.h"
#define WIZ_MAX_CHANNELS 8
-
+#define WIZ_MAX_OPTIONS 2
// TODO use a constant common to the whole companion
// TODO when in the wizard use the getCapacity(...) to know how long the name can be
#define WIZ_MODEL_NAME_LENGTH 12
@@ -40,6 +40,11 @@ enum Vehicle {
HELICOPTER
};
+enum Options {
+ THROTTLE_CUT_OPTION,
+ THROTTLE_TIMER_OPTION
+};
+
enum WizardPage {
Page_None = -1,
Page_Models,
@@ -60,6 +65,7 @@ enum WizardPage {
Page_Fblheli,
Page_Helictrl,
Page_Multirotor,
+ Page_Options,
Page_Conclusion
};
@@ -86,6 +92,7 @@ class WizMix
const GeneralSettings & settings;
Vehicle vehicle;
Channel channel[WIZ_MAX_CHANNELS];
+ bool options[WIZ_MAX_OPTIONS];
WizMix(const GeneralSettings & settings, const unsigned int modelId);
operator ModelData();
diff --git a/companion/src/wizarddialog.cpp b/companion/src/wizarddialog.cpp
index 25232bf10..d41628938 100644
--- a/companion/src/wizarddialog.cpp
+++ b/companion/src/wizarddialog.cpp
@@ -32,17 +32,18 @@ WizardDialog::WizardDialog(const GeneralSettings & settings, unsigned int modelI
setPage(Page_Flaps, new FlapsPage(this, "flaps",tr("Flaps"),tr("Has your model got flaps?"), Page_Airbrakes));
setPage(Page_Airbrakes, new AirbrakesPage(this, "airbrakes",tr("Airbrakes"),tr("Has your model got airbrakes?"), Page_Tails));
setPage(Page_Bank, new BankPage(this, "bank",tr("Flying-wing / Delta-wing"),tr("Are the elevons controlled by servos connected to separate channels or by a single servo channel?"), Page_Rudder));
- setPage(Page_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Conclusion));
+ setPage(Page_Rudder, new RudderPage(this, "rudder",tr("Rudder"),tr("Does your model have a rudder?"), Page_Options));
setPage(Page_Tails, new TailSelectionPage(this, "tails",tr("Tail Type"),tr("Select which type of tail your model is equiped with.")));
- setPage(Page_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Conclusion));
- setPage(Page_Vtail, new VTailPage(this, "vtail",tr("V-Tail"),tr("Select channels for tail control."), Page_Conclusion));
- setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Conclusion));
+ setPage(Page_Tail, new TailPage(this, "tail",tr("Tail"),tr("Select channels for tail control."), Page_Options));
+ setPage(Page_Vtail, new VTailPage(this, "vtail",tr("V-Tail"),tr("Select channels for tail control."), Page_Options));
+ setPage(Page_Simpletail, new SimpleTailPage(this, "simpletail",tr("Tail"),tr("Select elevator channel."), Page_Options));
setPage(Page_Cyclic, new CyclicPage(this, "cyclic",tr("Cyclic"),tr("Which type of swash control is installed in your helicopter?"), Page_Gyro));
setPage(Page_Gyro, new GyroPage(this, "gyro",tr("Tail Gyro"),tr("Has your helicopter got an adjustable gyro for the tail?"), Page_Flybar));
setPage(Page_Flybar, new FlybarSelectionPage(this, "flybar",tr("Rotor Type"),tr("Has your helicopter got a flybar?")));
- setPage(Page_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion));
- setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Conclusion));
- setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Conclusion));
+ setPage(Page_Fblheli, new FblPage(this, "fblheli",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Options));
+ setPage(Page_Helictrl, new HeliPage(this, "helictrl",tr("Helicopter"),tr("Select the controls for your helicopter"), Page_Options));
+ setPage(Page_Multirotor, new MultirotorPage(this, "multirotor",tr("Multirotor"),tr("Select the control channels for your multirotor"), Page_Options));
+ setPage(Page_Options, new OptionsPage(this, "options",tr("Model Options"),tr("Select additional options"), Page_Conclusion));
setPage(Page_Conclusion, new ConclusionPage(this, "conclusion",tr("Save Changes"),tr(
"Manually check the direction of each control surface and reverse any channels that make controls move in the wrong direction. "
"Remove the propeller/propellers before you try to control your model for the first time.
"
@@ -117,6 +118,8 @@ void WizardDialog::showHelp()
"Yaw - Spektrum: CH4, Futaba: CH4
"
"Pitch - Spektrum: CH3, Futaba: CH2
"
"Roll - Spektrum: CH2, Futaba: CH1"); break;
+ case Page_Options:
+ message = tr("TBD."); break;
case Page_Conclusion:
message = tr("TBD."); break;
default:
@@ -832,6 +835,27 @@ bool MultirotorPage::validatePage() {
bookChannel(rollCB, AILERONS_INPUT, 100 ));
}
+OptionsPage::OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
+ : StandardPage(Page_Options, dlg, image, title, text, nextPage)
+{
+ throttleCutRB = new QCheckBox(tr("Throttle Cut"));
+ throttleTimerRB = new QCheckBox(tr("Throttle Timer"));
+
+ QLayout *l = layout();
+ l->addWidget(throttleCutRB);
+ l->addWidget(throttleTimerRB);
+}
+
+void OptionsPage::initializePage(){
+ StandardPage::initializePage();
+}
+
+bool OptionsPage::validatePage(){
+ wizDlg->mix.options[THROTTLE_CUT_OPTION] = throttleCutRB->isChecked();
+ wizDlg->mix.options[THROTTLE_TIMER_OPTION] = throttleTimerRB->isChecked();
+ return true;
+}
+
ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage)
: StandardPage(Page_Conclusion, dlg, image, title, text, nextPage)
{
@@ -840,8 +864,8 @@ ConclusionPage::ConclusionPage(WizardDialog *dlg, QString image, QString title,
registerField("evaluate.proceed*", proceedCB);
QLayout *l = layout();
- l->addWidget(proceedCB);
l->addWidget(textLabel);
+ l->addWidget(proceedCB);
}
void ConclusionPage::initializePage(){
@@ -898,6 +922,16 @@ QString WizardPrinter::print()
QString str;
str = QString(tr("Model Name: ")) + mix->name + "\n";
str += QString(tr("Model Type: ")) + vehicleName(mix->vehicle) + "\n";
+
+ str += QString(tr("Options: ["));
+ for (int i=0; ioptions[i])
+ str += "X";
+ else
+ str += "-";
+ }
+ str += QString(tr("]")) + "\n";
+
for (int i=0; ichannel[i].page != Page_None) {
Channel ch = mix->channel[i];
diff --git a/companion/src/wizarddialog.h b/companion/src/wizarddialog.h
index 94ef18a5e..b512d695b 100644
--- a/companion/src/wizarddialog.h
+++ b/companion/src/wizarddialog.h
@@ -333,6 +333,18 @@ private:
QComboBox *rollCB;
};
+class OptionsPage: public StandardPage
+{
+ Q_OBJECT
+public:
+ OptionsPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage=-1);
+ void initializePage();
+ bool validatePage();
+private:
+ QCheckBox *throttleCutRB;
+ QCheckBox *throttleTimerRB;
+};
+
class ConclusionPage: public StandardPage
{
Q_OBJECT