dead code in map avg (#3290)
* dead code in map avg * while we're at it Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
f311352750
commit
6703df0be3
|
@ -50,14 +50,6 @@ static volatile int measurementsPerRevolutionCounter = 0;
|
||||||
*/
|
*/
|
||||||
static volatile int measurementsPerRevolution = 0;
|
static volatile int measurementsPerRevolution = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* In this lock-free implementation 'readIndex' is always pointing
|
|
||||||
* to the consistent copy of accumulator and counter pair
|
|
||||||
*/
|
|
||||||
static int readIndex = 0;
|
|
||||||
static float accumulators[2];
|
|
||||||
static int counters[2];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Running MAP accumulator - sum of all measurements within averaging window
|
* Running MAP accumulator - sum of all measurements within averaging window
|
||||||
*/
|
*/
|
||||||
|
@ -148,18 +140,6 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
|
||||||
}
|
}
|
||||||
#endif /* EFI_SENSOR_CHART */
|
#endif /* EFI_SENSOR_CHART */
|
||||||
|
|
||||||
/**
|
|
||||||
* Local copy is now safe, but it's an overkill: we only
|
|
||||||
* have one writing thread anyway
|
|
||||||
*/
|
|
||||||
int readIndexLocal = readIndex;
|
|
||||||
int writeIndex = readIndexLocal ^ 1;
|
|
||||||
accumulators[writeIndex] = accumulators[readIndexLocal] + adcValue;
|
|
||||||
counters[writeIndex] = counters[readIndexLocal] + 1;
|
|
||||||
// this would commit the new pair of values
|
|
||||||
readIndex = writeIndex;
|
|
||||||
|
|
||||||
// todo: migrate to the lock-free implementation
|
|
||||||
{
|
{
|
||||||
// with locking we will have a consistent state
|
// with locking we will have a consistent state
|
||||||
chibios_rt::CriticalSectionLocker csl;
|
chibios_rt::CriticalSectionLocker csl;
|
||||||
|
@ -169,8 +149,7 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void endAveraging(void *arg) {
|
static void endAveraging(void*) {
|
||||||
(void) arg;
|
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
chibios_rt::CriticalSectionLocker csl;
|
chibios_rt::CriticalSectionLocker csl;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue