Global Functions now integrated inside Companion - Fixes #502

This commit is contained in:
bsongis
2014-09-18 15:32:55 +02:00
parent 343e395652
commit ef7bbea285
45 changed files with 685 additions and 687 deletions
+3 -1
View File
@@ -5071,8 +5071,10 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
{
int8_t sub = m_posVert - 1;
#if defined(CPUARM) || defined(AUTOSWITCH)
#if defined(CPUARM)
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
#elif !defined(CPUM64) || defined(AUTOSWITCH)
uint8_t eeFlags = EE_MODEL;
#endif
#if defined(PCBTARANIS)
+3 -3
View File
@@ -520,7 +520,7 @@ enum AdjustGvarFunctionParam {
#define LEN_CFN_NAME 6
#define CFN_SPARE_TYPE int16_t
#endif
PACK(typedef struct t_CustomFunctionData { // Function Switches data
PACK(typedef struct {
int8_t swtch;
uint8_t func;
PACK(union {
@@ -557,7 +557,7 @@ PACK(typedef struct t_CustomFunctionData { // Function Switches data
#define CFN_RESET(p) ((p)->active=0, (p)->clear.val1=0, (p)->clear.val2=0)
#define CFN_GVAR_CST_MAX GVAR_LIMIT
#else
PACK(typedef struct t_CustomFunctionData {
PACK(typedef struct {
PACK(union {
PACK(struct {
int16_t swtch:6;
@@ -650,7 +650,7 @@ PACK(typedef struct t_EEGeneral {
EXTRA_GENERAL_FIELDS
swstate_t switchUnlockStates;
ARM_FIELD(swstate_t switchUnlockStates)
ARM_FIELD(CustomFunctionData customFn[NUM_CFN])
+6 -3
View File
@@ -389,12 +389,15 @@ TEST(Trims, CopyTrimsToOffset)
MODEL_RESET();
modelDefault(0);
setTrimValue(0, ELE_STICK, -100); // -100 on elevator
#if defined(CPUARM)
evalFunctions(g_model.customFn, modelFunctionsContext); // it disables all safety channels
copyTrimsToOffset(1);
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
EXPECT_EQ(g_model.limitData[1].offset, -195);
#else
evalFunctions(); // it disables all safety channels
copyTrimsToOffset(1);
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
#if defined(CPUARM)
EXPECT_EQ(g_model.limitData[1].offset, -195);
#else
EXPECT_EQ(g_model.limitData[1].offset, -200);
#endif
}