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();
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ class ExclusiveComboGroup: public QObject
|
||||
|
||||
QList<QComboBox*> combos;
|
||||
std::function<bool(const QVariant&)> filter;
|
||||
|
||||
|
||||
public:
|
||||
ExclusiveComboGroup(QObject *parent, std::function<bool(const QVariant&)> filter) :
|
||||
QObject(parent), filter(std::move(filter))
|
||||
@@ -105,6 +105,8 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
int count;
|
||||
int row = 0;
|
||||
|
||||
addSection(tr("Sticks"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Sticks);
|
||||
if (count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
@@ -112,6 +114,16 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_FLYSKY_NV14(board)) {
|
||||
addLabel(tr("Dead zone"), row, 0);
|
||||
AutoComboBox *spnStickDeadZone = new AutoComboBox(this);
|
||||
spnStickDeadZone->setModel(GeneralSettings::stickDeadZoneItemModel());
|
||||
spnStickDeadZone->setField(generalSettings.stickDeadZone, this);
|
||||
addParams(row, spnStickDeadZone);
|
||||
}
|
||||
|
||||
addSection(tr("Pots"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Pots);
|
||||
count -= firmware->getCapability(HasFlySkyGimbals) ? 2 : 0;
|
||||
if (count > 0) {
|
||||
@@ -120,22 +132,26 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
}
|
||||
}
|
||||
|
||||
addSection(tr("Sliders"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Sliders);
|
||||
if (count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
addSlider(i, row);
|
||||
}
|
||||
addLine(row);
|
||||
}
|
||||
|
||||
addSection(tr("Switches"), row);
|
||||
|
||||
count = Boards::getCapability(board, Board::Switches);
|
||||
if (count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
addSwitch(i, row);
|
||||
}
|
||||
addLine(row);
|
||||
}
|
||||
|
||||
addLine(row);
|
||||
|
||||
if (Boards::getCapability(board, Board::HasRTC)) {
|
||||
addLabel(tr("RTC Battery Check"), row, 0);
|
||||
AutoCheckBox *rtcCheckDisable = new AutoCheckBox(this);
|
||||
@@ -194,7 +210,7 @@ HardwarePanel::HardwarePanel(QWidget * parent, GeneralSettings & generalSettings
|
||||
generalSettings.internalModuleBaudrate = 0;
|
||||
internalModuleBaudRate->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
addParams(row, internalModule, internalModuleBaudRate);
|
||||
row++;
|
||||
}
|
||||
@@ -386,3 +402,9 @@ void HardwarePanel::addParams(int & row, QWidget * widget1, QWidget * widget2)
|
||||
grid->addLayout(subgrid, row, 1);
|
||||
row++;
|
||||
}
|
||||
|
||||
void HardwarePanel::addSection(QString text, int & row)
|
||||
{
|
||||
addLabel(QString("<b>%1</b>").arg(text), row, 0);
|
||||
row++;
|
||||
}
|
||||
|
||||
@@ -57,4 +57,5 @@ class HardwarePanel : public GeneralPanel
|
||||
void addLabel(QString text, int row, int col);
|
||||
void addLine(int & row);
|
||||
void addParams(int & row, QWidget * widget1, QWidget * widget2 = nullptr);
|
||||
void addSection(QString text, int & row);
|
||||
};
|
||||
|
||||
@@ -141,6 +141,9 @@ static inline void check_struct()
|
||||
CHKSIZE(RadioData, 901);
|
||||
CHKSIZE(ModelData, 11023);
|
||||
#endif
|
||||
#elif defined(PCBNV14)
|
||||
CHKSIZE(RadioData, 849);
|
||||
CHKSIZE(ModelData, 10839);
|
||||
#endif
|
||||
|
||||
#undef CHKSIZE
|
||||
|
||||
@@ -823,7 +823,7 @@ PACK(struct TrainerData {
|
||||
#if defined(BUZZER)
|
||||
#define BUZZER_FIELD int8_t buzzerMode:2 // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
|
||||
#else
|
||||
#define BUZZER_FIELD int8_t spare4:2 SKIP
|
||||
#define BUZZER_FIELD int8_t spare1:2 SKIP
|
||||
#endif
|
||||
|
||||
PACK(struct RadioData {
|
||||
@@ -913,6 +913,12 @@ PACK(struct RadioData {
|
||||
GYRO_FIELDS
|
||||
|
||||
NOBACKUP(int8_t uartSampleMode:2); // See UartSampleModes
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
NOBACKUP(uint8_t stickDeadZone:3);
|
||||
NOBACKUP(uint8_t spare2:3 SKIP);
|
||||
#else
|
||||
NOBACKUP(uint8_t spare2:6 SKIP);
|
||||
#endif
|
||||
});
|
||||
|
||||
#undef SWITCHES_WARNING_DATA
|
||||
|
||||
@@ -346,6 +346,20 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
new StaticText(window, grid.getLabelSlot(true), STR_DEAD_ZONE);
|
||||
auto choice =
|
||||
new Choice(window, grid.getFieldSlot(2,0), 0, 7,
|
||||
GET_DEFAULT(g_eeGeneral.stickDeadZone), [=](uint8_t newValue) {
|
||||
g_eeGeneral.stickDeadZone = newValue;
|
||||
SET_DIRTY();
|
||||
});
|
||||
choice->setTextHandler([](uint8_t value) {
|
||||
return std::to_string(value ? 2 << (value - 1) : 0);
|
||||
});
|
||||
grid.nextLine();
|
||||
#endif
|
||||
|
||||
// Pots
|
||||
new Subtitle(window, grid.getLineSlot(), STR_POTS, 0, COLOR_THEME_PRIMARY1);
|
||||
grid.nextLine();
|
||||
|
||||
@@ -442,6 +442,23 @@ void evalInputs(uint8_t mode)
|
||||
{
|
||||
BeepANACenter anaCenter = 0;
|
||||
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
static int16_t P_OFFSET = 0;
|
||||
static int16_t N_OFFSET = 0;
|
||||
static float aParam = 0.0f;
|
||||
static float bParam = 0.0f;
|
||||
static int16_t lastDeadZone = -1;
|
||||
|
||||
if (lastDeadZone != g_eeGeneral.stickDeadZone) {
|
||||
P_OFFSET =
|
||||
(g_eeGeneral.stickDeadZone ? 2 << (g_eeGeneral.stickDeadZone - 1) : 0);
|
||||
N_OFFSET = (-1) * P_OFFSET;
|
||||
aParam = 1024.0 / (1024.0 - (float)P_OFFSET);
|
||||
bParam = 1024.0 * (aParam - 1.0f);
|
||||
lastDeadZone = g_eeGeneral.stickDeadZone;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) {
|
||||
// normalization [0..2048] -> [-1024..1024]
|
||||
uint8_t ch = (i < NUM_STICKS ? CONVERT_MODE(i) : i);
|
||||
@@ -461,6 +478,22 @@ void evalInputs(uint8_t mode)
|
||||
if (v < -RESX) v = -RESX;
|
||||
if (v > RESX) v = RESX;
|
||||
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
// dead zone invented by FlySky in my opinion it should goes into ADC
|
||||
// float calculations are not efficient
|
||||
if (g_eeGeneral.stickDeadZone && ch != THR_STICK) {
|
||||
if (v > P_OFFSET) {
|
||||
// y=ax+b
|
||||
v = (int)((aParam * (float)v) - bParam);
|
||||
} else if ((v <= P_OFFSET) && (v >= N_OFFSET)) {
|
||||
v = 0;
|
||||
} else if (v < N_OFFSET) {
|
||||
// y=ax+b
|
||||
v = (int)((aParam * (float)v) + bParam);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_model.throttleReversed && ch==THR_STICK) {
|
||||
v = -v;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,12 @@ void generalDefault()
|
||||
g_eeGeneral.slidersConfig = DEFAULT_SLIDERS_CONFIG;
|
||||
#endif
|
||||
|
||||
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset, vBatMax has a -12V offset
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
||||
#endif
|
||||
|
||||
// vBatWarn is voltage in 100mV, vBatMin is in 100mV but with -9V offset,
|
||||
// vBatMax has a -12V offset
|
||||
g_eeGeneral.vBatWarn = BATTERY_WARN;
|
||||
if (BATTERY_MIN != 90)
|
||||
g_eeGeneral.vBatMin = BATTERY_MIN - 90;
|
||||
|
||||
@@ -98,6 +98,11 @@ void postRadioSettingsLoad()
|
||||
g_eeGeneral.internalModule = DEFAULT_INTERNAL_MODULE;
|
||||
}
|
||||
#endif
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
if (!g_eeGeneral.stickDeadZone) {
|
||||
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(EXTERNAL_ANTENNA) && defined(INTERNAL_MODULE_PXX1)
|
||||
|
||||
@@ -438,6 +438,8 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_UNSIGNED( "stickDeadZone", 3 ),
|
||||
YAML_PADDING( 2 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -413,6 +413,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_PADDING( 144 ),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -459,6 +459,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -457,6 +457,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRUCT("themeData", 480, struct_OpenTxTheme__PersistentData, NULL),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -414,6 +414,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -453,6 +453,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -392,6 +392,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_PADDING( 120 ),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -402,6 +402,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -399,6 +399,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -403,6 +403,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_SIGNED( "gyroMax", 8 ),
|
||||
YAML_SIGNED( "gyroOffset", 8 ),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -407,6 +407,7 @@ static const struct YamlNode struct_RadioData[] = {
|
||||
YAML_STRING("bluetoothName", 10),
|
||||
YAML_STRING("ownerRegistrationID", 8),
|
||||
YAML_SIGNED( "uartSampleMode", 2 ),
|
||||
YAML_PADDING( 5 ),
|
||||
YAML_END
|
||||
};
|
||||
static const struct YamlNode struct_unsigned_8[] = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
option(DISK_CACHE "Enable SD card disk cache" ON)
|
||||
option(UNEXPECTED_SHUTDOWN "Enable the Unexpected Shutdown screen" ON)
|
||||
option(STICKS_DEAD_ZONE "Enable sticks dead zone" YES)
|
||||
option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" ON)
|
||||
option(AFHDS2 "Support for AFHDS2" ON)
|
||||
option(GHOST "Ghost TX Module" ON)
|
||||
@@ -90,6 +91,10 @@ if(NOT UNEXPECTED_SHUTDOWN)
|
||||
add_definitions(-DNO_UNEXPECTED_SHUTDOWN)
|
||||
endif()
|
||||
|
||||
if(STICKS_DEAD_ZONE)
|
||||
add_definitions(-DSTICK_DEAD_ZONE)
|
||||
endif()
|
||||
|
||||
set(AFHDS2 ON)
|
||||
|
||||
# disable for now as it crashes on radio
|
||||
|
||||
@@ -299,6 +299,8 @@ enum Analogs {
|
||||
#define SLIDER_FIRST 0
|
||||
#define SLIDER_LAST -1
|
||||
|
||||
#define DEFAULT_STICK_DEADZONE 2
|
||||
|
||||
#define DEFAULT_POTS_CONFIG (POT_WITHOUT_DETENT << 0) + (POT_WITHOUT_DETENT << 2) // 2 pots without detent
|
||||
|
||||
enum CalibratedAnalogs {
|
||||
|
||||
@@ -337,7 +337,11 @@ TEST_F(TrimsTest, CopySticksToOffset)
|
||||
anaInValues[ELE_STICK] = -100;
|
||||
evalMixes(1);
|
||||
copySticksToOffset(1);
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -93);
|
||||
#else
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -97);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(TrimsTest, MoveTrimsToOffsets)
|
||||
@@ -444,7 +448,11 @@ TEST_F(TrimsTest, InstantTrim)
|
||||
{
|
||||
anaInValues[AIL_STICK] = 50;
|
||||
instantTrim();
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
EXPECT_EQ(23, getTrimValue(0, AIL_STICK));
|
||||
#else
|
||||
EXPECT_EQ(25, getTrimValue(0, AIL_STICK));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(TrimsTest, InstantTrimNegativeCurve)
|
||||
@@ -459,7 +467,11 @@ TEST_F(TrimsTest, InstantTrimNegativeCurve)
|
||||
g_model.points[4] = 0;
|
||||
anaInValues[AIL_STICK] = 512;
|
||||
instantTrim();
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
EXPECT_EQ(127, getTrimValue(0, AIL_STICK));
|
||||
#else
|
||||
EXPECT_EQ(128, getTrimValue(0, AIL_STICK));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(Curves, LinearIntpol)
|
||||
|
||||
@@ -765,6 +765,7 @@ const char STR_MENU_DISPLAY[] = TR_MENU_DISPLAY;
|
||||
const char STR_MENU_OTHER[] = TR_MENU_OTHER;
|
||||
const char STR_MENU_INVERT[] = TR_MENU_INVERT;
|
||||
const char STR_JITTER_FILTER[] = TR_JITTER_FILTER;
|
||||
const char STR_DEAD_ZONE[] = TR_DEAD_ZONE;
|
||||
const char STR_RTC_CHECK[] = TR_RTC_CHECK;
|
||||
const char STR_EXIT[] = TR_EXIT;
|
||||
const char STR_MODULE_RANGE[] = TR_MODULE_RANGE;
|
||||
|
||||
@@ -1110,6 +1110,7 @@ extern const char STR_MENU_DISPLAY[];
|
||||
extern const char STR_MENU_OTHER[];
|
||||
extern const char STR_MENU_INVERT[];
|
||||
extern const char STR_JITTER_FILTER[];
|
||||
extern const char STR_DEAD_ZONE[];
|
||||
extern const char STR_RTC_CHECK[];
|
||||
extern const char STR_SPORT_UPDATE_POWER_MODE[];
|
||||
extern const char STR_SPORT_UPDATE_POWER_MODES[];
|
||||
|
||||
@@ -1154,6 +1154,7 @@
|
||||
#define TR_MENU_OTHER "其它"
|
||||
#define TR_MENU_INVERT "反向"
|
||||
#define TR_JITTER_FILTER "类比输入滤波"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "检查时间驱动电池电压")
|
||||
#define TR_AUTH_FAILURE "验证失败"
|
||||
#define TR_RACING_MODE "竞速模式"
|
||||
|
||||
@@ -1201,6 +1201,7 @@
|
||||
#define TR_MENU_OTHER "Ostatní"
|
||||
#define TR_MENU_INVERT "Invertovat"
|
||||
#define TR_JITTER_FILTER "ADC Filtr"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1207,6 +1207,7 @@
|
||||
#define TR_MENU_OTHER "Weitere"
|
||||
#define TR_MENU_INVERT "Invertieren<!>"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1205,6 +1205,7 @@
|
||||
#define TR_MENU_OTHER "Other"
|
||||
#define TR_MENU_INVERT "Invert"
|
||||
#define TR_JITTER_FILTER "ADC filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1207,6 +1207,7 @@
|
||||
#define TR_MENU_OTHER "Otros"
|
||||
#define TR_MENU_INVERT "Invertir"
|
||||
#define TR_JITTER_FILTER "Filtro ADC"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltaje")
|
||||
#define TR_AUTH_FAILURE "Fallo " LCDW_128_480_LINEBREAK "autentificación"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1213,6 +1213,7 @@
|
||||
#define TR_MENU_OTHER "Other"
|
||||
#define TR_MENU_INVERT "Invert"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1230,6 +1230,7 @@
|
||||
#define TR_MENU_OTHER "Autres"
|
||||
#define TR_MENU_INVERT "Inverser"
|
||||
#define TR_JITTER_FILTER "Filtre ADC"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Vérif. RTC", "Vérif. pile RTC")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1226,6 +1226,7 @@
|
||||
#define TR_MENU_OTHER "Altro"
|
||||
#define TR_MENU_INVERT "Inverti"
|
||||
#define TR_JITTER_FILTER "Filtro ADC"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Controllo RTC", "Controllo volt. RTC")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1217,6 +1217,7 @@
|
||||
#define TR_MENU_OTHER "Verdere"
|
||||
#define TR_MENU_INVERT "Inverteer"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1222,6 +1222,7 @@
|
||||
#define TR_MENU_OTHER "Inny "
|
||||
#define TR_MENU_INVERT "Odwróć"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1229,6 +1229,7 @@
|
||||
#define TR_MENU_OTHER "Other"
|
||||
#define TR_MENU_INVERT "Invert"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1230,6 +1230,7 @@
|
||||
#define TR_MENU_OTHER "Annat"
|
||||
#define TR_MENU_INVERT "Invertera"
|
||||
#define TR_JITTER_FILTER "ADC Filter"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "Check RTC voltage")
|
||||
#define TR_AUTH_FAILURE "Auth-failure"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
@@ -1154,6 +1154,7 @@
|
||||
#define TR_MENU_OTHER "其它"
|
||||
#define TR_MENU_INVERT "反向"
|
||||
#define TR_JITTER_FILTER "類比輸入濾波"
|
||||
#define TR_DEAD_ZONE "Dead zone"
|
||||
#define TR_RTC_CHECK TR("Check RTC", "檢查時間驅動電池電壓")
|
||||
#define TR_AUTH_FAILURE "驗證失敗"
|
||||
#define TR_RACING_MODE "Racing mode"
|
||||
|
||||
Reference in New Issue
Block a user