fix: switch position if disabled or transitioning

This commit is contained in:
raphaelcoeffic
2023-06-25 14:32:39 +02:00
committed by Malte Langermann
parent fc6ad808ad
commit c15c5ea9eb
3 changed files with 15 additions and 12 deletions
+4 -9
View File
@@ -102,15 +102,10 @@ void initLoggingTimer() { // called cyclic
void writeHeader();
#if defined(PCBFRSKY) || defined(PCBNV14)
int getSwitchState(uint8_t swtch) {
int value = getValue(MIXSRC_FIRST_SWITCH + swtch);
return (value == 0) ? 0 : (value < 0) ? -1 : +1;
}
#else
#define GET_2POS_STATE(sw) (switchState(SW_ ## sw) ? -1 : 1)
#define GET_3POS_STATE(sw) (switchState(SW_ ## sw ## 0) ? -1 : (switchState(SW_ ## sw ## 2) ? 1 : 0))
#endif
int getSwitchState(uint8_t swtch) {
int value = getValue(MIXSRC_FIRST_SWITCH + swtch);
return (value == 0) ? 0 : (value < 0) ? -1 : +1;
}
void logsInit()
{