1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-14 20:10:15 +03:00

Added some comparative operations

Added comparative operations for constraints, min, and max.
This commit is contained in:
Darren Lines 2022-02-06 18:09:12 +00:00
parent d7760905dd
commit bdc83e4e0e
3 changed files with 25 additions and 1 deletions

View file

@ -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);