Grrrrrrrr.
v4 didn't compile without the EXTRA_ROTARY_ENCODERS option companion9x didn't compile
This commit is contained in:
+14
-5
@@ -685,11 +685,15 @@ uint8_t getRotaryEncoderFlightPhase(uint8_t idx)
|
||||
uint8_t phase = s_perout_flight_phase;
|
||||
for (uint8_t i=0; i<MAX_PHASES; i++) {
|
||||
if (phase == 0) return 0;
|
||||
int16_t value = 0;
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
int16_t value;
|
||||
if(idx<(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
value = phaseaddress(phase)->rotaryEncoders[idx];
|
||||
else
|
||||
value = g_model.rotaryEncodersExtra[phase][idx-(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)];
|
||||
#else
|
||||
int16_t value = phaseaddress(phase)->rotaryEncoders[idx];
|
||||
#endif
|
||||
if (value <= ROTARY_ENCODER_MAX) return phase;
|
||||
uint8_t result = value-ROTARY_ENCODER_MAX-1;
|
||||
if (result >= phase) result++;
|
||||
@@ -700,20 +704,25 @@ uint8_t getRotaryEncoderFlightPhase(uint8_t idx)
|
||||
|
||||
int16_t getRotaryEncoder(uint8_t idx)
|
||||
{
|
||||
if(idx < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
return phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx];
|
||||
else
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
if(idx >= (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
return g_model.rotaryEncodersExtra[getRotaryEncoderFlightPhase(idx)][idx-(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)];
|
||||
#endif
|
||||
return phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx];
|
||||
}
|
||||
|
||||
void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||
{
|
||||
g_rotenc[idx] += inc;
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
int16_t *value;
|
||||
if(idx < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
if (idx < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
value = &(phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
|
||||
else
|
||||
value = &(g_model.rotaryEncodersExtra[getRotaryEncoderFlightPhase(idx)][idx-(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)]);
|
||||
#else
|
||||
int16_t *value = &(phaseaddress(getRotaryEncoderFlightPhase(idx))->rotaryEncoders[idx]);
|
||||
#endif
|
||||
*value = limit((int16_t)-1024, (int16_t)(*value + (inc * 8)), (int16_t)+1024);
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user