Add Jumper t12 support by 3djc (#6451)

* Jumper T12 - companion part

* more work

* Add definitions

* fix libsimulator key handling

* Fix simu keys handling

* Cosmetics

* Continued

* Fix wrong regplace

* Fix wrong regplace

* Please travis

* Please travis

* Add T12 to Travis
Switch naming and display

* Cosmetics

* Work on modules

* Work on modules

* typo

* Fix navigation

* Cosmetics

* Introduce NAVIGATION_type

* Fix

* Make NAVIGATION_type more future proof

* Lots of cleanups and improvements

* Cosmetics

* Fix internal module menu

* Cosmetics

* Fix screen reversed

* Small fixes

* Fix navigation issue

* Please travis

* Fix LCD contrast

* Fix T12 switch layout

* Fix T12 keys screen and all radios keys translations

* Complete rework of SWITCHES screen for all radios

* comsetics

* VC++ compilation
This commit is contained in:
3djc
2019-05-26 19:51:17 +02:00
committed by Andre Bernet
parent f0998ff52f
commit cd3c4ac654
80 changed files with 975 additions and 208 deletions
+18 -1
View File
@@ -83,6 +83,8 @@ uint32_t Boards::getFourCC(Type board)
case BOARD_STOCK:
case BOARD_M128:
return 0;
case BOARD_JUMPER_T12:
return 0x3D78746F;
case BOARD_UNKNOWN:
break;
}
@@ -112,6 +114,7 @@ const int Boards::getEEpromSize(Board::Type board)
case BOARD_TARANIS_X9D:
case BOARD_TARANIS_X9DP:
case BOARD_TARANIS_X9E:
case BOARD_JUMPER_T12:
return EESIZE_TARANIS;
case BOARD_UNKNOWN:
return EESIZE_MAX;
@@ -221,6 +224,18 @@ const SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
if (index < DIM(switches))
return switches[index];
}
else if (IS_JUMPER_T12(board)) {
const Board::SwitchInfo switches[] = {
{SWITCH_3POS, "SA"},
{SWITCH_3POS, "SB"},
{SWITCH_3POS, "SC"},
{SWITCH_3POS, "SD"},
{SWITCH_2POS, "SG"},
{SWITCH_2POS, "SH"}
};
if (index < DIM(switches))
return switches[index];
}
else {
const Board::SwitchInfo switches[] = {
{SWITCH_3POS, "3POS"},
@@ -247,7 +262,7 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
case Pots:
if (IS_TARANIS_X9LITE(board))
return 1;
else if (IS_TARANIS_SMALL(board))
else if (IS_TARANIS_SMALL(board) || IS_JUMPER_T12(board))
return 2;
else if (IS_TARANIS_X9E(board))
return 4;
@@ -302,6 +317,8 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
return 4;
else if (IS_HORUS_OR_TARANIS(board))
return 8;
else if (IS_JUMPER_T12(board))
return 6;
else
return 7;
+3 -1
View File
@@ -47,7 +47,8 @@ namespace Board {
BOARD_X10,
BOARD_TARANIS_XLITE,
BOARD_TARANIS_XLITES,
BOARD_TARANIS_X9LITE
BOARD_TARANIS_X9LITE,
BOARD_JUMPER_T12
};
constexpr int BOARD_TYPE_MAX = BOARD_TARANIS_X9LITE ;
@@ -190,6 +191,7 @@ class Boards
#define IS_2560(board) (board==Board::BOARD_GRUVIN9X || board==Board::BOARD_MEGA2560)
#define IS_SKY9X(board) (board==Board::BOARD_SKY9X || board==Board::BOARD_9XRPRO || board==Board::BOARD_AR9X)
#define IS_9XRPRO(board) (board==Board::BOARD_9XRPRO)
#define IS_JUMPER_T12(board) (board==Board::BOARD_JUMPER_T12)
#define IS_TARANIS_XLITE(board) (board==Board::BOARD_TARANIS_XLITE || board==Board::BOARD_TARANIS_XLITES)
#define IS_TARANIS_XLITES(board) (board==Board::BOARD_TARANIS_XLITES)
#define IS_TARANIS_X7(board) (board==Board::BOARD_TARANIS_X7)
+19 -1
View File
@@ -90,7 +90,7 @@ GeneralSettings::GeneralSettings()
// Lipo 2S
vBatWarn = 66;
vBatMin = -23; // 6.7V
vBatMax = -37; // 8.3V
vBatMax = -37; // 8.3V
}
else if (IS_TARANIS(board)) {
// NI-MH 7.2V, X9D, X9D+ and X7
@@ -249,6 +249,10 @@ void GeneralSettings::setDefaultControlTypes(Board::Type board)
potConfig[0] = Board::POT_WITH_DETENT;
potConfig[1] = Board::POT_WITH_DETENT;
}
else if (IS_JUMPER_T12(board)) {
potConfig[0] = Board::POT_WITH_DETENT;
potConfig[1] = Board::POT_WITH_DETENT;
}
else {
potConfig[0] = Board::POT_WITHOUT_DETENT;
potConfig[1] = Board::POT_WITHOUT_DETENT;
@@ -317,6 +321,20 @@ void GeneralSettings::convert(RadioDataConversionState & cstate)
}
}
if (IS_JUMPER_T12(cstate.toType)) {
if (IS_TARANIS_X9(cstate.fromType) || IS_HORUS(cstate.fromType)) {
strncpy(switchName[4], switchName[5], sizeof(switchName[0]));
strncpy(switchName[5], switchName[7], sizeof(switchName[0]));
}
}
else if (IS_JUMPER_T12(cstate.fromType)) {
if (IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) {
strncpy(switchName[5], switchName[4], sizeof(switchName[0]));
strncpy(switchName[7], switchName[5], sizeof(switchName[0]));
}
}
// LS and RS sliders are after 2 aux sliders on X12 and X9E
if ((IS_HORUS_X12S(cstate.toType) || IS_TARANIS_X9E(cstate.toType)) && !IS_HORUS_X12S(cstate.fromType) && !IS_TARANIS_X9E(cstate.fromType)) {
strncpy(sliderName[0], sliderName[2], sizeof(sliderName[0]));
@@ -35,6 +35,7 @@
#define TARANIS_XLITE_VARIANT 0x2000
#define TARANIS_XLITES_VARIANT 0x1000
#define TARANIS_X9LITE_VARIANT 0x0800
#define JUMPER_T12_VARIANT TARANIS_X7_VARIANT
#define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT)
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
@@ -66,6 +66,8 @@ const char * OpenTxEepromInterface::getName()
return "OpenTX for MEGA2560 board";
case BOARD_GRUVIN9X:
return "OpenTX for Gruvin9x board / 9X";
case BOARD_JUMPER_T12:
return "OpenTX for Jumper T12";
case BOARD_TARANIS_X9D:
return "OpenTX for FrSky Taranis X9D";
case BOARD_TARANIS_X9DP:
@@ -331,6 +333,9 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
else if (IS_TARANIS_XLITE(board)) {
variant |= TARANIS_XLITE_VARIANT;
}
else if (IS_JUMPER_T12(board)) {
variant |= JUMPER_T12_VARIANT;
}
OpenTxGeneralData generator((GeneralSettings &)radioData.generalSettings, board, version, variant);
// generator.dump();
@@ -543,7 +548,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case SoundPitch:
return 1;
case Haptic:
return (IS_2560(board) || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || IS_TARANIS_SMALL(board) || IS_TARANIS_X9E(board) || IS_HORUS(board) || id.contains("haptic"));
return (IS_2560(board) || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || IS_TARANIS_SMALL(board) || IS_TARANIS_X9E(board) || IS_HORUS(board) || IS_JUMPER_T12(board) || id.contains("haptic"));
case ModelTrainerEnable:
if (IS_HORUS_OR_TARANIS(board))
return 1;
@@ -552,7 +557,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case MaxVolume:
return (IS_ARM(board) ? 23 : 7);
case MaxContrast:
if (IS_TARANIS_SMALL(board))
if (IS_TARANIS_SMALL(board) || IS_JUMPER_T12(board))
return 30;
else
return 45;
@@ -644,7 +649,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case LcdWidth:
if (IS_HORUS(board))
return 480;
else if (IS_TARANIS_SMALL(board))
else if (IS_TARANIS_SMALL(board) || IS_JUMPER_T12(board))
return 128;
else if (IS_TARANIS(board))
return 212;
@@ -658,7 +663,7 @@ int OpenTxFirmware::getCapability(::Capability capability)
case LcdDepth:
if (IS_HORUS(board))
return 16;
else if (IS_TARANIS_SMALL(board))
else if (IS_TARANIS_SMALL(board) || IS_JUMPER_T12(board))
return 1;
else if (IS_TARANIS(board))
return 4;
@@ -708,6 +713,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
return TARANIS_XLITES_VARIANT;
else if (IS_TARANIS_XLITE(board))
return TARANIS_XLITE_VARIANT;
else if (IS_JUMPER_T12(board))
return JUMPER_T12_VARIANT;
else
return 0;
case MavlinkTelemetry:
@@ -973,6 +980,11 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
variantError = true;
}
}
else if (IS_JUMPER_T12(board)) {
if (variant != JUMPER_T12_VARIANT) {
variantError = true;
}
}
if (variantError) {
qWarning() << " wrong variant (" << variant << ")";
@@ -1242,6 +1254,17 @@ void registerOpenTxFirmwares()
firmware->addOption("pcbdev", Firmware::tr("Use ONLY with first DEV pcb version"));
registerOpenTxFirmware(firmware);
/* Jumper T12 board */
firmware = new OpenTxFirmware("opentx-t12", QCoreApplication::translate("Firmware", "Jumper T12"), BOARD_JUMPER_T12);
addOpenTxCommonOptions(firmware);
firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support"));
firmware->addOption("nogvars", Firmware::tr("Disable Global variables"));
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
firmware->addOption("luac", Firmware::tr("Enable Lua compiler"));
firmware->addOption("crossfire", Firmware::tr("Support for Crossfire TX Module"));
addOpenTxFontOptions(firmware);
registerOpenTxFirmware(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", Firmware::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO);
addOpenTxArm9xOptions(firmware, false);
+29
View File
@@ -615,6 +615,19 @@ RawSource RawSource::convert(RadioDataConversionState & cstate)
index = 5; // SH to SH
}
}
else if (IS_JUMPER_T12(cstate.toType) && (IS_TARANIS_X9(cstate.fromType) || IS_HORUS(cstate.fromType))) {
// No SE and SG on T12 board
if (index == 4 || index == 6) {
index = 3; // SG and SE to SD
evt = RadioDataConversionState::EVT_CVRT;
}
else if (index == 5) {
index = 4; // SF to SF
}
else if (index == 7) {
index = 5; // SH to SH
}
}
// Compensate for SE and SG on X9/Horus board if converting from X7
else if ((IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) && IS_TARANIS_X7(cstate.fromType)) {
if (index == 4) {
@@ -624,6 +637,22 @@ RawSource RawSource::convert(RadioDataConversionState & cstate)
index = 7; // SH to SH
}
}
else if ((IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) && IS_JUMPER_T12(cstate.fromType)) {
if (index == 4) {
index = 5; // SF to SF
}
else if (index == 5) {
index = 7; // SH to SH
}
}
else if ((IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) && IS_JUMPER_T12(cstate.fromType)) {
if (index == 4) {
index = 5; // SF to SF
}
else if (index == 5) {
index = 7; // SH to SH
}
}
} // SOURCE_TYPE_SWITCH
// final validation (we do not pass model to isAvailable() because we don't know what has or hasn't been converted)
+22
View File
@@ -208,6 +208,20 @@ RawSwitch RawSwitch::convert(RadioDataConversionState & cstate)
delta = 6; // SH to SH
}
}
else if (IS_JUMPER_T12(cstate.toType) && (IS_TARANIS_X9(cstate.fromType) || IS_HORUS(cstate.fromType))) {
if (srcIdx == 4 || srcIdx == 5) {
delta = 3; // SE to SD & SF to SF
if (srcIdx == 4)
evt = RadioDataConversionState::EVT_CVRT;
}
else if (srcIdx == 6) {
delta = 9; // SG to SD
evt = RadioDataConversionState::EVT_CVRT;
}
else if (srcIdx == 7) {
delta = 6; // SH to SH
}
}
// Compensate for SE and SG on X9/Horus board if converting from X7
else if ((IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) && IS_TARANIS_X7(cstate.fromType)) {
if (srcIdx == 4) {
@@ -217,6 +231,14 @@ RawSwitch RawSwitch::convert(RadioDataConversionState & cstate)
delta = -6; // SH to SH
}
}
else if ((IS_TARANIS_X9(cstate.toType) || IS_HORUS(cstate.toType)) && IS_JUMPER_T12(cstate.fromType)) {
if (srcIdx == 4) {
delta = -3; // SF to SF
}
else if (srcIdx == 5) {
delta = -6; // SH to SH
}
}
if (index < 0) {
delta = -delta; // invert for !switch