hellen on a bike: both TS and SD card logs report -32v on secondary TPS and secondary PPS #6376

only: work-around
This commit is contained in:
rusEFI LLC 2024-04-22 18:27:26 -04:00
parent 294040c22a
commit 2519b3fa53
1 changed files with 6 additions and 4 deletions

View File

@ -86,10 +86,12 @@ static adcsample_t getAvgAdcValue(int index, adcsample_t *samples, int bufDepth,
uint32_t result = 0;
for (int i = 0; i < bufDepth; i++) {
adcsample_t sample = samples[index];
if (sample > 0x1FFF) {
// 12bit ADC expected right now, make this configurable one day
criticalError("fast ADC unexpected sample %d", sample);
} else if (sample > 0xFFF) {
// if (sample > 0x1FFF) {
// // 12bit ADC expected right now, make this configurable one day
// criticalError("fast ADC unexpected sample %d", sample);
// } else
if (sample > 0xFFF) {
sample = sample & 0xFFF; // sad hack which works around https://github.com/rusefi/rusefi/issues/6376 which we do not understand
engine->outputChannels.adc13bitCounter++;
}
result += sample;