mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-16 12:55:16 +03:00
Added modeActivationConditions parameter group
This commit is contained in:
parent
7aaa5643c0
commit
b7cdd63db1
16 changed files with 89 additions and 86 deletions
|
@ -1025,7 +1025,7 @@ void startBlackbox(void)
|
|||
*/
|
||||
blackboxBuildConditionCache();
|
||||
|
||||
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(masterConfig.modeActivationConditions, BOXBLACKBOX);
|
||||
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(BOXBLACKBOX);
|
||||
|
||||
blackboxIteration = 0;
|
||||
blackboxPFrameIndex = 0;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "fc/runtime_config.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/config_master.h"
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "io/flashfs.h"
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "fc/runtime_config.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/config_master.h"
|
||||
#include "config/feature.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "cms/cms_menu_vtx.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/config_master.h"
|
||||
#include "config/feature.h"
|
||||
|
||||
#ifdef CMS
|
||||
|
|
|
@ -70,9 +70,6 @@ typedef struct master_s {
|
|||
servoMixer_t customServoMixer[MAX_SERVO_RULES];
|
||||
#endif
|
||||
|
||||
modeActivationCondition_t modeActivationConditions[MAX_MODE_ACTIVATION_CONDITION_COUNT];
|
||||
modeActivationOperator_e modeActivationOperator;
|
||||
|
||||
adjustmentRange_t adjustmentRanges[MAX_ADJUSTMENT_RANGE_COUNT];
|
||||
|
||||
// Radio/ESC-related configuration
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#define PG_BAROMETER_CONFIG 38
|
||||
//#define PG_THROTTLE_CORRECTION_CONFIG 39
|
||||
#define PG_COMPASS_CONFIG 40
|
||||
//#define PG_MODE_ACTIVATION_PROFILE 41
|
||||
#define PG_MODE_ACTIVATION_PROFILE 41
|
||||
//#define PG_SERVO_PROFILE 42
|
||||
#define PG_RX_FAILSAFE_CHANNEL_CONFIG 43
|
||||
#define PG_RX_CHANNEL_RANGE_CONFIG 44
|
||||
|
@ -80,7 +80,7 @@
|
|||
#define PG_PITOTMETER_CONFIG 1000
|
||||
#define PG_POSITION_ESTIMATION_CONFIG 1001
|
||||
#define PG_NAV_CONFIG 1002
|
||||
|
||||
#define PG_MODE_ACTIVATION_OPERATOR_CONFIG 1003
|
||||
// OSD configuration (subject to change)
|
||||
//#define PG_OSD_FONT_CONFIG 2047
|
||||
//#define PG_OSD_VIDEO_CONFIG 2046
|
||||
|
|
|
@ -185,8 +185,6 @@ void createDefaultConfig(master_t *config)
|
|||
// for (int i = 0; i < CHECKBOXITEMS; i++)
|
||||
// cfg.activate[i] = 0;
|
||||
|
||||
config->modeActivationOperator = MODE_OPERATOR_OR; // default is to OR multiple-channel mode activation conditions
|
||||
|
||||
// Radio
|
||||
#ifdef RX_CHANNELS_TAER
|
||||
parseRcChannels("TAER1234");
|
||||
|
@ -332,8 +330,6 @@ static void activateConfig(void)
|
|||
|
||||
resetAdjustmentStates();
|
||||
|
||||
useRcControlsConfig(masterConfig.modeActivationConditions);
|
||||
|
||||
failsafeReset();
|
||||
|
||||
setAccelerationCalibrationValues();
|
||||
|
|
|
@ -517,7 +517,7 @@ void init(void)
|
|||
|
||||
failsafeInit(flight3DConfig()->deadband3d_throttle);
|
||||
|
||||
rxInit(masterConfig.modeActivationConditions);
|
||||
rxInit();
|
||||
|
||||
#ifdef GPS
|
||||
if (feature(FEATURE_GPS)) {
|
||||
|
|
|
@ -714,7 +714,7 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn
|
|||
|
||||
case MSP_MODE_RANGES:
|
||||
for (int i = 0; i < MAX_MODE_ACTIVATION_CONDITION_COUNT; i++) {
|
||||
modeActivationCondition_t *mac = &masterConfig.modeActivationConditions[i];
|
||||
const modeActivationCondition_t *mac = modeActivationConditions(i);
|
||||
const box_t *box = findBoxByActiveBoxId(mac->modeId);
|
||||
sbufWriteU8(dst, box ? box->permanentId : 0);
|
||||
sbufWriteU8(dst, mac->auxChannelIndex);
|
||||
|
@ -1337,7 +1337,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
case MSP_SET_MODE_RANGE:
|
||||
i = sbufReadU8(src);
|
||||
if (i < MAX_MODE_ACTIVATION_CONDITION_COUNT) {
|
||||
modeActivationCondition_t *mac = &masterConfig.modeActivationConditions[i];
|
||||
modeActivationCondition_t *mac = modeActivationConditionsMutable(i);
|
||||
i = sbufReadU8(src);
|
||||
const box_t *box = findBoxByPermenantId(i);
|
||||
if (box) {
|
||||
|
@ -1346,7 +1346,7 @@ static mspResult_e mspFcProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
mac->range.startStep = sbufReadU8(src);
|
||||
mac->range.endStep = sbufReadU8(src);
|
||||
|
||||
useRcControlsConfig(masterConfig.modeActivationConditions);
|
||||
useRcControlsConfig();
|
||||
} else {
|
||||
return MSP_RESULT_ERROR;
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ void processRx(timeUs_t currentTimeUs)
|
|||
|
||||
processRcStickPositions(throttleStatus, armingConfig()->disarm_kill_switch, armingConfig()->fixed_wing_auto_arm);
|
||||
|
||||
updateActivatedModes(masterConfig.modeActivationConditions, masterConfig.modeActivationOperator);
|
||||
updateActivatedModes();
|
||||
|
||||
if (!cliMode) {
|
||||
updateAdjustmentStates(masterConfig.adjustmentRanges);
|
||||
|
|
|
@ -87,35 +87,8 @@ PG_RESET_TEMPLATE(armingConfig_t, armingConfig,
|
|||
.auto_disarm_delay = 5
|
||||
);
|
||||
|
||||
void blackboxLogInflightAdjustmentEvent(adjustmentFunction_e adjustmentFunction, int32_t newValue) {
|
||||
#ifndef BLACKBOX
|
||||
UNUSED(adjustmentFunction);
|
||||
UNUSED(newValue);
|
||||
#else
|
||||
if (feature(FEATURE_BLACKBOX)) {
|
||||
flightLogEvent_inflightAdjustment_t eventData;
|
||||
eventData.adjustmentFunction = adjustmentFunction;
|
||||
eventData.newValue = newValue;
|
||||
eventData.floatFlag = false;
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void blackboxLogInflightAdjustmentEventFloat(adjustmentFunction_e adjustmentFunction, float newFloatValue) {
|
||||
#ifndef BLACKBOX
|
||||
UNUSED(adjustmentFunction);
|
||||
UNUSED(newFloatValue);
|
||||
#else
|
||||
if (feature(FEATURE_BLACKBOX)) {
|
||||
flightLogEvent_inflightAdjustment_t eventData;
|
||||
eventData.adjustmentFunction = adjustmentFunction;
|
||||
eventData.newFloatValue = newFloatValue;
|
||||
eventData.floatFlag = true;
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
PG_REGISTER_ARR(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions, PG_MODE_ACTIVATION_PROFILE, 0);
|
||||
PG_REGISTER(modeActivationOperatorConfig_t, modeActivationOperatorConfig, PG_MODE_ACTIVATION_OPERATOR_CONFIG, 0);
|
||||
|
||||
bool isUsingSticksForArming(void)
|
||||
{
|
||||
|
@ -313,14 +286,10 @@ void processRcStickPositions(throttleStatus_e throttleStatus, bool disarm_kill_s
|
|||
}
|
||||
}
|
||||
|
||||
bool isModeActivationConditionPresent(modeActivationCondition_t *modeActivationConditions, boxId_e modeId)
|
||||
bool isModeActivationConditionPresent(boxId_e modeId)
|
||||
{
|
||||
uint8_t index;
|
||||
|
||||
for (index = 0; index < MAX_MODE_ACTIVATION_CONDITION_COUNT; index++) {
|
||||
modeActivationCondition_t *modeActivationCondition = &modeActivationConditions[index];
|
||||
|
||||
if (modeActivationCondition->modeId == modeId && IS_RANGE_USABLE(&modeActivationCondition->range)) {
|
||||
for (int index = 0; index < MAX_MODE_ACTIVATION_CONDITION_COUNT; index++) {
|
||||
if (modeActivationConditions(index)->modeId == modeId && IS_RANGE_USABLE(&modeActivationConditions(index)->range)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +297,7 @@ bool isModeActivationConditionPresent(modeActivationCondition_t *modeActivationC
|
|||
return false;
|
||||
}
|
||||
|
||||
bool isRangeActive(uint8_t auxChannelIndex, channelRange_t *range) {
|
||||
static bool isRangeActive(uint8_t auxChannelIndex, const channelRange_t *range) {
|
||||
if (!IS_RANGE_USABLE(range)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -338,10 +307,8 @@ bool isRangeActive(uint8_t auxChannelIndex, channelRange_t *range) {
|
|||
channelValue < 900 + (range->endStep * 25));
|
||||
}
|
||||
|
||||
void updateActivatedModes(modeActivationCondition_t *modeActivationConditions, modeActivationOperator_e modeActivationOperator)
|
||||
void updateActivatedModes(void)
|
||||
{
|
||||
uint8_t modeIndex;
|
||||
|
||||
// Unfortunately for AND logic it's not enough to simply check if any of the specified channel range conditions are valid for a mode.
|
||||
// We need to count the total number of conditions specified for each mode, and check that all those conditions are currently valid.
|
||||
|
||||
|
@ -351,15 +318,14 @@ void updateActivatedModes(modeActivationCondition_t *modeActivationConditions, m
|
|||
memset(specifiedConditionCountPerMode, 0, CHECKBOX_ITEM_COUNT);
|
||||
memset(validConditionCountPerMode, 0, CHECKBOX_ITEM_COUNT);
|
||||
|
||||
for (modeIndex = 0; modeIndex < MAX_MODE_ACTIVATION_CONDITION_COUNT; modeIndex++) {
|
||||
modeActivationCondition_t *modeActivationCondition = &modeActivationConditions[modeIndex];
|
||||
for (int modeIndex = 0; modeIndex < MAX_MODE_ACTIVATION_CONDITION_COUNT; modeIndex++) {
|
||||
|
||||
// Increment the number of specified conditions for this mode
|
||||
specifiedConditionCountPerMode[modeActivationCondition->modeId]++;
|
||||
specifiedConditionCountPerMode[modeActivationConditions(modeIndex)->modeId]++;
|
||||
|
||||
if (isRangeActive(modeActivationCondition->auxChannelIndex, &modeActivationCondition->range)) {
|
||||
if (isRangeActive(modeActivationConditions(modeIndex)->auxChannelIndex, &modeActivationConditions(modeIndex)->range)) {
|
||||
// Increment the number of valid conditions for this mode
|
||||
validConditionCountPerMode[modeActivationCondition->modeId]++;
|
||||
validConditionCountPerMode[modeActivationConditions(modeIndex)->modeId]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,13 +333,13 @@ void updateActivatedModes(modeActivationCondition_t *modeActivationConditions, m
|
|||
rcModeActivationMask = 0;
|
||||
|
||||
// Now see which modes should be enabled
|
||||
for (modeIndex = 0; modeIndex < CHECKBOX_ITEM_COUNT; modeIndex++) {
|
||||
for (int modeIndex = 0; modeIndex < CHECKBOX_ITEM_COUNT; modeIndex++) {
|
||||
// only modes with conditions specified are considered
|
||||
if (specifiedConditionCountPerMode[modeIndex] > 0) {
|
||||
// For AND logic, the specified condition count and valid condition count must be the same.
|
||||
// For OR logic, the valid condition count must be greater than zero.
|
||||
|
||||
if (modeActivationOperator == MODE_OPERATOR_AND) {
|
||||
if (modeActivationOperatorConfig()->modeActivationOperator == MODE_OPERATOR_AND) {
|
||||
// AND the conditions
|
||||
if (validConditionCountPerMode[modeIndex] == specifiedConditionCountPerMode[modeIndex]) {
|
||||
ACTIVATE_RC_MODE(modeIndex);
|
||||
|
@ -518,6 +484,38 @@ void configureAdjustment(uint8_t index, uint8_t auxSwitchChannelIndex, const adj
|
|||
MARK_ADJUSTMENT_FUNCTION_AS_READY(index);
|
||||
}
|
||||
|
||||
static void blackboxLogInflightAdjustmentEvent(adjustmentFunction_e adjustmentFunction, int32_t newValue) {
|
||||
#ifndef BLACKBOX
|
||||
UNUSED(adjustmentFunction);
|
||||
UNUSED(newValue);
|
||||
#else
|
||||
if (feature(FEATURE_BLACKBOX)) {
|
||||
flightLogEvent_inflightAdjustment_t eventData;
|
||||
eventData.adjustmentFunction = adjustmentFunction;
|
||||
eventData.newValue = newValue;
|
||||
eventData.floatFlag = false;
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void blackboxLogInflightAdjustmentEventFloat(adjustmentFunction_e adjustmentFunction, float newFloatValue) {
|
||||
#ifndef BLACKBOX
|
||||
UNUSED(adjustmentFunction);
|
||||
UNUSED(newFloatValue);
|
||||
#else
|
||||
if (feature(FEATURE_BLACKBOX)) {
|
||||
flightLogEvent_inflightAdjustment_t eventData;
|
||||
eventData.adjustmentFunction = adjustmentFunction;
|
||||
eventData.newFloatValue = newFloatValue;
|
||||
eventData.floatFlag = true;
|
||||
blackboxLogEvent(FLIGHT_LOG_EVENT_INFLIGHT_ADJUSTMENT, (flightLogEventData_t*)&eventData);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static void applyStepAdjustment(controlRateConfig_t *controlRateConfig, uint8_t adjustmentFunction, int delta) {
|
||||
int newValue;
|
||||
|
||||
|
@ -735,14 +733,14 @@ int32_t getRcStickDeflection(int32_t axis, uint16_t midrc) {
|
|||
return MIN(ABS(rcData[axis] - midrc), 500);
|
||||
}
|
||||
|
||||
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions)
|
||||
void useRcControlsConfig(void)
|
||||
{
|
||||
isUsingSticksToArm = !isModeActivationConditionPresent(modeActivationConditions, BOXARM);
|
||||
isUsingSticksToArm = !isModeActivationConditionPresent(BOXARM);
|
||||
|
||||
#ifdef NAV
|
||||
isUsingNAVModes = isModeActivationConditionPresent(modeActivationConditions, BOXNAVPOSHOLD) ||
|
||||
isModeActivationConditionPresent(modeActivationConditions, BOXNAVRTH) ||
|
||||
isModeActivationConditionPresent(modeActivationConditions, BOXNAVWP);
|
||||
isUsingNAVModes = isModeActivationConditionPresent(BOXNAVPOSHOLD) ||
|
||||
isModeActivationConditionPresent(BOXNAVRTH) ||
|
||||
isModeActivationConditionPresent(BOXNAVWP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -123,11 +123,19 @@ typedef struct modeActivationCondition_s {
|
|||
|
||||
#define IS_RANGE_USABLE(range) ((range)->startStep < (range)->endStep)
|
||||
|
||||
PG_DECLARE_ARR(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions);
|
||||
|
||||
typedef enum {
|
||||
MODE_OPERATOR_OR,
|
||||
MODE_OPERATOR_OR, // default
|
||||
MODE_OPERATOR_AND
|
||||
} modeActivationOperator_e;
|
||||
|
||||
typedef struct modeActivationOperatorConfig_s {
|
||||
modeActivationOperator_e modeActivationOperator;
|
||||
} modeActivationOperatorConfig_t;
|
||||
|
||||
PG_DECLARE(modeActivationOperatorConfig_t, modeActivationOperatorConfig);
|
||||
|
||||
extern int16_t rcCommand[4];
|
||||
|
||||
typedef struct rcControlsConfig_s {
|
||||
|
@ -154,7 +162,7 @@ throttleStatus_e calculateThrottleStatus(uint16_t deadband3d_throttle);
|
|||
rollPitchStatus_e calculateRollPitchCenterStatus(void);
|
||||
void processRcStickPositions(throttleStatus_e throttleStatus, bool disarm_kill_switch, bool fixed_wing_auto_arm);
|
||||
|
||||
void updateActivatedModes(modeActivationCondition_t *modeActivationConditions, modeActivationOperator_e modeActivationOperator);
|
||||
void updateActivatedModes(void);
|
||||
|
||||
|
||||
typedef enum {
|
||||
|
@ -246,5 +254,5 @@ bool isUsingSticksForArming(void);
|
|||
bool isUsingNavigationModes(void);
|
||||
|
||||
int32_t getRcStickDeflection(int32_t axis, uint16_t midrc);
|
||||
bool isModeActivationConditionPresent(modeActivationCondition_t *modeActivationConditions, boxId_e modeId);
|
||||
void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions);
|
||||
bool isModeActivationConditionPresent(boxId_e modeId);
|
||||
void useRcControlsConfig(void);
|
||||
|
|
|
@ -1147,6 +1147,7 @@ static navConfig_t navConfigCopy;
|
|||
#ifdef TELEMETRY
|
||||
static telemetryConfig_t telemetryConfigCopy;
|
||||
#endif
|
||||
static modeActivationCondition_t modeActivationConditionsCopy[MAX_MODE_ACTIVATION_CONDITION_COUNT];
|
||||
|
||||
static void backupConfigs(void)
|
||||
{
|
||||
|
@ -1200,6 +1201,9 @@ static void backupConfigs(void)
|
|||
#ifdef TELEMETRY
|
||||
telemetryConfigCopy = *telemetryConfig();
|
||||
#endif
|
||||
for (int ii = 0; ii < MAX_MODE_ACTIVATION_CONDITION_COUNT; ++ii) {
|
||||
modeActivationConditionsCopy[ii] = *modeActivationConditions(ii);
|
||||
}
|
||||
}
|
||||
|
||||
static void restoreConfigs(void)
|
||||
|
@ -1253,6 +1257,9 @@ static void restoreConfigs(void)
|
|||
#ifdef TELEMETRY
|
||||
*telemetryConfigMutable() = telemetryConfigCopy;
|
||||
#endif
|
||||
for (int ii = 0; ii < MAX_MODE_ACTIVATION_CONDITION_COUNT; ++ii) {
|
||||
*modeActivationConditionsMutable(ii) = modeActivationConditionsCopy[ii];
|
||||
}
|
||||
}
|
||||
|
||||
static void *getDefaultPointer(const void *valuePointer, const master_t *defaultConfig)
|
||||
|
@ -1669,12 +1676,12 @@ static void cliAux(char *cmdline)
|
|||
char *ptr;
|
||||
|
||||
if (isEmpty(cmdline)) {
|
||||
printAux(DUMP_MASTER, masterConfig.modeActivationConditions, NULL);
|
||||
printAux(DUMP_MASTER, modeActivationConditions(0), NULL);
|
||||
} else {
|
||||
ptr = cmdline;
|
||||
i = atoi(ptr++);
|
||||
if (i < MAX_MODE_ACTIVATION_CONDITION_COUNT) {
|
||||
modeActivationCondition_t *mac = &masterConfig.modeActivationConditions[i];
|
||||
modeActivationCondition_t *mac = modeActivationConditionsMutable(i);
|
||||
uint8_t validArgumentCount = 0;
|
||||
ptr = nextArg(ptr);
|
||||
if (ptr) {
|
||||
|
@ -3512,7 +3519,7 @@ static void printConfig(char *cmdline, bool doDiff)
|
|||
#endif
|
||||
|
||||
cliPrintHashLine("aux");
|
||||
printAux(dumpMask, masterConfig.modeActivationConditions, defaultConfig.modeActivationConditions);
|
||||
printAux(dumpMask, modeActivationConditionsCopy, modeActivationConditions(0));
|
||||
|
||||
cliPrintHashLine("adjrange");
|
||||
printAdjustmentRange(dumpMask, masterConfig.adjustmentRanges, defaultConfig.adjustmentRanges);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
@ -58,6 +59,7 @@
|
|||
#include "io/displayport_max7456.h"
|
||||
#include "io/flashfs.h"
|
||||
#include "io/gimbal.h"
|
||||
#include "io/gps.h"
|
||||
#include "io/osd.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
|
|
|
@ -251,7 +251,7 @@ bool serialRxInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
|
|||
}
|
||||
#endif
|
||||
|
||||
void rxInit(const modeActivationCondition_t *modeActivationConditions)
|
||||
void rxInit(void)
|
||||
{
|
||||
rxRuntimeConfig.rcReadRawFn = nullReadRawRC;
|
||||
rxRuntimeConfig.rcFrameStatusFn = nullFrameStatus;
|
||||
|
@ -267,17 +267,16 @@ void rxInit(const modeActivationCondition_t *modeActivationConditions)
|
|||
|
||||
// Initialize ARM switch to OFF position when arming via switch is defined
|
||||
for (int i = 0; i < MAX_MODE_ACTIVATION_CONDITION_COUNT; i++) {
|
||||
const modeActivationCondition_t *modeActivationCondition = &modeActivationConditions[i];
|
||||
if (modeActivationCondition->modeId == BOXARM && IS_RANGE_USABLE(&modeActivationCondition->range)) {
|
||||
if (modeActivationConditions(i)->modeId == BOXARM && IS_RANGE_USABLE(&modeActivationConditions(i)->range)) {
|
||||
// ARM switch is defined, determine an OFF value
|
||||
uint16_t value;
|
||||
if (modeActivationCondition->range.startStep > 0) {
|
||||
value = MODE_STEP_TO_CHANNEL_VALUE((modeActivationCondition->range.startStep - 1));
|
||||
if (modeActivationConditions(i)->range.startStep > 0) {
|
||||
value = MODE_STEP_TO_CHANNEL_VALUE((modeActivationConditions(i)->range.startStep - 1));
|
||||
} else {
|
||||
value = MODE_STEP_TO_CHANNEL_VALUE((modeActivationCondition->range.endStep + 1));
|
||||
value = MODE_STEP_TO_CHANNEL_VALUE((modeActivationConditions(i)->range.endStep + 1));
|
||||
}
|
||||
// Initialize ARM AUX channel to OFF value
|
||||
rcData[modeActivationCondition->auxChannelIndex + NON_AUX_CHANNEL_COUNT] = value;
|
||||
rcData[modeActivationConditions(i)->auxChannelIndex + NON_AUX_CHANNEL_COUNT] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,7 @@ typedef struct rxRuntimeConfig_s {
|
|||
|
||||
extern rxRuntimeConfig_t rxRuntimeConfig; //!!TODO remove this extern, only needed once for channelCount
|
||||
|
||||
struct modeActivationCondition_s;
|
||||
void rxInit(const struct modeActivationCondition_s *modeActivationConditions);
|
||||
void rxInit(void);
|
||||
bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime);
|
||||
bool rxIsReceivingSignal(void);
|
||||
bool rxAreFlightChannelsValid(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue