mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-14 11:59:56 +03:00
Added PID Profiles to Programming framework
## Added PID Profiles to Programming framework This allows setting the profile and getting the active profile in the programming framework.
This commit is contained in:
parent
05629c8669
commit
51d5df1690
2 changed files with 17 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
|||
#include "common/utils.h"
|
||||
#include "rx/rx.h"
|
||||
#include "common/maths.h"
|
||||
#include "fc/config.h"
|
||||
#include "fc/fc_core.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/runtime_config.h"
|
||||
|
@ -333,6 +334,15 @@ static int logicConditionCompute(
|
|||
}
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_SET_PID_PROFILE:
|
||||
operandA--;
|
||||
if ( getConfigProfile() != operandA && (operandA >= 0 && operandA < MAX_PROFILE_COUNT)) {
|
||||
return setConfigProfile(operandA);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
|
@ -533,6 +543,10 @@ static int logicConditionGetFlightOperandValue(int operand) {
|
|||
#endif
|
||||
break;
|
||||
|
||||
case LOGIC_CONDITION_OPERAND_FLIGHT_PID_PROFILE: // int
|
||||
return getConfigProfile() + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
|
|
|
@ -70,7 +70,8 @@ typedef enum {
|
|||
LOGIC_CONDITION_RC_CHANNEL_OVERRIDE = 38,
|
||||
LOGIC_CONDITION_SET_HEADING_TARGET = 39,
|
||||
LOGIC_CONDITION_MODULUS = 40,
|
||||
LOGIC_CONDITION_LAST = 41,
|
||||
LOGIC_CONDITION_SET_PID_PROFILE = 41,
|
||||
LOGIC_CONDITION_LAST = 42,
|
||||
} logicOperation_e;
|
||||
|
||||
typedef enum logicOperandType_s {
|
||||
|
@ -120,6 +121,7 @@ typedef enum {
|
|||
LOGIC_CONDITION_OPERAND_FLIGHT_CRSF_LQ, // 32
|
||||
LOGIC_CONDITION_OPERAND_FLIGHT_CRSF_SNR, // 33
|
||||
LOGIC_CONDITION_OPERAND_FLIGHT_GPS_VALID, // 0/1 // 34
|
||||
LOGIC_CONDITION_OPERAND_FLIGHT_PID_PROFILE, //int // 35
|
||||
|
||||
} logicFlightOperands_e;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue