More AVR removal

This commit is contained in:
Bertrand Songis
2018-08-05 13:12:51 +02:00
parent ea76998beb
commit ed91931184
23 changed files with 71 additions and 258 deletions
+7 -53
View File
@@ -667,11 +667,6 @@ getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value)
return value;
}
getvalue_t convert8bitsTelemValue(source_t channel, ls_telemetry_value_t value)
{
return value;
}
#if defined(TELEMETRY_FRSKY)
ls_telemetry_value_t minTelemValue(source_t channel)
{
@@ -684,13 +679,6 @@ ls_telemetry_value_t maxTelemValue(source_t channel)
}
#endif
ls_telemetry_value_t max8bitsTelemValue(source_t channel)
{
return 30000;
}
#define INAC_STICKS_SHIFT 6
#define INAC_SWITCHES_SHIFT 8
bool inputsMoved()
@@ -1189,10 +1177,6 @@ void checkTrims()
uint16_t s_anaFilt[NUM_ANALOGS];
#endif
#if defined(SIMU)
uint16_t BandGap = 225;
#endif
#if defined(JITTER_MEASURE)
JitterMeter<uint16_t> rawJitter[NUM_ANALOGS];
JitterMeter<uint16_t> avgJitter[NUM_ANALOGS];
@@ -1413,17 +1397,8 @@ void doMixerCalculations()
evalMixes(tick10ms);
DEBUG_TIMER_STOP(debugTimerEvalMixes);
DEBUG_TIMER_START(debugTimerMixes10ms);
if (tick10ms) {
#if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER)
// code cost is about 16 bytes for higher throttle accuracy for timer
// would not be noticable anyway, because all version up to this change had only 16 steps;
// now it has already 32 steps; this define would increase to 128 steps
#define ACCURAT_THROTTLE_TIMER
#endif
/* Throttle trace */
int16_t val;
@@ -1431,7 +1406,7 @@ void doMixerCalculations()
uint8_t ch = g_model.thrTraceSrc-NUM_POTS-NUM_SLIDERS-1;
val = channelOutputs[ch];
LimitData *lim = limitAddress(ch);
LimitData * lim = limitAddress(ch);
int16_t gModelMax = LIMIT_MAX_RESX(lim);
int16_t gModelMin = LIMIT_MIN_RESX(lim);
@@ -1449,29 +1424,17 @@ void doMixerCalculations()
gModelMax -= gModelMin; // we compare difference between Max and Mix for recaling needed; Max and Min are shifted to 0 by default
// usually max is 1024 min is -1024 --> max-min = 2048 full range
#ifdef ACCURAT_THROTTLE_TIMER
if (gModelMax!=0 && gModelMax!=2048) val = (int32_t) (val << 11) / (gModelMax); // rescaling only needed if Min, Max differs
#else
// @@@ open.20.fsguruh optimized calculation; now *8 /8 instead of 10 base; (*16/16 already cause a overrun; unsigned calculation also not possible, because v may be negative)
gModelMax+=255; // force rounding up --> gModelMax is bigger --> val is smaller
gModelMax >>= (10-2);
if (gModelMax != 0 && gModelMax != 2048)
val = (int32_t) (val << 11) / (gModelMax); // rescaling only needed if Min, Max differs
if (gModelMax!=0 && gModelMax!=8) {
val = (val << 3) / gModelMax; // rescaling only needed if Min, Max differs
}
#endif
if (val<0) val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
if (val < 0)
val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
}
else {
val = RESX + calibratedAnalogs[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
}
#if defined(ACCURAT_THROTTLE_TIMER)
val >>= (RESX_SHIFT-6); // calibrate it (resolution increased by factor 4)
#else
val >>= (RESX_SHIFT-4); // calibrate it
#endif
evalTimers(val, tick10ms);
@@ -1493,11 +1456,8 @@ void doMixerCalculations()
if (s_cnt_1s >= 10) { // 1sec
s_cnt_1s -= 10;
sessionTimer += 1;
struct t_inactivity *ptrInactivity = &inactivity;
FORCE_INDIRECT(ptrInactivity) ;
ptrInactivity->counter++;
if ((((uint8_t)ptrInactivity->counter)&0x07)==0x01 && g_eeGeneral.inactivityTimer && g_vbat100mV>50 && ptrInactivity->counter > ((uint16_t)g_eeGeneral.inactivityTimer*60))
inactivity.counter++;
if ((((uint8_t)inactivity.counter)&0x07)==0x01 && g_eeGeneral.inactivityTimer && g_vbat100mV>50 && inactivity.counter > ((uint16_t)g_eeGeneral.inactivityTimer*60))
AUDIO_INACTIVITY();
#if defined(AUDIO)
@@ -1506,16 +1466,10 @@ void doMixerCalculations()
if (mixWarning & 4) if ((sessionTimer&0x03)==2) AUDIO_MIX_WARNING(3);
#endif
#if defined(ACCURAT_THROTTLE_TIMER)
val = s_sum_samples_thr_1s / s_cnt_samples_thr_1s;
s_timeCum16ThrP += (val>>3); // s_timeCum16ThrP would overrun if we would store throttle value with higher accuracy; therefore stay with 16 steps
if (val) s_timeCumThr += 1;
s_sum_samples_thr_1s>>=2; // correct better accuracy now, because trace graph can show this information; in case thrtrace is not active, the compile should remove this
#else
val = s_sum_samples_thr_1s / s_cnt_samples_thr_1s;
s_timeCum16ThrP += (val>>1);
if (val) s_timeCumThr += 1;
#endif
#if defined(THRTRACE)
// throttle trace is done every 10 seconds; Tracebuffer is adjusted to screen size.