auto-sync

This commit is contained in:
rusEfi 2015-05-28 23:08:11 -04:00
parent 8f968c3014
commit e4546e5d89
8 changed files with 36 additions and 16 deletions

View File

@ -44,7 +44,7 @@ void Engine::updateSlowSensors() {
injectorLagMs = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
}
void Engine::onTriggerEvent(uint64_t nowNt) {
void Engine::onTriggerEvent(efitick_t nowNt) {
isSpinning = true;
lastTriggerEventTimeNt = nowNt;
}

View File

@ -218,9 +218,9 @@ public:
*/
NamedOutputPin *ignitionPin[IGNITION_PIN_COUNT];
void onTriggerEvent(uint64_t nowNt);
void onTriggerEvent(efitick_t nowNt);
EngineState engineState;
uint64_t lastTriggerEventTimeNt;
efitick_t lastTriggerEventTimeNt;
/**
* this value depends on a slow-changing VBatt value, so

View File

@ -45,7 +45,7 @@ efitimeus_t getTimeNowUs(void);
*/
efitick_t getTimeNowNt(void);
uint64_t getHalTimer(void);
efitick_t getHalTimer(void);
/**
* @brief Returns the number of milliseconds since the board initialization.

View File

@ -6,11 +6,16 @@
#include "error_handling.h"
#include "map.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "digital_input_hw.h"
#endif
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
EXTERN_ENGINE;
static FastInterpolation customMap;
static efitick_t digitalMapDiff = 0;
/**
* @brief MAP value decoded for a 1.83 Honda sensor
@ -115,12 +120,27 @@ static void applyConfiguration(DECLARE_ENGINE_PARAMETER_F) {
mapDecoder = getDecoder(engineConfiguration->map.sensor.type);
}
static void digitalMapWidthCallback(void) {
}
void initMapDecoder(DECLARE_ENGINE_PARAMETER_F) {
applyConfiguration(PASS_ENGINE_PARAMETER_F);
//engine->configurationListeners.registerCallback(applyConfiguration);
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (engineConfiguration->hasFrequencyReportingMapSensor) {
digital_input_s* digitalMapInput = initWaveAnalyzerDriver(boardConfiguration->frequencyReportingMapInputPin);
startInputDriver(digitalMapInput, true);
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
}
#endif
}
#else
#else /* EFI_ANALOG_SENSORS */
void initMapDecoder(DECLARE_ENGINE_PARAMETER_F) {
}

View File

@ -59,7 +59,7 @@ RpmCalculator::RpmCalculator() {
* @return true if there was a full shaft revolution within the last second
*/
bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_F) {
uint64_t nowNt = getTimeNowNt();
efitick_t nowNt = getTimeNowNt();
if (engine->stopEngineRequestTimeNt != 0) {
if (nowNt - engine->stopEngineRequestTimeNt < 3 * US2NT(US_PER_SECOND_LL)) {
return false;
@ -138,7 +138,7 @@ bool isCranking(void) {
*/
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S) {
RpmCalculator *rpmState = &engine->rpmCalculator;
uint64_t nowNt = getTimeNowNt();
efitick_t nowNt = getTimeNowNt();
engine->m.beforeRpmCb = GET_TIMESTAMP();
#if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2z");

View File

@ -56,7 +56,7 @@ static void ensureInitialized(WaveReader *reader) {
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
static void waAnaWidthCallback(WaveReader *reader) {
uint64_t nowUs = getTimeNowUs();
efitick_t nowUs = getTimeNowUs();
reader->eventCounter++;
reader->lastActivityTimeUs = nowUs;
addWaveChartEvent(reader->name, WC_UP);
@ -69,12 +69,12 @@ static void waAnaWidthCallback(WaveReader *reader) {
}
void WaveReader::onFallEvent() {
uint64_t nowUs = getTimeNowUs();
efitick_t nowUs = getTimeNowUs();
eventCounter++;
lastActivityTimeUs = nowUs;
addWaveChartEvent(name, WC_DOWN);
uint64_t width = nowUs - widthEventTimeUs;
efitick_t width = nowUs - widthEventTimeUs;
last_wave_high_widthUs = width;
int revolutionCounter = getRevolutionCounter();
@ -145,7 +145,7 @@ static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index
if (index != 0) {
return;
}
uint64_t nowUs = getTimeNowUs();
efitick_t nowUs = getTimeNowUs();
engineCycleDurationUs = nowUs - previousEngineCycleTimeUs;
previousEngineCycleTimeUs = nowUs;
}

View File

@ -18,8 +18,8 @@ EXTERN_ENGINE
static Logging *logger;
static uint64_t lastSignalTimeNt = 0;
static uint64_t vssDiff = 0;
static efitick_t lastSignalTimeNt = 0;
static efitick_t vssDiff = 0;
static int vssCounter = 0;
/**
@ -35,7 +35,7 @@ float getVehicleSpeed(void) {
static void vsAnaWidthCallback(void) {
vssCounter++;
uint64_t nowNt = getTimeNowNt();
efitick_t nowNt = getTimeNowNt();
vssDiff = nowNt - lastSignalTimeNt;
lastSignalTimeNt = nowNt;
}

View File

@ -2797,10 +2797,10 @@
<name>$PROJ_DIR$\..\hw_layer\vehicle_speed.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\hw_layer\wave_analyzer_hw.cpp</name>
<name>$PROJ_DIR$\..\hw_layer\digital_input_hw.cpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\hw_layer\wave_analyzer_hw.h</name>
<name>$PROJ_DIR$\..\hw_layer\digital_input_hw.h</name>
</file>
</group>
<group>