mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
Global Functions (#4474)
* First cut on data structure * fix source.mk * Dummy task to process global functions * Early stage of arming safety override * CLI interface for global functions * MSP layer for global functions * arming safety override with a global function * Integrate throttle limit into global functions * Fix Omnibus RAM overflow
This commit is contained in:
parent
4fac7f3797
commit
97f3144bd0
14 changed files with 350 additions and 11 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "common/bitarray.h"
|
||||
#include "common/time.h"
|
||||
#include "common/utils.h"
|
||||
#include "common/global_functions.h"
|
||||
|
||||
#include "config/parameter_group_ids.h"
|
||||
|
||||
|
@ -495,6 +496,18 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU32(dst, logicConditionGetValue(i));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_GLOBAL_FUNCTIONS
|
||||
case MSP2_INAV_GLOBAL_FUNCTIONS:
|
||||
for (int i = 0; i < MAX_GLOBAL_FUNCTIONS; i++) {
|
||||
sbufWriteU8(dst, globalFunctions(i)->enabled);
|
||||
sbufWriteU8(dst, globalFunctions(i)->conditionId);
|
||||
sbufWriteU8(dst, globalFunctions(i)->action);
|
||||
sbufWriteU8(dst, globalFunctions(i)->withValue.type);
|
||||
sbufWriteU32(dst, globalFunctions(i)->withValue.value);
|
||||
sbufWriteU8(dst, logicConditions(i)->flags);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case MSP2_COMMON_MOTOR_MIXER:
|
||||
for (uint8_t i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
|
||||
|
@ -1919,6 +1932,20 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
} else
|
||||
return MSP_RESULT_ERROR;
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_GLOBAL_FUNCTIONS
|
||||
case MSP2_INAV_SET_GLOBAL_FUNCTIONS:
|
||||
sbufReadU8Safe(&tmp_u8, src);
|
||||
if ((dataSize == 14) && (tmp_u8 < MAX_GLOBAL_FUNCTIONS)) {
|
||||
globalFunctionsMutable(tmp_u8)->enabled = sbufReadU8(src);
|
||||
globalFunctionsMutable(tmp_u8)->conditionId = sbufReadU8(src);
|
||||
globalFunctionsMutable(tmp_u8)->action = sbufReadU8(src);
|
||||
globalFunctionsMutable(tmp_u8)->withValue.type = sbufReadU8(src);
|
||||
globalFunctionsMutable(tmp_u8)->withValue.value = sbufReadU32(src);
|
||||
globalFunctionsMutable(tmp_u8)->flags = sbufReadU8(src);
|
||||
} else
|
||||
return MSP_RESULT_ERROR;
|
||||
break;
|
||||
#endif
|
||||
case MSP2_COMMON_SET_MOTOR_MIXER:
|
||||
sbufReadU8Safe(&tmp_u8, src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue