auto-sync

This commit is contained in:
rusEfi 2015-04-18 19:09:49 -04:00
parent 68aa284427
commit 173bfd74c4
6 changed files with 25 additions and 4 deletions

View File

@ -5,7 +5,7 @@
*
* Coil pairs: 1-6, 2-5, 3-4
*
* Injector groups: 1,2,3 è 4,5,6
* Injector groups: 1,2,3 & 4,5,6
*
* @date Nov 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2015

View File

@ -100,6 +100,7 @@ static void startAveraging(void *arg) {
turnPinHigh(&mapAveragingPin);
}
#if EFI_PROD_CODE || defined(__DOXYGEN__)
/**
* This method is invoked from ADC callback.
* @note This method is invoked OFTEN, this method is a potential bottle-next - the implementation should be
@ -145,13 +146,16 @@ void mapAveragingCallback(adcsample_t adcValue) {
chSysUnlockFromIsr()
;
}
#endif
static void endAveraging(void *arg) {
(void) arg;
bool wasLocked = lockAnyContext();
isAveraging = false;
// with locking we would have a consistent state
#if EFI_PROD_CODE || defined(__DOXYGEN__)
v_averagedMapValue = adcToVoltsDivided(mapAccumulator / mapMeasurementsCounter);
#endif
if (!wasLocked)
chSysUnlockFromIsr()
;
@ -198,6 +202,8 @@ float getMapVoltage(void) {
return v_averagedMapValue;
}
#if EFI_PROD_CODE || defined(__DOXYGEN__)
/**
* Because of MAP window averaging, MAP is only available while engine is spinning
* @return Manifold Absolute Pressure, in kPa
@ -211,6 +217,7 @@ float getMap(void) {
return 100;
#endif
}
#endif /* EFI_PROD_CODE */
void initMapAveraging(Logging *sharedLogger, Engine *engine) {
logger = sharedLogger;
@ -226,6 +233,8 @@ void initMapAveraging(Logging *sharedLogger, Engine *engine) {
#else
#if EFI_PROD_CODE
float getMap(void) {
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
return getRawMap();
@ -233,5 +242,6 @@ float getMap(void) {
return NAN;
#endif /* EFI_ANALOG_SENSORS */
}
#endif /* EFI_PROD_CODE */
#endif /* EFI_MAP_AVERAGING */

View File

@ -10,11 +10,14 @@
#include "engine.h"
#if HAL_USE_ADC || defined(__DOXYGEN__)
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
#if EFI_PROD_CODE || defined(__DOXYGEN__)
void mapAveragingCallback(adcsample_t newValue);
void initMapAveraging(Logging *sharedLogger, Engine *engine);
#endif
void initMapAveraging(Logging *sharedLogger, Engine *engine);
#endif /* EFI_MAP_AVERAGING */
#endif /* ADC_AVERAGING_H_ */

View File

@ -134,6 +134,7 @@ CPPSRC = $(UTILSRC_CPP) \
$(ENGINES_SRC_CPP) \
$(PROJECT_DIR)/simulator/rusEfiFunctionalTest.cpp \
$(PROJECT_DIR)/simulator/framework.cpp \
$(PROJECT_DIR)/controllers/map_averaging.cpp \
$(PROJECT_DIR)/development/trigger_emulator.cpp \
simulator/boards.cpp \
$(TEST_SRC_CPP)

View File

@ -18,6 +18,8 @@
#define EFI_SIMULATOR TRUE
#define EFI_MAP_AVERAGING TRUE
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE

View File

@ -28,6 +28,7 @@
#include "tunerstudio.h"
#include "trigger_emulator.h"
#include "engine_controller.h"
#include "map_averaging.h"
EXTERN_ENGINE;
extern engine_configuration2_s * engineConfiguration2;
@ -94,6 +95,10 @@ void rusEfiFunctionalTest(void) {
initTriggerEmulator(&sharedLogger, engine);
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
initMapAveraging(&sharedLogger, engine);
#endif /* EFI_MAP_AVERAGING */
initMainEventListener(&sharedLogger, engine);
initTriggerCentral(&sharedLogger, engine);