mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
Fixes #2754
This commit is contained in:
parent
c907c20705
commit
a985d021b6
3 changed files with 12 additions and 19 deletions
|
@ -284,10 +284,10 @@ void evalFunctions()
|
|||
#endif
|
||||
|
||||
for (uint8_t i=0; i<NUM_CFN; i++) {
|
||||
const CustomFunctionData *cfn = &functions[i];
|
||||
const CustomFunctionData * cfn = &functions[i];
|
||||
int8_t swtch = CFN_SWITCH(cfn);
|
||||
if (swtch) {
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0);
|
||||
|
|
|
@ -530,7 +530,7 @@ typedef struct {
|
|||
MASK_CFN_TYPE activeSwitches;
|
||||
tmr10ms_t lastFunctionTime[NUM_CFN];
|
||||
|
||||
inline bool isFuunctionActive(uint8_t func)
|
||||
inline bool isFunctionActive(uint8_t func)
|
||||
{
|
||||
return activeFunctions & ((MASK_FUNC_TYPE)1 << func);
|
||||
}
|
||||
|
@ -1333,7 +1333,7 @@ extern CustomFunctionsContext modelFunctionsContext;
|
|||
extern CustomFunctionsContext globalFunctionsContext;
|
||||
inline bool isFunctionActive(uint8_t func)
|
||||
{
|
||||
return globalFunctionsContext.isFuunctionActive(func) || modelFunctionsContext.isFuunctionActive(func);
|
||||
return globalFunctionsContext.isFunctionActive(func) || modelFunctionsContext.isFunctionActive(func);
|
||||
}
|
||||
void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
inline void customFunctionsReset()
|
||||
|
@ -1343,7 +1343,7 @@ inline void customFunctionsReset()
|
|||
}
|
||||
#else
|
||||
extern CustomFunctionsContext modelFunctionsContext;
|
||||
#define isFunctionActive(func) modelFunctionsContext.isFuunctionActive(func)
|
||||
#define isFunctionActive(func) modelFunctionsContext.isFunctionActive(func)
|
||||
void evalFunctions();
|
||||
#define customFunctionsReset() modelFunctionsContext.reset()
|
||||
#endif
|
||||
|
|
|
@ -92,7 +92,7 @@ uint64_t check2PosSwitchPosition(EnumKeys sw)
|
|||
else
|
||||
index = sw - SW_SA0 + 2;
|
||||
|
||||
result = ((int64_t)1 << index);
|
||||
result = ((uint64_t)1 << index);
|
||||
|
||||
if (!(switchesPos & result)) {
|
||||
PLAY_SWITCH_MOVED(index);
|
||||
|
@ -101,9 +101,9 @@ uint64_t check2PosSwitchPosition(EnumKeys sw)
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32_t check3PosSwitchPosition(uint8_t idx, EnumKeys sw, bool startup)
|
||||
uint64_t check3PosSwitchPosition(uint8_t idx, EnumKeys sw, bool startup)
|
||||
{
|
||||
uint32_t result;
|
||||
uint64_t result;
|
||||
uint32_t index;
|
||||
|
||||
if (switchState(sw)) {
|
||||
|
@ -178,6 +178,7 @@ void getSwitchesPosition(bool startup)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define SWITCH_POSITION(sw) (switchesPos & (1<<(sw)))
|
||||
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
||||
|
||||
|
@ -444,18 +445,10 @@ bool getSwitch(int8_t swtch)
|
|||
}
|
||||
else if (cs_idx <= SWSRC_LAST_SWITCH) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (flags & GETSWITCH_MIDPOS_DELAY) {
|
||||
div_t swinfo = switchInfo(cs_idx);
|
||||
if (IS_3POS(swinfo.quot)) {
|
||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||
}
|
||||
else {
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (flags & GETSWITCH_MIDPOS_DELAY)
|
||||
result = SWITCH_POSITION(cs_idx-SWSRC_FIRST_SWITCH);
|
||||
else
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
}
|
||||
#else
|
||||
result = switchState((EnumKeys)(SW_BASE+cs_idx-SWSRC_FIRST_SWITCH));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue