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