mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-13 03:19:58 +03:00
Added some comparative operations
Added comparative operations for constraints, min, and max.
This commit is contained in:
parent
d7760905dd
commit
bdc83e4e0e
3 changed files with 25 additions and 1 deletions
|
@ -76,6 +76,10 @@ IPF can be edited using INAV Configurator user interface, of via CLI
|
|||
| 40 | MOD | Divide `Operand A` by `Operand B` and returns the remainder |
|
||||
| 41 | LOITER_RADIUS_OVERRIDE | Sets the loiter radius to `Operand A` [`0` : `100000`] in cm. If the value is lower than the loiter radius set in the **Advanced Tuning**, that will be used. |
|
||||
| 42 | SET_PROFILE | Sets the active config profile (PIDFF/Rates/Filters/etc) to `Operand A`. `Operand A` must be a valid profile number, currently from 1 to 3. If not, the profile will not change |
|
||||
| 43 | CONSTRAIN_MIN | Ensures that `Operand A` cannot be less than `Operand B` |
|
||||
| 44 | CONSTRAIN_MAX | Ensures that `Operand A` cannot be greater than `Operand B` |
|
||||
| 45 | MIN | Finds the lowest value of `Operand A` and `Operand B` |
|
||||
| 46 | MAX | Finds the highest value of `Operand A` and `Operand B` |
|
||||
|
||||
### Operands
|
||||
|
||||
|
|
|
@ -303,6 +303,22 @@ static int logicConditionCompute(
|
|||
temporaryValue = (operandB == 0) ? 500 : operandB;
|
||||
return tan_approx(DEGREES_TO_RADIANS(operandA)) * temporaryValue;
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_CONSTRAIN_MIN:
|
||||
return (operandA < operandB) ? operandB : operandA;
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_CONSTRAIN_MAX:
|
||||
return (operandA > operandB) ? operandB : operandA;
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_MIN:
|
||||
return (operandA < operandB) ? operandA : operandB;
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_MAX:
|
||||
return (operandA > operandB) ? operandA : operandB;
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_MAP_INPUT:
|
||||
return scaleRange(constrain(operandA, 0, operandB), 0, operandB, 0, 1000);
|
||||
|
|
|
@ -72,7 +72,11 @@ typedef enum {
|
|||
LOGIC_CONDITION_MODULUS = 40,
|
||||
LOGIC_CONDITION_LOITER_OVERRIDE = 41,
|
||||
LOGIC_CONDITION_SET_PROFILE = 42,
|
||||
LOGIC_CONDITION_LAST = 43,
|
||||
LOGIC_CONDITION_CONSTRAIN_MIN = 43,
|
||||
LOGIC_CONDITION_CONSTRAIN_MAX = 44,
|
||||
LOGIC_CONDITION_MIN = 45,
|
||||
LOGIC_CONDITION_MAX = 46,
|
||||
LOGIC_CONDITION_LAST = 47,
|
||||
} logicOperation_e;
|
||||
|
||||
typedef enum logicOperandType_s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue