feat: Deadzone option for NV14 sticks (#1777)
Imported from open-flysky/Flysky-OpenTX-Test-Branch * companion: Don't nuke `stickDeadZone` setting * Implement data storage properly * Add missing check for NV14 storage struct sizes * Formatting * Use one less byte in the packed data struct Thanks @raphaelcoeffic :) * Move setting of stickDeadZone default * Use a Choice combo rather than NumberEdit * Good riddance magic number * Also set default stick zone if setting is missing * Teach tests about `STICK_DEAD_ZONE` * Tweak choice width * Cpn NV14 add stick dead zone to hardware and section labels * Cpn NV14 align default pot names to radio Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
co-authored by
elecpower
parent
9d27a6923c
commit
d9b51f8ecf
@@ -575,8 +575,8 @@ StringTagMappingTable Boards::getAnalogNamesLookupTable(Board::Type board)
|
||||
});
|
||||
} else if (IS_FLYSKY_NV14(board)) {
|
||||
tbl.insert(tbl.end(), {
|
||||
{"VRA", "POT1"},
|
||||
{"VRB", "POT2"},
|
||||
{"S1", "POT1"},
|
||||
{"S2", "POT2"},
|
||||
});
|
||||
} else if (IS_HORUS_X10(board) || IS_FAMILY_T16(board)) {
|
||||
tbl.insert(tbl.end(), {
|
||||
@@ -873,10 +873,10 @@ int Boards::getDefaultInternalModules(Board::Type board)
|
||||
case BOARD_JUMPER_TLITE:
|
||||
case BOARD_JUMPER_TPRO:
|
||||
return (int)MODULE_TYPE_MULTIMODULE;
|
||||
|
||||
|
||||
case BOARD_RADIOMASTER_ZORRO:
|
||||
return (int)MODULE_TYPE_CROSSFIRE;
|
||||
|
||||
|
||||
case BOARD_FLYSKY_NV14:
|
||||
return (int)MODULE_TYPE_FLYSKY;
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
|
||||
node["disableAlarmWarning"] = (int)rhs.disableAlarmWarning;
|
||||
node["disableRssiPoweroffAlarm"] = (int)rhs.disableRssiPoweroffAlarm;
|
||||
node["USBMode"] = rhs.usbMode;
|
||||
node["stickDeadZone"] = rhs.stickDeadZone;
|
||||
node["jackMode"] = rhs.jackMode;
|
||||
node["hapticMode"] = rhs.hapticMode;
|
||||
node["stickMode"] = rhs.stickMode;
|
||||
@@ -349,6 +350,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
|
||||
node["disableAlarmWarning"] >> rhs.disableAlarmWarning;
|
||||
node["disableRssiPoweroffAlarm"] >> rhs.disableRssiPoweroffAlarm;
|
||||
node["USBMode"] >> rhs.usbMode;
|
||||
node["stickDeadZone"] >> rhs.stickDeadZone;
|
||||
node["jackMode"] >> rhs.jackMode;
|
||||
node["hapticMode"] >> rhs.hapticMode;
|
||||
node["stickMode"] >> rhs.stickMode;
|
||||
|
||||
@@ -249,6 +249,9 @@ void GeneralSettings::init()
|
||||
|
||||
internalModule = g.profile[g.sessionId()].defaultInternalModule();
|
||||
|
||||
if (IS_FLYSKY_NV14(board))
|
||||
stickDeadZone = 2;
|
||||
|
||||
}
|
||||
|
||||
void GeneralSettings::setDefaultControlTypes(Board::Type board)
|
||||
@@ -589,6 +592,20 @@ AbstractStaticItemModel * GeneralSettings::internalModuleBaudrateItemModel()
|
||||
return mdl;
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * GeneralSettings::stickDeadZoneItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_GS_STICKDEADZONE);
|
||||
|
||||
for (int i = 0; i <= 7; i++) {
|
||||
mdl->appendToItemList(i ? QString::number((int)(2 << (i - 1))) : QString::number(0), i);
|
||||
}
|
||||
|
||||
mdl->loadItemList();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
/*
|
||||
TrainerMix
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,7 @@ constexpr char AIM_GS_ANTENNAMODE[] {"gs.antennamode"};
|
||||
constexpr char AIM_GS_BLUETOOTHMODE[] {"gs.bluetoothmode"};
|
||||
constexpr char AIM_GS_SERIALMODE[] {"gs.serialmode%1"};
|
||||
constexpr char AIM_GS_INTMODULEBAUDRATE[] {"gs.intmodulebaudrate"};
|
||||
constexpr char AIM_GS_STICKDEADZONE[] {"gs.stickdeadzone"};
|
||||
constexpr char AIM_TRAINERMIX_MODE[] {"trainermix.mode"};
|
||||
constexpr char AIM_TRAINERMIX_SRC[] {"trainermix.src"};
|
||||
|
||||
@@ -151,7 +152,7 @@ class GeneralSettings {
|
||||
SP_VCP,
|
||||
SP_COUNT,
|
||||
};
|
||||
|
||||
|
||||
GeneralSettings() { clear(); }
|
||||
void clear();
|
||||
void init();
|
||||
@@ -186,6 +187,7 @@ class GeneralSettings {
|
||||
bool disableAlarmWarning;
|
||||
bool disableRssiPoweroffAlarm;
|
||||
unsigned int usbMode;
|
||||
unsigned int stickDeadZone;
|
||||
unsigned int jackMode;
|
||||
bool sportPower;
|
||||
BeeperMode hapticMode;
|
||||
@@ -281,4 +283,5 @@ class GeneralSettings {
|
||||
static AbstractStaticItemModel * bluetoothModeItemModel();
|
||||
static AbstractStaticItemModel * serialModeItemModel(int port_nr);
|
||||
static AbstractStaticItemModel * internalModuleBaudrateItemModel();
|
||||
static AbstractStaticItemModel * stickDeadZoneItemModel();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user