From 6555e4b305152eb012eea10305ef48e7afbfe903 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 2 Dec 2019 20:31:49 -0500 Subject: [PATCH] "sensor chart" for aux fast analog input --- firmware/controllers/engine_controller.cpp | 2 +- firmware/development/sensor_chart.h | 7 ++----- firmware/hw_layer/hardware.cpp | 9 +++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 73ee70a127..cf5ce88d24 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -819,6 +819,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20191130; + return 20191202; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/development/sensor_chart.h b/firmware/development/sensor_chart.h index 79237ab2c0..91a02390ef 100644 --- a/firmware/development/sensor_chart.h +++ b/firmware/development/sensor_chart.h @@ -2,15 +2,12 @@ * @file sensor_chart.h * * @date Dec 20, 2013 - * @author Andrey Belomutskiy, (c) 2012-2017 + * @author Andrey Belomutskiy, (c) 2012-2019 */ -#ifndef SENSOR_CHART_H_ -#define SENSOR_CHART_H_ +#pragma once #include "global.h" void scAddData(float angle, float value); void initSensorChart(void); - -#endif /* SENSOR_CHART_H_ */ diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 01f7109fe3..362c503183 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -27,6 +27,7 @@ #include "accelerometer.h" #include "eficonsole.h" #include "console_io.h" +#include "sensor_chart.h" #include "mpu_util.h" //#include "usb_msd.h" @@ -188,8 +189,6 @@ static int fastMapSampleIndex; static int hipSampleIndex; static int tpsSampleIndex; -extern int tpsFastAdc; - #if HAL_USE_ADC extern AdcDevice fastAdc; @@ -216,6 +215,11 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) { */ efiAssertVoid(CUSTOM_ERR_6676, getCurrentRemainingStack() > 128, "lowstck#9b"); + if (ENGINE(sensorChartMode) == SC_AUX_FAST1) { + float voltage = getAdcValue("fAux1", engineConfiguration->bc.auxFastSensor1_adcChannel); + scAddData(getCrankshaftAngleNt(getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX), voltage); + } + #if EFI_MAP_AVERAGING mapAveragingAdcCallback(fastAdc.samples[fastMapSampleIndex]); #endif /* EFI_MAP_AVERAGING */ @@ -242,6 +246,7 @@ static void calcFastAdcIndexes(void) { } else { tpsSampleIndex = TPS_IS_SLOW; } + #endif/* HAL_USE_ADC */ }