fix: Throttle invert and gimbal dead zone (#3864)
This commit is contained in:
+2
-2
@@ -526,7 +526,7 @@ void evalInputs(uint8_t mode)
|
||||
#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 != inputMappingConvertMode(inputMappingGetThrottle())) {
|
||||
if (g_eeGeneral.stickDeadZone && ch != inputMappingGetThrottle()) {
|
||||
if (v > P_OFFSET) {
|
||||
// y=ax+b
|
||||
v = (int)((aParam * (float)v) - bParam);
|
||||
@@ -539,7 +539,7 @@ void evalInputs(uint8_t mode)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_model.throttleReversed && ch==inputMappingConvertMode(inputMappingGetThrottle())) {
|
||||
if (g_model.throttleReversed && ch == inputMappingGetThrottle()) {
|
||||
v = -v;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,30 @@ class MixerTest : public OpenTxTest {};
|
||||
#define MIXSRC_CYC2 (MIXSRC_FIRST_HELI + 1)
|
||||
#define MIXSRC_CYC3 (MIXSRC_FIRST_HELI + 2)
|
||||
|
||||
TEST_F(MixerTest, throttleInvert)
|
||||
{
|
||||
// Mode 1 / reversed
|
||||
g_eeGeneral.stickMode = 0;
|
||||
g_model.throttleReversed = 1;
|
||||
anaSetFiltered(inputMappingConvertMode(THR_STICK), -1024);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(channelOutputs[2], +1024);
|
||||
|
||||
// Mode 2 / reversed
|
||||
g_eeGeneral.stickMode = 1;
|
||||
g_model.throttleReversed = 1;
|
||||
anaSetFiltered(inputMappingConvertMode(THR_STICK), -1024);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(channelOutputs[2], +1024);
|
||||
|
||||
// Mode 2 / normal
|
||||
g_eeGeneral.stickMode = 1;
|
||||
g_model.throttleReversed = 0;
|
||||
anaSetFiltered(inputMappingConvertMode(THR_STICK), -1024);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(channelOutputs[2], -1024);
|
||||
}
|
||||
|
||||
TEST_F(TrimsTest, throttleTrim)
|
||||
{
|
||||
g_model.thrTrim = 1;
|
||||
|
||||
Reference in New Issue
Block a user