Grrrrrrrr.
v4 didn't compile without the EXTRA_ROTARY_ENCODERS option companion9x didn't compile
This commit is contained in:
@@ -581,11 +581,15 @@ void putsTrimMode(uint8_t x, uint8_t y, uint8_t phase, uint8_t idx, uint8_t att)
|
||||
#if defined(PCBV4)
|
||||
void putsRotaryEncoderMode(uint8_t x, uint8_t y, uint8_t phase, uint8_t idx, uint8_t att)
|
||||
{
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
int16_t v;
|
||||
if(idx < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
v = phaseaddress(phase)->rotaryEncoders[idx];
|
||||
else
|
||||
v = g_model.rotaryEncodersExtra[phase][idx - (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)];
|
||||
#else
|
||||
int16_t v = phaseaddress(phase)->rotaryEncoders[idx];
|
||||
#endif
|
||||
|
||||
if (v > ROTARY_ENCODER_MAX) {
|
||||
uint8_t p = v - ROTARY_ENCODER_MAX - 1;
|
||||
|
||||
+9
-1
@@ -860,19 +860,27 @@ void menuProcPhaseOne(uint8_t event)
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode((14+t)*FW+2, y, s_currIdx, t, (attr && m_posHorz==4+t) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
if (attr && m_posHorz==4+t && ((s_editMode>0) || p1valdiff)) {
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
int16_t v;
|
||||
if(t < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
v = phaseaddress(s_currIdx)->rotaryEncoders[t];
|
||||
else
|
||||
v = g_model.rotaryEncodersExtra[s_currIdx][t-(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)];
|
||||
#else
|
||||
int16_t v = phaseaddress(s_currIdx)->rotaryEncoders[t];
|
||||
#endif
|
||||
if (v < ROTARY_ENCODER_MAX) v = ROTARY_ENCODER_MAX;
|
||||
v = checkIncDec(event, v, ROTARY_ENCODER_MAX, ROTARY_ENCODER_MAX+MAX_PHASES-1, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (v == ROTARY_ENCODER_MAX) v = 0;
|
||||
if(t < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
#if defined(EXTRA_ROTARY_ENCODERS)
|
||||
if (t < (NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS))
|
||||
phaseaddress(s_currIdx)->rotaryEncoders[t] = v;
|
||||
else
|
||||
g_model.rotaryEncodersExtra[s_currIdx][t-(NUM_ROTARY_ENCODERS - NUM_EXTRA_ROTARY_ENCODERS)] = v;
|
||||
#else
|
||||
phaseaddress(s_currIdx)->rotaryEncoders[t] = v;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+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