diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 8583be517..ddf770469 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -486,6 +486,7 @@ class GeneralSettings { int PPM_Multiplier; int hapticLength; unsigned int reNavigation; + unsigned int stickReverse; bool hideNameOnSplash; bool enablePpmsim; unsigned int speakerPitch; diff --git a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp index 63a0075d1..aea3df1cb 100644 --- a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp @@ -47,6 +47,7 @@ #define GAUGES #define GPS #define FAI_CHOICE +#define FRSKY_STICKS #define EEPROM_VARIANT 3 diff --git a/companion/src/firmwares/opentx/opentxM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp index 3689b8bc8..e615d8d9c 100644 --- a/companion/src/firmwares/opentx/opentxM128simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp @@ -45,6 +45,7 @@ #define GAUGES #define GPS #define FAI_CHOICE +#define FRSKY_STICKS #define EEPROM_VARIANT SIMU_M128_VARIANTS #define GAUGES diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp index fde902900..5e3e5d233 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp @@ -53,6 +53,7 @@ #define GAUGES #define GPS #define FAI_CHOICE +#define FRSKY_STICKS #define NUM_POTS 3 #define EEPROM_VARIANT 3 diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 61ea043a4..911734919 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2639,7 +2639,15 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo internalField.Append(new UnsignedField<8>(generalData.templateSetup)); internalField.Append(new SignedField<8>(generalData.PPM_Multiplier)); internalField.Append(new SignedField<8>(generalData.hapticLength)); - internalField.Append(new UnsignedField<8>(generalData.reNavigation)); + + if (version < 216 || !IS_9X(board)) { + internalField.Append(new UnsignedField<8>(generalData.reNavigation)); + } + + if (version >= 216 && !IS_TARANIS(board)) { + internalField.Append(new UnsignedField<4>(generalData.stickReverse)); + internalField.Append(new SpareBitsField<4>()); + } internalField.Append(new SignedField<3>(generalData.beeperLength)); internalField.Append(new UnsignedField<3>(generalData.hapticStrength)); diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 1a2dbb6bd..6fae71c75 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -1051,6 +1051,7 @@ void registerOpenTxFirmwares() openTx->addOption("nogps", QObject::tr("No GPS support")); openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen")); openTx->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors")); + openTx->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)")); openTx->addOptions(fai_options); firmwares.push_back(openTx); @@ -1117,6 +1118,7 @@ void registerOpenTxFirmwares() openTx->addOption("novario", QObject::tr("No vario support")); openTx->addOption("nogps", QObject::tr("No GPS support")); openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen")); + openTx->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)")); openTx->addOptions(fai_options); firmwares.push_back(openTx); diff --git a/companion/src/firmwares/opentx/opentxsimulator.cpp b/companion/src/firmwares/opentx/opentxsimulator.cpp index 49050cdc9..a21b90732 100644 --- a/companion/src/firmwares/opentx/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxsimulator.cpp @@ -49,6 +49,7 @@ #define GAUGES #define GPS #define FAI_CHOICE +#define FRSKY_STICKS #define EEPROM_VARIANT SIMU_STOCK_VARIANTS #define GAUGES diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp index 7cb76076a..1ec231830 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -278,6 +278,24 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : ui->serialPortMode->hide(); ui->serialPortLabel->hide(); } + + if (!IS_TARANIS(eepromInterface->getBoard())) { + ui->stickReverse1->setChecked(g_eeGeneral.stickReverse & (1 << 0)); + ui->stickReverse2->setChecked(g_eeGeneral.stickReverse & (1 << 1)); + ui->stickReverse3->setChecked(g_eeGeneral.stickReverse & (1 << 2)); + ui->stickReverse4->setChecked(g_eeGeneral.stickReverse & (1 << 3)); + connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + } + else { + ui->stickReverseLB->hide(); + ui->stickReverse1->hide(); + ui->stickReverse2->hide(); + ui->stickReverse3->hide(); + ui->stickReverse4->hide(); + } } GeneralEdit::~GeneralEdit() @@ -285,6 +303,12 @@ GeneralEdit::~GeneralEdit() delete ui; } +void GeneralEdit::stickReverseEdited() +{ + g_eeGeneral.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3); + updateSettings(); +} + void GeneralEdit::on_pot1Type_currentIndexChanged(int index) { g_eeGeneral.potsType[0] = index; diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h index 395adc24c..221ea02d1 100644 --- a/companion/src/generaledit.h +++ b/companion/src/generaledit.h @@ -130,6 +130,7 @@ private slots: void unlockSwitchEdited(); void setValues(); void shrink(); + void stickReverseEdited(); }; #endif // GENERALEDIT_H diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui index 1b59ef886..16b2b7d81 100644 --- a/companion/src/generaledit.ui +++ b/companion/src/generaledit.ui @@ -113,134 +113,6 @@ These will be relevant for all models in the same EEPROM. Setup - - - - - - Country Code - - - - - - - - America - - - - - Japan - - - - - Europe - - - - - - - - - - - - - - - - Mode selection: - -Mode 1: - Left stick: Elevator, Rudder - Right stick: Throttle, Aileron - -Mode 2: - Left stick: Throttle, Rudder - Right stick: Elevator, Aileron - -Mode 3: - Left stick: Elevator, Aileron - Right stick: Throttle, Rudder - -Mode 4: - Left stick: Throttle, Aileron - Right stick: Elevator, Rudder - - - - - 1 - - - - Mode 1 (RUD ELE THR AIL) - - - - - Mode 2 (RUD THR ELE AIL) - - - - - Mode 3 (AIL ELE THR RUD) - - - - - Mode 4 (AIL THR ELE RUD) - - - - - - - - - 4800 Baud - - - - - 9600 Baud - - - - - 14400 Baud - - - - - 19200 Baud - - - - - 38400 Baud - - - - - 57600 Baud - - - - - 76800 Baud - - - - - 115200 Baud - - - - @@ -248,6 +120,52 @@ Mode 4: + + + + If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio. + + + + + + + + + + Speaker Pitch (spkr only) + + + + + + + + X-Short + + + + + Short + + + + + Normal + + + + + Long + + + + + X-Long + + + + @@ -344,6 +262,80 @@ Mode 4: + + + + + + Country Code + + + + + + + + America + + + + + Japan + + + + + Europe + + + + + + + + + + + 4800 Baud + + + + + 9600 Baud + + + + + 14400 Baud + + + + + 19200 Baud + + + + + 38400 Baud + + + + + 57600 Baud + + + + + 76800 Baud + + + + + 115200 Baud + + + + @@ -396,7 +388,7 @@ Mode 4: - + Qt::Vertical @@ -524,15 +516,8 @@ Mode 4: - - - - Stick Mode - - - - - + + 0 @@ -540,7 +525,7 @@ Mode 4: - Default Channel Order + Stick reverse @@ -638,188 +623,6 @@ Mode 4: - - - - - X-Short - - - - - Short - - - - - Normal - - - - - Long - - - - - X-Long - - - - - - - - Speaker Pitch (spkr only) - - - - - - - - - - - - - <html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html> - - - 0 - - - - R E T A - - - - - R E A T - - - - - R T E A - - - - - R T A E - - - - - R A E T - - - - - R A T E - - - - - E R T A - - - - - E R A T - - - - - E T R A - - - - - E T A R - - - - - E A R T - - - - - E A T R - - - - - T R E A - - - - - T R A E - - - - - T E R A - - - - - T E A R - - - - - T A R E - - - - - T A E R - - - - - A R E T - - - - - A R T E - - - - - A E R T - - - - - A E T R - - - - - A T R E - - - - - A T E R - - - - - - - - If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio. - - - - - - @@ -1897,6 +1700,248 @@ Acceptable values are 5v..10v + + + + + 0 + 0 + + + + Default Channel Order + + + + + + + + + + + + + <html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html> + + + 0 + + + + R E T A + + + + + R E A T + + + + + R T E A + + + + + R T A E + + + + + R A E T + + + + + R A T E + + + + + E R T A + + + + + E R A T + + + + + E T R A + + + + + E T A R + + + + + E A R T + + + + + E A T R + + + + + T R E A + + + + + T R A E + + + + + T E R A + + + + + T E A R + + + + + T A R E + + + + + T A E R + + + + + A R E T + + + + + A R T E + + + + + A E R T + + + + + A E T R + + + + + A T R E + + + + + A T E R + + + + + + + + + + 1 + + + + + + + 2 + + + + + + + 3 + + + + + + + 4 + + + + + + + + + + + + + + + Mode selection: + +Mode 1: + Left stick: Elevator, Rudder + Right stick: Throttle, Aileron + +Mode 2: + Left stick: Throttle, Rudder + Right stick: Elevator, Aileron + +Mode 3: + Left stick: Elevator, Aileron + Right stick: Throttle, Rudder + +Mode 4: + Left stick: Throttle, Aileron + Right stick: Elevator, Rudder + + + + + 1 + + + + Mode 1 (RUD ELE THR AIL) + + + + + Mode 2 (RUD THR ELE AIL) + + + + + Mode 3 (AIL ELE THR RUD) + + + + + Mode 4 (AIL THR ELE RUD) + + + + + + + + Stick Mode + + + @@ -3199,7 +3244,6 @@ Acceptable values are 5v..10v - channelorderCB trnMode_1 trnChn_1 trnWeight_1 diff --git a/radio/src/Makefile b/radio/src/Makefile index f2162c5bc..dde8ed6f3 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -97,10 +97,9 @@ NAVIGATION = NO # Values = YES, NO AUTOSWITCH = NO -# Swap Stick Inputs for AIL,ELE,RUD,THR -# Used in some scenarios where stick/pot entries -# cannot be changed by soldering the pots. - +# Stock sticks replaced by FrSky ones +# Values = YES, NO +FRSKY_STICKS = NO # Sources automatic selection # Values = YES, NO @@ -803,8 +802,8 @@ ifeq ($(AUTOSOURCE), YES) CPPDEFS += -DAUTOSOURCE endif -ifeq ($(TARANIS_STICKS), YES) - CPPDEFS += -DTARANIS_STICKS +ifeq ($(FRSKY_STICKS), YES) + CPPDEFS += -DFRSKY_STICKS endif diff --git a/radio/src/gui/menu_general.cpp b/radio/src/gui/menu_general.cpp index 0f070bbfe..3aab6781f 100644 --- a/radio/src/gui/menu_general.cpp +++ b/radio/src/gui/menu_general.cpp @@ -197,6 +197,12 @@ enum menuGeneralSetupItems { ITEM_SETUP_MAX }; +#if defined(FRSKY_STICKS) + #define COL_TX_MODE 0 +#else + #define COL_TX_MODE LABEL(TX_MODE) +#endif + void menuGeneralSetup(uint8_t event) { #if defined(RTCLOCK) @@ -219,7 +225,7 @@ void menuGeneralSetup(uint8_t event) } #endif - MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BUZZER(0) IF_VOICE(0) IF_CPUARM(0) IF_CPUARM(0) IF_CPUARM(0) 0, IF_AUDIO(0) IF_VARIO_CPUARM(LABEL(VARIO)) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_PCBSKY9X(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, IF_CPUARM(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH_PARAM(0) IF_GPS(0) IF_GPS(0) IF_PXX(0) IF_CPUARM(0) IF_CPUARM(0) IF_FAI_CHOICE(0) 0, LABEL(TX_MODE), CASE_PCBTARANIS(0) 1/*to force edit mode*/}); + MENU(STR_MENURADIOSETUP, menuTabDiag, e_Setup, ITEM_SETUP_MAX+1, {0, IF_RTCLOCK(2) IF_RTCLOCK(2) IF_BATTGRAPH(1) LABEL(SOUND), IF_AUDIO(0) IF_BUZZER(0) IF_VOICE(0) IF_CPUARM(0) IF_CPUARM(0) IF_CPUARM(0) 0, IF_AUDIO(0) IF_VARIO_CPUARM(LABEL(VARIO)) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_VARIO_CPUARM(0) IF_HAPTIC(LABEL(HAPTIC)) IF_HAPTIC(0) IF_HAPTIC(0) IF_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_PCBSKY9X(0) CASE_PCBSKY9X(0) 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, IF_CPUARM(0) CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, IF_SPLASH_PARAM(0) IF_GPS(0) IF_GPS(0) IF_PXX(0) IF_CPUARM(0) IF_CPUARM(0) IF_FAI_CHOICE(0) 0, COL_TX_MODE, CASE_PCBTARANIS(0) 1/*to force edit mode*/}); uint8_t sub = m_posVert - 1; @@ -628,7 +634,21 @@ void menuGeneralSetup(uint8_t event) case ITEM_SETUP_STICK_MODE_LABELS: lcd_putsLeft(y, NO_INDENT(STR_MODE)); - for (uint8_t i=0; i<4; i++) lcd_img((6+4*i)*FW, y, sticks, i, 0); + for (uint8_t i=0; i<4; i++) { + lcd_img((6+4*i)*FW, y, sticks, i, 0); +#if defined(FRSKY_STICKS) + if (g_eeGeneral.stickReverse & (1<