mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-21 07:15:16 +03:00
Allow ANDing of multiple channel ranges in mode activation conditions (#364)
* Allow ANDing of multiple channel ranges in mode activation conditions (CLI: set and_mode_conditions=ON) * Moved mode logic operator to Profile (modeActivationConditions are part of profile already); Created a lookup table for logic operator * Closes #212
This commit is contained in:
parent
68ab7d4213
commit
394a28824f
6 changed files with 62 additions and 11 deletions
|
@ -423,6 +423,10 @@ static const char * const lookupTableNavRthAltMode[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static const char * const lookupTableAuxOperator[] = {
|
||||
"OR", "AND"
|
||||
};
|
||||
|
||||
typedef struct lookupTableEntry_s {
|
||||
const char * const *values;
|
||||
const uint8_t valueCount;
|
||||
|
@ -457,6 +461,7 @@ typedef enum {
|
|||
TABLE_NAV_USER_CTL_MODE,
|
||||
TABLE_NAV_RTH_ALT_MODE,
|
||||
#endif
|
||||
TABLE_AUX_OPERATOR,
|
||||
} lookupTableIndex_e;
|
||||
|
||||
static const lookupTableEntry_t lookupTables[] = {
|
||||
|
@ -488,6 +493,7 @@ static const lookupTableEntry_t lookupTables[] = {
|
|||
{ lookupTableNavControlMode, sizeof(lookupTableNavControlMode) / sizeof(char *) },
|
||||
{ lookupTableNavRthAltMode, sizeof(lookupTableNavRthAltMode) / sizeof(char *) },
|
||||
#endif
|
||||
{ lookupTableAuxOperator, sizeof(lookupTableAuxOperator) / sizeof(char *) },
|
||||
};
|
||||
|
||||
#define VALUE_TYPE_OFFSET 0
|
||||
|
@ -725,6 +731,7 @@ const clivalue_t valueTable[] = {
|
|||
{ "servo_lowpass_enable", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.mixerConfig.servo_lowpass_enable, .config.lookup = { TABLE_OFF_ON }, 0 },
|
||||
#endif
|
||||
|
||||
{ "mode_range_logic_operator", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, &masterConfig.profile[0].modeActivationOperator, .config.lookup = { TABLE_AUX_OPERATOR }, 0 },
|
||||
{ "default_rate_profile", VAR_UINT8 | PROFILE_VALUE , &masterConfig.profile[0].defaultRateProfileIndex, .config.minmax = { 0, MAX_CONTROL_RATE_PROFILE_COUNT - 1 }, 0 },
|
||||
{ "rc_expo", VAR_UINT8 | CONTROL_RATE_VALUE, &masterConfig.controlRateProfiles[0].rcExpo8, .config.minmax = { 0, 100 }, 0 },
|
||||
{ "rc_yaw_expo", VAR_UINT8 | CONTROL_RATE_VALUE, &masterConfig.controlRateProfiles[0].rcYawExpo8, .config.minmax = { 0, 100 }, 0 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue