Delay allowing sticky modes
On bootup aux channels start out at default and allow sticky modes right away, although they should only be allowed once they are actually not active. _Legal disclaimer: I am making my contributions/submissions to this project solely in my personal capacity and am not conveying any rights to any intellectual property of any third parties._
This commit is contained in:
parent
37d66a6005
commit
cb792f30d2
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "common/bitarray.h"
|
||||
#include "common/maths.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "config/feature.h"
|
||||
#include "pg/pg.h"
|
||||
|
@ -112,7 +113,7 @@ void updateActivatedModes(void)
|
|||
if (paralyzeModeEverDisabled) {
|
||||
updateMasksForMac(mac, &andMask, &newMask);
|
||||
} else {
|
||||
paralyzeModeEverDisabled = !isRangeActive(mac->auxChannelIndex, &mac->range);
|
||||
paralyzeModeEverDisabled = micros() >= 5e6 && !isRangeActive(mac->auxChannelIndex, &mac->range);
|
||||
}
|
||||
}
|
||||
} else if (mode < CHECKBOX_ITEM_COUNT) {
|
||||
|
|
|
@ -616,7 +616,7 @@ TEST(ArmingPreventionTest, ParalyzeOnAtBoot)
|
|||
{
|
||||
// given
|
||||
simulationFeatureFlags = 0;
|
||||
simulationTime = 30e6; // 30 seconds after boot
|
||||
simulationTime = 0;
|
||||
gyroCalibDone = true;
|
||||
|
||||
// and
|
||||
|
@ -660,7 +660,7 @@ TEST(ArmingPreventionTest, Paralyze)
|
|||
{
|
||||
// given
|
||||
simulationFeatureFlags = 0;
|
||||
simulationTime = 30e6; // 30 seconds after boot
|
||||
simulationTime = 0;
|
||||
gyroCalibDone = true;
|
||||
|
||||
// and
|
||||
|
@ -686,7 +686,7 @@ TEST(ArmingPreventionTest, Paralyze)
|
|||
// given
|
||||
rcData[THROTTLE] = 1000;
|
||||
rcData[AUX1] = 1000;
|
||||
rcData[AUX2] = 1000;
|
||||
rcData[AUX2] = 1800; // Start out with paralyze enabled
|
||||
rcData[AUX3] = 1000;
|
||||
ENABLE_STATE(SMALL_ANGLE);
|
||||
|
||||
|
@ -726,9 +726,28 @@ TEST(ArmingPreventionTest, Paralyze)
|
|||
EXPECT_FALSE(ARMING_FLAG(ARMED));
|
||||
EXPECT_FALSE(isArmingDisabled());
|
||||
EXPECT_EQ(0, getArmingDisableFlags());
|
||||
EXPECT_FALSE(IS_RC_MODE_ACTIVE(BOXPARALYZE));
|
||||
|
||||
// given
|
||||
// paralyze (and activate linked vtx pit mode)
|
||||
simulationTime = 10e6; // 10 seconds after boot
|
||||
|
||||
// when
|
||||
updateActivatedModes();
|
||||
|
||||
// expect
|
||||
EXPECT_FALSE(ARMING_FLAG(ARMED));
|
||||
EXPECT_FALSE(isArmingDisabled());
|
||||
EXPECT_EQ(0, getArmingDisableFlags());
|
||||
EXPECT_FALSE(IS_RC_MODE_ACTIVE(BOXPARALYZE));
|
||||
|
||||
// given
|
||||
// disable paralyze once after the startup timer
|
||||
rcData[AUX2] = 1000;
|
||||
|
||||
// when
|
||||
updateActivatedModes();
|
||||
|
||||
// enable paralyze again
|
||||
rcData[AUX2] = 1800;
|
||||
|
||||
// when
|
||||
|
@ -738,6 +757,7 @@ TEST(ArmingPreventionTest, Paralyze)
|
|||
// expect
|
||||
EXPECT_TRUE(isArmingDisabled());
|
||||
EXPECT_EQ(ARMING_DISABLED_PARALYZE, getArmingDisableFlags());
|
||||
EXPECT_TRUE(IS_RC_MODE_ACTIVE(BOXPARALYZE));
|
||||
EXPECT_TRUE(IS_RC_MODE_ACTIVE(BOXVTXPITMODE));
|
||||
EXPECT_FALSE(IS_RC_MODE_ACTIVE(BOXBEEPERON));
|
||||
|
||||
|
|
|
@ -555,6 +555,11 @@ uint32_t millis(void)
|
|||
return sysTickUptime;
|
||||
}
|
||||
|
||||
uint32_t micros(void)
|
||||
{
|
||||
return millis() * 1000;
|
||||
}
|
||||
|
||||
throttleStatus_e calculateThrottleStatus()
|
||||
{
|
||||
return throttleStatus;
|
||||
|
|
|
@ -224,6 +224,10 @@ extern "C" {
|
|||
uint32_t millis(void) {
|
||||
return fixedMillis;
|
||||
}
|
||||
|
||||
uint32_t micros(void) {
|
||||
return fixedMillis * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
void resetMillis(void) {
|
||||
|
|
|
@ -888,6 +888,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
uint32_t millis(void) { return testData.millis++; }
|
||||
uint32_t micros(void) { return millis() * 1000; }
|
||||
void beeper(beeperMode_e mode) { UNUSED(mode); }
|
||||
uint8_t armingFlags = 0;
|
||||
bool cmsInMenu;
|
||||
|
|
Loading…
Reference in New Issue