mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-25 17:25:18 +03:00
Replace profile.activate and rcOptions with
profile.modeActivationCondition and rcModeActivationMask. Implementation of using and setting modeActivationConditions is missing.
This commit is contained in:
parent
6f4ef82f7d
commit
c0fd0c1f33
11 changed files with 119 additions and 108 deletions
|
@ -111,7 +111,7 @@ void updateAutotuneState(void)
|
|||
static bool landedAfterAutoTuning = false;
|
||||
static bool autoTuneWasUsed = false;
|
||||
|
||||
if (rcOptions[BOXAUTOTUNE]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) {
|
||||
if (!FLIGHT_MODE(AUTOTUNE_MODE)) {
|
||||
if (ARMING_FLAG(ARMED)) {
|
||||
if (isAutotuneIdle() || landedAfterAutoTuning) {
|
||||
|
@ -246,7 +246,7 @@ void annexCode(void)
|
|||
if (ARMING_FLAG(ARMED)) {
|
||||
LED0_ON;
|
||||
} else {
|
||||
if (rcOptions[BOXARM] == 0) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXARM) == 0) {
|
||||
ENABLE_ARMING_FLAG(OK_TO_ARM);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ void annexCode(void)
|
|||
DISABLE_ARMING_FLAG(OK_TO_ARM);
|
||||
}
|
||||
|
||||
if (rcOptions[BOXAUTOTUNE]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXAUTOTUNE)) {
|
||||
DISABLE_ARMING_FLAG(OK_TO_ARM);
|
||||
}
|
||||
|
||||
|
@ -342,11 +342,11 @@ void handleInflightCalibrationStickPosition(void)
|
|||
|
||||
void updateInflightCalibrationState(void)
|
||||
{
|
||||
if (AccInflightCalibrationArmed && ARMING_FLAG(ARMED) && rcData[THROTTLE] > masterConfig.rxConfig.mincheck && !rcOptions[BOXARM]) { // Copter is airborne and you are turning it off via boxarm : start measurement
|
||||
if (AccInflightCalibrationArmed && ARMING_FLAG(ARMED) && rcData[THROTTLE] > masterConfig.rxConfig.mincheck && !IS_RC_MODE_ACTIVE(BOXARM)) { // Copter is airborne and you are turning it off via boxarm : start measurement
|
||||
InflightcalibratingA = 50;
|
||||
AccInflightCalibrationArmed = false;
|
||||
}
|
||||
if (rcOptions[BOXCALIB]) { // Use the Calib Option to activate : Calib = TRUE Meausrement started, Land and Calib = 0 measurement stored
|
||||
if (IS_RC_MODE_ACTIVE(BOXCALIB)) { // Use the Calib Option to activate : Calib = TRUE Meausrement started, Land and Calib = 0 measurement stored
|
||||
if (!AccInflightCalibrationActive && !AccInflightCalibrationMeasurementDone)
|
||||
InflightcalibratingA = 50;
|
||||
AccInflightCalibrationActive = true;
|
||||
|
@ -466,7 +466,7 @@ void processRx(void)
|
|||
|
||||
// in 3D mode, we need to be able to disarm by switch at any time
|
||||
if (feature(FEATURE_3D)) {
|
||||
if (!rcOptions[BOXARM])
|
||||
if (!IS_RC_MODE_ACTIVE(BOXARM))
|
||||
mwDisarm();
|
||||
}
|
||||
|
||||
|
@ -488,17 +488,17 @@ void processRx(void)
|
|||
resetErrorGyro();
|
||||
}
|
||||
|
||||
processRcStickPositions(&masterConfig.rxConfig, throttleStatus, currentProfile->activate, masterConfig.retarded_arm, masterConfig.disarm_kill_switch);
|
||||
processRcStickPositions(&masterConfig.rxConfig, throttleStatus, currentProfile->modeActivationConditions, masterConfig.retarded_arm, masterConfig.disarm_kill_switch);
|
||||
|
||||
if (feature(FEATURE_INFLIGHT_ACC_CAL)) {
|
||||
updateInflightCalibrationState();
|
||||
}
|
||||
|
||||
updateRcOptions(currentProfile->activate);
|
||||
updateRcOptions(currentProfile->modeActivationConditions);
|
||||
|
||||
bool canUseHorizonMode = true;
|
||||
|
||||
if ((rcOptions[BOXANGLE] || (feature(FEATURE_FAILSAFE) && failsafe->vTable->hasTimerElapsed())) && (sensors(SENSOR_ACC))) {
|
||||
if ((IS_RC_MODE_ACTIVE(BOXANGLE) || (feature(FEATURE_FAILSAFE) && failsafe->vTable->hasTimerElapsed())) && (sensors(SENSOR_ACC))) {
|
||||
// bumpless transfer to Level mode
|
||||
canUseHorizonMode = false;
|
||||
|
||||
|
@ -510,7 +510,7 @@ void processRx(void)
|
|||
DISABLE_FLIGHT_MODE(ANGLE_MODE); // failsafe support
|
||||
}
|
||||
|
||||
if (rcOptions[BOXHORIZON] && canUseHorizonMode) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXHORIZON) && canUseHorizonMode) {
|
||||
|
||||
DISABLE_FLIGHT_MODE(ANGLE_MODE);
|
||||
|
||||
|
@ -530,7 +530,7 @@ void processRx(void)
|
|||
|
||||
#ifdef MAG
|
||||
if (sensors(SENSOR_ACC) || sensors(SENSOR_MAG)) {
|
||||
if (rcOptions[BOXMAG]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXMAG)) {
|
||||
if (!FLIGHT_MODE(MAG_MODE)) {
|
||||
ENABLE_FLIGHT_MODE(MAG_MODE);
|
||||
magHold = heading;
|
||||
|
@ -538,14 +538,14 @@ void processRx(void)
|
|||
} else {
|
||||
DISABLE_FLIGHT_MODE(MAG_MODE);
|
||||
}
|
||||
if (rcOptions[BOXHEADFREE]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXHEADFREE)) {
|
||||
if (!FLIGHT_MODE(HEADFREE_MODE)) {
|
||||
ENABLE_FLIGHT_MODE(HEADFREE_MODE);
|
||||
}
|
||||
} else {
|
||||
DISABLE_FLIGHT_MODE(HEADFREE_MODE);
|
||||
}
|
||||
if (rcOptions[BOXHEADADJ]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXHEADADJ)) {
|
||||
headFreeModeHold = heading; // acquire new heading
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ void processRx(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (rcOptions[BOXPASSTHRU]) {
|
||||
if (IS_RC_MODE_ACTIVE(BOXPASSTHRU)) {
|
||||
ENABLE_FLIGHT_MODE(PASSTHRU_MODE);
|
||||
} else {
|
||||
DISABLE_FLIGHT_MODE(PASSTHRU_MODE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue