auto-sync

This commit is contained in:
rusEfi 2015-01-14 20:03:44 -06:00
parent d4bc784329
commit 93d4e5c5c6
9 changed files with 25 additions and 26 deletions

View File

@ -378,7 +378,7 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) {
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__) #if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
if (engineConfiguration->isMapAveragingEnabled) { if (engineConfiguration->isMapAveragingEnabled) {
initMapAveraging(engine); initMapAveraging(sharedLogger, engine);
} }
#endif /* EFI_MAP_AVERAGING */ #endif /* EFI_MAP_AVERAGING */

View File

@ -39,7 +39,7 @@
#define FAST_MAP_CHART_SKIP_FACTOR 16 #define FAST_MAP_CHART_SKIP_FACTOR 16
static LoggingWithStorage logger; static Logging *logger;
/** /**
* Running counter of measurements per revolution * Running counter of measurements per revolution
@ -153,7 +153,7 @@ static void mapAveragingCallback(trigger_event_e ckpEventType, uint32_t index DE
} }
static void showMapStats(void) { static void showMapStats(void) {
scheduleMsg(&logger, "per revolution %d", perRevolution); scheduleMsg(logger, "per revolution %d", perRevolution);
} }
float getMapVoltage(void) { float getMapVoltage(void) {
@ -170,8 +170,8 @@ float getMap(void) {
return getMapByVoltage(v_averagedMapValue); return getMapByVoltage(v_averagedMapValue);
} }
void initMapAveraging(Engine *engine) { void initMapAveraging(Logging *sharedLogger, Engine *engine) {
initLogging(&logger, "Map Averaging"); logger = sharedLogger;
startTimer[0].name = "map start0"; startTimer[0].name = "map start0";
startTimer[1].name = "map start1"; startTimer[1].name = "map start1";

View File

@ -13,7 +13,7 @@
#if HAL_USE_ADC || defined(__DOXYGEN__) #if HAL_USE_ADC || defined(__DOXYGEN__)
void mapAveragingCallback(adcsample_t newValue); void mapAveragingCallback(adcsample_t newValue);
void initMapAveraging(Engine *engine); void initMapAveraging(Logging *sharedLogger, Engine *engine);
#endif #endif

View File

@ -37,7 +37,7 @@ extern WaveChart waveChart;
EXTERN_ENGINE; EXTERN_ENGINE;
static LoggingWithStorage logger; static Logging * logger;
RpmCalculator::RpmCalculator() { RpmCalculator::RpmCalculator() {
#if !EFI_PROD_CODE #if !EFI_PROD_CODE
@ -223,7 +223,6 @@ float getCrankshaftAngleNt(uint64_t timeNt DECLARE_ENGINE_PARAMETER_S) {
void initRpmCalculator(Engine *engine) { void initRpmCalculator(Engine *engine) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
initLogging(&logger, "rpm calc");
tdcScheduler[0].name = "tdc0"; tdcScheduler[0].name = "tdc0";
tdcScheduler[1].name = "tdc1"; tdcScheduler[1].name = "tdc1";

View File

@ -50,9 +50,7 @@ bool printGapRatio = false;
float actualSynchGap; float actualSynchGap;
#endif /* ! EFI_PROD_CODE */ #endif /* ! EFI_PROD_CODE */
#if (EFI_PROD_CODE || EFI_SIMULATOR) static Logging * logger;
static LoggingWithStorage logger;
#endif
/** /**
* @return TRUE is something is wrong with trigger decoding * @return TRUE is something is wrong with trigger decoding
@ -170,7 +168,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
float gap = 1.0 * currentDuration / toothed_previous_duration; float gap = 1.0 * currentDuration / toothed_previous_duration;
#if EFI_PROD_CODE #if EFI_PROD_CODE
scheduleMsg(&logger, "gap=%f @ %d", gap, current_index); scheduleMsg(logger, "gap=%f @ %d", gap, current_index);
#else #else
actualSynchGap = gap; actualSynchGap = gap;
print("current gap %f\r\n", gap); print("current gap %f\r\n", gap);
@ -198,7 +196,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
totalTriggerErrorCounter++; totalTriggerErrorCounter++;
if (engineConfiguration->isPrintTriggerSynchDetails) { if (engineConfiguration->isPrintTriggerSynchDetails) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
scheduleMsg(&logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d", current_index, scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d", current_index,
TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]),
TRIGGER_SHAPE(expectedEventCount[2]), eventCount[0], eventCount[1], eventCount[2]); TRIGGER_SHAPE(expectedEventCount[2]), eventCount[0], eventCount[1], eventCount[2]);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -444,10 +442,8 @@ uint32_t findTriggerZeroEventIndex(TriggerShape * shape, trigger_config_s const*
//static Logging logger; //static Logging logger;
#endif #endif
void initTriggerDecoderLogger(void) { void initTriggerDecoderLogger(Logging *sharedLogger) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) logger = sharedLogger;
initLogging(&logger, "trigger decoder");
#endif
} }
void initTriggerDecoder(void) { void initTriggerDecoder(void) {

View File

@ -90,7 +90,7 @@ class Engine;
void initializeTriggerShape(Logging *logger, engine_configuration_s const *engineConfiguration, Engine *engine); void initializeTriggerShape(Logging *logger, engine_configuration_s const *engineConfiguration, Engine *engine);
void initTriggerDecoder(void); void initTriggerDecoder(void);
void initTriggerDecoderLogger(void); void initTriggerDecoderLogger(Logging *sharedLogger);
bool_t isTriggerDecoderError(void); bool_t isTriggerDecoderError(void);

View File

@ -184,7 +184,7 @@ void initHardware(Logging *l, Engine *engine) {
* which would be used while finding trigger synch index * which would be used while finding trigger synch index
* while config read * while config read
*/ */
initTriggerDecoderLogger(); initTriggerDecoderLogger(sharedLogger);
/** /**
* We need the LED_ERROR pin even before we read configuration * We need the LED_ERROR pin even before we read configuration

View File

@ -253,7 +253,7 @@ void firmwareError(const char *fmt, ...) {
} }
} }
static char UNUSED_RAM_SIZE[5500]; static char UNUSED_RAM_SIZE[6000];
static char UNUSED_CCM_SIZE[8000] CCM_OPTIONAL; static char UNUSED_CCM_SIZE[8000] CCM_OPTIONAL;

View File

@ -41,6 +41,8 @@ bool isInsideTriggerHandler;
persistent_config_container_s persistentState; persistent_config_container_s persistentState;
static engine_configuration2_s ec2; static engine_configuration2_s ec2;
static LoggingWithStorage sharedLogger;
engine_configuration_s * engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration; engine_configuration_s * engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc; board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
engine_configuration2_s *engineConfiguration2 = &ec2; engine_configuration2_s *engineConfiguration2 = &ec2;
@ -48,9 +50,9 @@ engine_configuration2_s *engineConfiguration2 = &ec2;
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) { void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode) {
} }
int isInjectionEnabled(void) { //int isInjectionEnabled(void) {
return TRUE; // return true;
} //}
int getRemainingStack(Thread *otp) { int getRemainingStack(Thread *otp) {
return 99999; return 99999;
@ -68,6 +70,8 @@ void rusEfiFunctionalTest(void) {
initFakeBoard(); initFakeBoard();
initLogging(&sharedLogger, "simulator");
initStatusLoop(engine); initStatusLoop(engine);
initDataStructures(PASS_ENGINE_PARAMETER_F); initDataStructures(PASS_ENGINE_PARAMETER_F);
@ -84,14 +88,14 @@ void rusEfiFunctionalTest(void) {
initAnalogChart(); initAnalogChart();
initTriggerEmulator(engine); initTriggerEmulator(&sharedLogger, engine);
initMainEventListener(engine); initMainEventListener(&sharedLogger, engine);
initTriggerCentral(engine); initTriggerCentral(engine);
startStatusThreads(engine); startStatusThreads(engine);
startTunerStudioConnectivity(); startTunerStudioConnectivity(&sharedLogger);
} }
void printPendingMessages(void) { void printPendingMessages(void) {