From d311818604acb66c9061f5486ce9731fe4e46e0c Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 2 Apr 2012 19:40:36 +0000 Subject: [PATCH] Rotary encoders in Mixer --- src/open9x.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/open9x.cpp b/src/open9x.cpp index 6d40ff142..3652d445d 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -645,7 +645,9 @@ int16_t getRotaryEncoder(uint8_t idx) void incRotaryEncoder(uint8_t idx, int8_t inc) { - phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx] += inc; + g_rotenc[idx] += inc; + int16_t *value = &(phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]); + *value = limit((int16_t)-1024, *value + inc, (int16_t)+1024); } #endif