mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
Simu switches fix
This commit is contained in:
parent
c80bcd2c55
commit
356a39e010
1 changed files with 5 additions and 5 deletions
|
@ -303,20 +303,20 @@ void OpenTxSim::updateKeysAndSwitches(bool start)
|
||||||
|
|
||||||
#define SWITCH_KEY(key, swtch, states) \
|
#define SWITCH_KEY(key, swtch, states) \
|
||||||
static bool state##key = 0; \
|
static bool state##key = 0; \
|
||||||
static int8_t state_##swtch = 2; \
|
static int8_t state_##swtch = -1; \
|
||||||
static int8_t inc_##swtch = 1; \
|
static int8_t inc_##swtch = 4-states; \
|
||||||
if (getApp()->getKeyState(KEY_##key)) { \
|
if (getApp()->getKeyState(KEY_##key)) { \
|
||||||
if (!state##key) { \
|
if (!state##key) { \
|
||||||
state_##swtch = (state_##swtch+inc_##swtch); \
|
state_##swtch = (state_##swtch+inc_##swtch); \
|
||||||
if (state_##swtch == 1+states) inc_##swtch = -1; \
|
if (state_##swtch == -1+((states-1)*inc_##swtch)) inc_##swtch = -4+states; \
|
||||||
else if (state_##swtch == 2) inc_##swtch = 1; \
|
else if (state_##swtch == -1) inc_##swtch = 4-states; \
|
||||||
state##key = true; \
|
state##key = true; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
state##key = false; \
|
state##key = false; \
|
||||||
} \
|
} \
|
||||||
simuSetSwitch(swtch, state_##swtch-states)
|
simuSetSwitch(swtch, state_##swtch) \
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
SWITCH_KEY(1, 0, 3);
|
SWITCH_KEY(1, 0, 3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue