auto-sync

This commit is contained in:
rusEfi 2014-11-11 16:03:38 -06:00
parent 00add33207
commit 36b5bc9e1a
10 changed files with 35 additions and 16 deletions

View File

@ -3,10 +3,11 @@
#include "interpolation.h"
#include "boards.h"
#include "adc_inputs.h"
#include "engine.h"
extern engine_configuration_s *engineConfiguration;
EXTERN_ENGINE;
float getAfr(void) {
float getAfr(DECLARE_ENGINE_PARAMETER_F) {
afr_sensor_s * sensor = &engineConfiguration->afrSensor;
float volts = getVoltageDivided(sensor->afrAdcChannel);

View File

@ -14,7 +14,7 @@
#include "rusefi_enums.h"
#include "engine_configuration.h"
float getAfr(void);
float getAfr(DECLARE_ENGINE_PARAMETER_F);
void initEgoSensor(afr_sensor_s *sensor, ego_sensor_e type);
#endif

View File

@ -1,11 +1,11 @@
#include "main.h"
#include "boards.h"
#include "engine_configuration.h"
#include "engine.h"
#include "adc_inputs.h"
#include "maf.h"
extern engine_configuration_s *engineConfiguration;
EXTERN_ENGINE;
float getMaf(void) {
float getMaf(DECLARE_ENGINE_PARAMETER_F) {
return getMafT(engineConfiguration);
}

View File

@ -1,10 +1,10 @@
CONTROLLERS_SENSORS_SRC = \
$(PROJECT_DIR)/controllers/sensors/maf.c \
$(PROJECT_DIR)/controllers/sensors/voltage.c
CONTROLLERS_SENSORS_SRC =
CONTROLLERS_SENSORS_SRC_CPP = $(PROJECT_DIR)/controllers/sensors/thermistors.cpp \
$(PROJECT_DIR)/controllers/sensors/allsensors.cpp \
$(PROJECT_DIR)/controllers/sensors/map.cpp \
$(PROJECT_DIR)/controllers/sensors/voltage.cpp \
$(PROJECT_DIR)/controllers/sensors/maf.cpp \
$(PROJECT_DIR)/controllers/sensors/tps.cpp \
$(PROJECT_DIR)/controllers/sensors/ego.cpp

View File

@ -78,7 +78,7 @@ static cyclic_buffer ignitionErrorDetection;
static Logging logger;
static INLINE void handleFuelInjectionEvent(ActuatorEvent *event, int rpm DECLATE_ENGINE_PARAMETER) {
static ALWAYS_INLINE void handleFuelInjectionEvent(ActuatorEvent *event, int rpm DECLATE_ENGINE_PARAMETER) {
/**
* todo: we do not really need to calculate fuel for each individual cylinder
*/
@ -103,7 +103,7 @@ static INLINE void handleFuelInjectionEvent(ActuatorEvent *event, int rpm DECLAT
scheduleOutput(event->actuator, delay, fuelMs);
}
static INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAMETER) {
static ALWAYS_INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAMETER) {
if (!isInjectionEnabled(engine->engineConfiguration))
return;
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
@ -134,7 +134,7 @@ static INLINE void handleFuel(uint32_t eventIndex, int rpm DECLATE_ENGINE_PARAME
}
}
static INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *iEvent, int rpm DECLATE_ENGINE_PARAMETER) {
static ALWAYS_INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *iEvent, int rpm DECLATE_ENGINE_PARAMETER) {
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
float dwellMs = getSparkDwellMsT(rpm PASS_ENGINE_PARAMETER);
@ -197,7 +197,7 @@ static INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *iEvent,
}
}
static INLINE void handleSpark(uint32_t eventIndex, int rpm, IgnitionEventList *list DECLATE_ENGINE_PARAMETER) {
static ALWAYS_INLINE void handleSpark(uint32_t eventIndex, int rpm, IgnitionEventList *list DECLATE_ENGINE_PARAMETER) {
if (!isValidRpm(rpm) || !engine->engineConfiguration->isIgnitionEnabled)
return; // this might happen for instance in case of a single trigger event after a pause

View File

@ -14,9 +14,14 @@
// this is about MISRA not liking 'time.h'. todo: figure out something
#if defined __GNUC__
// GCC
#include <sys/types.h>
#define ALWAYS_INLINE __attribute__((always_inline))
#else
// IAR
typedef unsigned int time_t;
// todo: what's the IAR option?
#define ALWAYS_INLINE INLINE
#endif
#include "efifeatures.h"
@ -67,6 +72,8 @@ typedef Thread thread_t;
#define EXTERN_ENGINE extern Engine *engine; \
extern engine_configuration_s *engineConfiguration;
#define DECLARE_ENGINE_PARAMETER_F void
#define DECLARE_ENGINE_PARAMETER_S
#define DECLATE_ENGINE_PARAMETER
#define PASS_ENGINE_PARAMETER

View File

@ -1,5 +1,5 @@
// This file was generated by Version2Header
// Mon Nov 10 13:43:19 EST 2014
// Tue Nov 11 16:09:04 EST 2014
#ifndef VCS_VERSION
#define VCS_VERSION "5261"
#define VCS_VERSION "5296"
#endif

View File

@ -16,6 +16,8 @@
#define US_TO_NT_MULTIPLIER 100
#define ALWAYS_INLINE INLINE
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
@ -38,6 +40,8 @@ typedef void * Logging;
class Engine;
#endif
#define DECLARE_ENGINE_PARAMETER_F Engine *engine, engine_configuration_s *engineConfiguration
#define DECLARE_ENGINE_PARAMETER_S Engine *engine, engine_configuration_s *engineConfiguration
#define DECLATE_ENGINE_PARAMETER , Engine *engine, engine_configuration_s *engineConfiguration
#define PASS_ENGINE_PARAMETER , engine, engineConfiguration

View File

@ -153,7 +153,10 @@ static ActuatorEventList ae;
void testAngleResolver(void) {
printf("*************************************************** testAngleResolver\r\n");
Engine *engine = NULL;
EngineTestHelper eth(FORD_ASPIRE_1996);
Engine *engine = &eth.engine;
engine_configuration_s *engineConfiguration = eth.engine.engineConfiguration;
engineConfiguration->globalTriggerAngleOffset = 175;
trigger_shape_s * ts = &engineConfiguration2->triggerShape;

View File

@ -18,6 +18,8 @@
#define US_TO_NT_MULTIPLIER 100
#define ALWAYS_INLINE INLINE
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
@ -89,5 +91,7 @@ typedef EventListener event_listener_t;
#define EXTERN_ENGINE extern Engine *engine; \
extern engine_configuration_s *engineConfiguration;
#define DECLARE_ENGINE_PARAMETER_F void
#define DECLARE_ENGINE_PARAMETER_S
#define DECLATE_ENGINE_PARAMETER
#define PASS_ENGINE_PARAMETER