This commit is contained in:
rusefi 2019-11-03 22:02:52 -05:00
parent d1afb9b183
commit 9cbdbb794e
3 changed files with 28 additions and 27 deletions

View File

@ -15,6 +15,7 @@
#if EFI_PROD_CODE #if EFI_PROD_CODE
#include "digital_input_hw.h" #include "digital_input_hw.h"
#include "digital_input_exti.h"
#include "pin_repository.h" #include "pin_repository.h"
#endif #endif
@ -246,7 +247,7 @@ static void printMAPInfo(void) {
} }
if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, getBaroPressure()); scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
if (engineConfiguration->baroSensor.type == MT_CUSTOM) { if (engineConfiguration->baroSensor.type == MT_CUSTOM) {
scheduleMsg(logger, "min=%.2f@%.2f max=%.2f@%.2f", scheduleMsg(logger, "min=%.2f@%.2f max=%.2f@%.2f",
engineConfiguration->baroSensor.lowValue, engineConfiguration->baroSensor.lowValue,
@ -272,13 +273,24 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL); digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
} }
#else
#if EFI_PROD_CODE
efiExtiEnablePin(
"Frequency MAP",
CONFIGB(frequencyReportingMapInputPin),
PAL_EVENT_MODE_RISING_EDGE,
(palcallback_t)digitalMapWidthCallback,
nullptr
);
#endif /* EFI_PROD_CODE */
#endif /* HAL_USE_ICU */
if (CONFIG(useFixedBaroCorrFromMap)) { if (CONFIG(useFixedBaroCorrFromMap)) {
// Read initial MAP sensor value and store it for Baro correction. // Read initial MAP sensor value and store it for Baro correction.
storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE); storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE);
scheduleMsg(logger, "Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure); scheduleMsg(logger, "Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure);
// validate if it's within a reasonable range (the engine should not be spinning etc.) // validate if it's within a reasonable range (the engine should not be spinning etc.)
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure); storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure PASS_ENGINE_PARAMETER_SUFFIX);
if (!cisnan(storedInitialBaroPressure)) { if (!cisnan(storedInitialBaroPressure)) {
scheduleMsg(logger, "Using this fixed MAP pressure to override the baro correction!"); scheduleMsg(logger, "Using this fixed MAP pressure to override the baro correction!");
} else { } else {
@ -286,6 +298,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
} }
} }
#if EFI_PROD_CODE
addConsoleAction("mapinfo", printMAPInfo); addConsoleAction("mapinfo", printMAPInfo);
#endif #endif
} }

View File

@ -143,18 +143,6 @@ static void initWave(const char *name, int index) {
WaveReader::WaveReader() { WaveReader::WaveReader() {
hw = nullptr; hw = nullptr;
last_wave_high_widthUs = 0;
name = nullptr;
fallEventCounter = riseEventCounter = 0;
currentRevolutionCounter = 0;
prevTotalOnTimeUs = 0;
totalOnTimeAccumulatorUs = 0;
lastActivityTimeUs = 0;
periodEventTimeUs = 0;
widthEventTimeUs = 0;
signalPeriodUs = 0;
waveOffsetUs = 0;
last_wave_low_widthUs = 0;
} }
static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) { static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {

View File

@ -23,34 +23,34 @@ public:
void onFallEvent(); void onFallEvent();
digital_input_s *hw; digital_input_s *hw;
const char *name; const char *name = nullptr;
volatile int fallEventCounter; volatile int fallEventCounter = 0;
volatile int riseEventCounter; volatile int riseEventCounter = 0;
int currentRevolutionCounter; int currentRevolutionCounter = 0;
/** /**
* Total ON time during last engine cycle * Total ON time during last engine cycle
*/ */
efitimeus_t prevTotalOnTimeUs; efitimeus_t prevTotalOnTimeUs = 0;
efitimeus_t totalOnTimeAccumulatorUs; efitimeus_t totalOnTimeAccumulatorUs = 0;
volatile efitimeus_t lastActivityTimeUs; // timestamp in microseconds ticks volatile efitimeus_t lastActivityTimeUs = 0; // timestamp in microseconds ticks
/** /**
* time of signal fall event, in microseconds * time of signal fall event, in microseconds
*/ */
volatile efitimeus_t periodEventTimeUs; volatile efitimeus_t periodEventTimeUs = 0;
volatile efitimeus_t widthEventTimeUs; // time of signal rise in microseconds volatile efitimeus_t widthEventTimeUs = 0; // time of signal rise in microseconds
volatile efitimeus_t signalPeriodUs; // period between two signal rises in microseconds volatile efitimeus_t signalPeriodUs = 0; // period between two signal rises in microseconds
/** /**
* offset from engine cycle start in microseconds * offset from engine cycle start in microseconds
*/ */
volatile efitimeus_t waveOffsetUs; volatile efitimeus_t waveOffsetUs = 0;
volatile efitimeus_t last_wave_low_widthUs; // time period in systimer ticks volatile efitimeus_t last_wave_low_widthUs = 0; // time period in systimer ticks
volatile efitimeus_t last_wave_high_widthUs; // time period in systimer ticks volatile efitimeus_t last_wave_high_widthUs = 0; // time period in systimer ticks
}; };
void initWaveAnalyzer(Logging *sharedLogger); void initWaveAnalyzer(Logging *sharedLogger);