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); injectorLagMs = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER);
} }
void Engine::onTriggerEvent(uint64_t nowNt) { void Engine::onTriggerEvent(efitick_t nowNt) {
isSpinning = true; isSpinning = true;
lastTriggerEventTimeNt = nowNt; lastTriggerEventTimeNt = nowNt;
} }

View File

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

View File

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

View File

@ -6,11 +6,16 @@
#include "error_handling.h" #include "error_handling.h"
#include "map.h" #include "map.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "digital_input_hw.h"
#endif
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
EXTERN_ENGINE; EXTERN_ENGINE;
static FastInterpolation customMap; static FastInterpolation customMap;
static efitick_t digitalMapDiff = 0;
/** /**
* @brief MAP value decoded for a 1.83 Honda sensor * @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); mapDecoder = getDecoder(engineConfiguration->map.sensor.type);
} }
static void digitalMapWidthCallback(void) {
}
void initMapDecoder(DECLARE_ENGINE_PARAMETER_F) { void initMapDecoder(DECLARE_ENGINE_PARAMETER_F) {
applyConfiguration(PASS_ENGINE_PARAMETER_F); applyConfiguration(PASS_ENGINE_PARAMETER_F);
//engine->configurationListeners.registerCallback(applyConfiguration); //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) { 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 * @return true if there was a full shaft revolution within the last second
*/ */
bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_F) { bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_F) {
uint64_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (engine->stopEngineRequestTimeNt != 0) { if (engine->stopEngineRequestTimeNt != 0) {
if (nowNt - engine->stopEngineRequestTimeNt < 3 * US2NT(US_PER_SECOND_LL)) { if (nowNt - engine->stopEngineRequestTimeNt < 3 * US2NT(US_PER_SECOND_LL)) {
return false; return false;
@ -138,7 +138,7 @@ bool isCranking(void) {
*/ */
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S) { void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S) {
RpmCalculator *rpmState = &engine->rpmCalculator; RpmCalculator *rpmState = &engine->rpmCalculator;
uint64_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
engine->m.beforeRpmCb = GET_TIMESTAMP(); engine->m.beforeRpmCb = GET_TIMESTAMP();
#if EFI_PROD_CODE #if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2z"); efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2z");

View File

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

View File

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

View File

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