1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Momentary switches bug

This commit is contained in:
bsongis 2012-05-04 20:25:16 +00:00
parent 43e675761c
commit 7fa73b64bc

View file

@ -1365,12 +1365,16 @@ void testFunc()
} }
#endif #endif
uint16_t active_functions = 0; // current max = 16 functions #if defined(PCBARM)
#define MASK_FSW_TYPE uint32_t // current max = 32 functions
#else
#define MASK_FSW_TYPE uint16_t // current max = 16 functions
#endif
MASK_FSW_TYPE active_functions = 0;
void evalFunctions() void evalFunctions()
{ {
assert((int)(sizeof(active_functions)*8) > (int)(FUNC_MAX-NUM_CHNOUT));
for (uint8_t i=0; i<NUM_CHNOUT; i++) for (uint8_t i=0; i<NUM_CHNOUT; i++)
safetyCh[i] = -128; // not defined safetyCh[i] = -128; // not defined
@ -1378,7 +1382,7 @@ void evalFunctions()
FuncSwData *sd = &g_model.funcSw[i]; FuncSwData *sd = &g_model.funcSw[i];
int8_t swtch = sd->swtch; int8_t swtch = sd->swtch;
if (swtch) { if (swtch) {
uint16_t mask = (sd->func >= FUNC_TRAINER ? (1 << (sd->func-FUNC_TRAINER)) : 0); MASK_FSW_TYPE mask = ((MASK_FSW_TYPE)1 << i);
uint8_t momentary = 0; uint8_t momentary = 0;
if (swtch > MAX_SWITCH+1) { if (swtch > MAX_SWITCH+1) {
momentary = 1; momentary = 1;