auto-sync
This commit is contained in:
parent
fd7e327574
commit
19c4f82dc6
|
@ -66,7 +66,7 @@ static bool intermediateLoggingBufferInited = FALSE;
|
|||
/**
|
||||
* @returns true if data does not fit into this buffer
|
||||
*/
|
||||
static bool validateBuffer(Logging *logging, uint32_t extraLen, const char *text) {
|
||||
static bool validateBuffer(Logging *logging, uint32_t extraLen) {
|
||||
if (logging->buffer == NULL) {
|
||||
firmwareError("Logging not initialized: %s", logging->name);
|
||||
return true;
|
||||
|
@ -74,13 +74,6 @@ static bool validateBuffer(Logging *logging, uint32_t extraLen, const char *text
|
|||
|
||||
if (remainingSize(logging) < extraLen + 1) {
|
||||
warning(OBD_PCM_Processor_Fault, "buffer overflow %s", logging->name);
|
||||
// strcpy(logging->SMALL_BUFFER, "Logging buffer overflow: ");
|
||||
// strcat(logging->SMALL_BUFFER, logging->name);
|
||||
// strcat(logging->SMALL_BUFFER, "/");
|
||||
// strcat(logging->SMALL_BUFFER, text);
|
||||
// firmwareError(logging->SMALL_BUFFER);
|
||||
// unlockOutputBuffer();
|
||||
// resetLogging(logging);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -89,7 +82,7 @@ static bool validateBuffer(Logging *logging, uint32_t extraLen, const char *text
|
|||
void append(Logging *logging, const char *text) {
|
||||
efiAssertVoid(text != NULL, "append NULL");
|
||||
uint32_t extraLen = efiStrlen(text);
|
||||
int isError = validateBuffer(logging, extraLen, text);
|
||||
int isError = validateBuffer(logging, extraLen);
|
||||
if (isError) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ typedef struct {
|
|||
/**
|
||||
* That's trigger event index
|
||||
*/
|
||||
int eventIndex;
|
||||
uint32_t eventIndex;
|
||||
float eventAngle;
|
||||
/**
|
||||
* Angle offset from the trigger event
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
};
|
||||
void initMainEventListener(Engine *engine, engine_configuration2_s *engineConfiguration2);
|
||||
void onTriggerEvent(trigger_event_e ckpSignalType, int eventIndex, MainTriggerCallback *mainTriggerCallback);
|
||||
void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTriggerCallback *mainTriggerCallback);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ private:
|
|||
#if EFI_WAVE_CHART
|
||||
Logging logging;
|
||||
#endif /* EFI_WAVE_CHART */
|
||||
int counter;
|
||||
uint32_t counter;
|
||||
uint64_t startTime100;
|
||||
uint64_t startTimeUs;
|
||||
volatile int isInitialized;
|
||||
|
|
|
@ -196,7 +196,7 @@ static void fuelPumpOff(void *arg) {
|
|||
turnOutputPinOff(FUEL_PUMP_RELAY);
|
||||
}
|
||||
|
||||
static void fuelPumpOn(trigger_event_e signal, int index, void *arg) {
|
||||
static void fuelPumpOn(trigger_event_e signal, uint32_t index, void *arg) {
|
||||
if (index != 0)
|
||||
return; // let's not abuse the timer - one time per revolution would be enough
|
||||
// todo: the check about GPIO_NONE should be somewhere else!
|
||||
|
|
|
@ -122,7 +122,7 @@ static void endAveraging(void *arg) {
|
|||
/**
|
||||
* Shaft Position callback used to schedule start and end of MAP averaging
|
||||
*/
|
||||
static void shaftPositionCallback(trigger_event_e ckpEventType, int index, void *arg) {
|
||||
static void shaftPositionCallback(trigger_event_e ckpEventType, uint32_t index, void *arg) {
|
||||
// this callback is invoked on interrupt thread
|
||||
|
||||
if (index != 0)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
// return interpolate(500, 0.5, 5000, 1.1, rpm);
|
||||
//}
|
||||
|
||||
|
||||
/**
|
||||
* @return number of milliseconds in one crankshaft revolution
|
||||
*/
|
||||
|
@ -102,7 +101,8 @@ int isCrankingRT(engine_configuration_s *engineConfiguration, int rpm) {
|
|||
return rpm > 0 && rpm < engineConfiguration->crankingSettings.crankingRpm;
|
||||
}
|
||||
|
||||
OutputSignalList injectonSignals CCM_OPTIONAL;
|
||||
OutputSignalList injectonSignals CCM_OPTIONAL
|
||||
;
|
||||
|
||||
static void registerSparkEvent(engine_configuration_s const *engineConfiguration, trigger_shape_s * s,
|
||||
IgnitionEventList *list, io_pin_e pin, float localAdvance, float dwell) {
|
||||
|
@ -131,8 +131,8 @@ void initializeIgnitionActions(float advance, float dwellAngle, engine_configura
|
|||
// todo: extract method
|
||||
float localAdvance = advance + 720.0f * i / engineConfiguration->cylindersCount;
|
||||
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list,
|
||||
SPARKOUT_1_OUTPUT, localAdvance, dwellAngle);
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list, SPARKOUT_1_OUTPUT,
|
||||
localAdvance, dwellAngle);
|
||||
}
|
||||
break;
|
||||
case IM_WASTED_SPARK:
|
||||
|
@ -144,8 +144,8 @@ void initializeIgnitionActions(float advance, float dwellAngle, engine_configura
|
|||
int id = getCylinderId(engineConfiguration->firingOrder, wastedIndex) - 1;
|
||||
io_pin_e ioPin = (io_pin_e) (SPARKOUT_1_OUTPUT + id);
|
||||
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list,
|
||||
ioPin, localAdvance, dwellAngle);
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list, ioPin, localAdvance,
|
||||
dwellAngle);
|
||||
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,8 @@ void initializeIgnitionActions(float advance, float dwellAngle, engine_configura
|
|||
float localAdvance = advance + 720.0f * i / engineConfiguration->cylindersCount;
|
||||
|
||||
io_pin_e pin = (io_pin_e) ((int) SPARKOUT_1_OUTPUT + getCylinderId(engineConfiguration->firingOrder, i) - 1);
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list, pin,
|
||||
localAdvance, dwellAngle);
|
||||
registerSparkEvent(engineConfiguration, &engineConfiguration2->triggerShape, list, pin, localAdvance,
|
||||
dwellAngle);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -165,12 +165,8 @@ void initializeIgnitionActions(float advance, float dwellAngle, engine_configura
|
|||
}
|
||||
}
|
||||
|
||||
static void registerInjectionEvent(engine_configuration_s const *e,
|
||||
trigger_shape_s *s,
|
||||
ActuatorEventList *list,
|
||||
io_pin_e pin,
|
||||
float angle
|
||||
) {
|
||||
static void registerInjectionEvent(engine_configuration_s const *e, trigger_shape_s *s, ActuatorEventList *list,
|
||||
io_pin_e pin, float angle) {
|
||||
registerActuatorEventExt(e, s, list->getNextActuatorEvent(), injectonSignals.add(pin), angle);
|
||||
}
|
||||
|
||||
|
@ -252,9 +248,9 @@ void findTriggerPosition(engine_configuration_s const *engineConfiguration, trig
|
|||
|
||||
int engineCycleEventCount = getEngineCycleEventCount(engineConfiguration, s);
|
||||
|
||||
int middle;
|
||||
int left = 0;
|
||||
int right = engineCycleEventCount - 1;
|
||||
uint32_t middle;
|
||||
uint32_t left = 0;
|
||||
uint32_t right = engineCycleEventCount - 1;
|
||||
|
||||
/**
|
||||
* Let's find the last trigger angle which is less or equal to the desired angle
|
||||
|
@ -265,7 +261,7 @@ void findTriggerPosition(engine_configuration_s const *engineConfiguration, trig
|
|||
|
||||
if (middle == left) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (angleOffset < s->eventAngles[middle]) {
|
||||
right = middle;
|
||||
|
@ -294,9 +290,9 @@ void registerActuatorEventExt(engine_configuration_s const *engineConfiguration,
|
|||
efiAssertVoid(s->getSize() > 0, "uninitialized trigger_shape_s");
|
||||
|
||||
if (e == NULL) {
|
||||
// error already reported
|
||||
// error already reported
|
||||
return;
|
||||
}
|
||||
}
|
||||
e->actuator = actuator;
|
||||
|
||||
findTriggerPosition(engineConfiguration, s, &e->position, angleOffset);
|
||||
|
@ -306,7 +302,7 @@ static int order_1_THEN_3_THEN_4_THEN2[] = { 1, 3, 4, 2 };
|
|||
|
||||
static int order_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4[] = { 1, 5, 3, 6, 2, 4 };
|
||||
|
||||
static int order_1_8_4_3_6_5_7_2[] = {1, 8, 4, 3, 6, 5, 7, 2};
|
||||
static int order_1_8_4_3_6_5_7_2[] = { 1, 8, 4, 3, 6, 5, 7, 2 };
|
||||
|
||||
/**
|
||||
* @param index from zero to cylindersCount - 1
|
||||
|
|
|
@ -95,7 +95,7 @@ static void handleFuelInjectionEvent(MainTriggerCallback *mainTriggerCallback, A
|
|||
scheduleOutput(event->actuator, delay, fuelMs);
|
||||
}
|
||||
|
||||
static void handleFuel(Engine *engine, MainTriggerCallback *mainTriggerCallback, int eventIndex, int rpm) {
|
||||
static void handleFuel(Engine *engine, MainTriggerCallback *mainTriggerCallback, uint32_t eventIndex, int rpm) {
|
||||
if (!isInjectionEnabled(mainTriggerCallback->engineConfiguration))
|
||||
return;
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 16, "stack#3");
|
||||
|
@ -230,7 +230,7 @@ extern Engine engine;
|
|||
* This is the main trigger event handler.
|
||||
* Both injection and ignition are controlled from this method.
|
||||
*/
|
||||
void onTriggerEvent(trigger_event_e ckpSignalType, int eventIndex, MainTriggerCallback *mainTriggerCallback) {
|
||||
void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTriggerCallback *mainTriggerCallback) {
|
||||
efiAssertVoid(eventIndex < 2 * mainTriggerCallback->engineConfiguration2->triggerShape.shaftPositionEventCount,
|
||||
"event index");
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 16, "stack#3");
|
||||
|
|
|
@ -96,7 +96,7 @@ bool isCranking(void) {
|
|||
* updated here.
|
||||
* This callback is invoked on interrupt thread.
|
||||
*/
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, int index, RpmCalculator *rpmState) {
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, RpmCalculator *rpmState) {
|
||||
|
||||
if (index != 0) {
|
||||
#if EFI_ANALOG_CHART || defined(__DOXYGEN__)
|
||||
|
@ -151,7 +151,7 @@ static void onTdcCallback(void) {
|
|||
/**
|
||||
* This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
|
||||
*/
|
||||
static void tdcMarkCallback(trigger_event_e ckpSignalType, int index0, void *arg) {
|
||||
static void tdcMarkCallback(trigger_event_e ckpSignalType, uint32_t index0, void *arg) {
|
||||
bool isTriggerSynchronizationPoint = index0 == 0;
|
||||
if (isTriggerSynchronizationPoint) {
|
||||
int revIndex2 = getRevolutionCounter() % 2;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
* @brief Current RPM
|
||||
*/
|
||||
int getRpmE(Engine *engine);
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, int index, RpmCalculator *rpmState);
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, RpmCalculator *rpmState);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "listener_array.h"
|
||||
#include "trigger_decoder.h"
|
||||
|
||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, int index, void *arg);
|
||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, void *arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "ec2.h"
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
* TODO this should be migrated to CRANKshaft revolution, this would go together
|
||||
* TODO with eliminating RPM_MULT magic constant
|
||||
*/
|
||||
int shaftPositionEventCount;
|
||||
uint32_t shaftPositionEventCount;
|
||||
|
||||
/**
|
||||
* this one is per CRANKshaft revolution
|
||||
|
|
|
@ -137,7 +137,7 @@ static void initWave(const char *name, int index) {
|
|||
}
|
||||
#endif
|
||||
|
||||
static void waTriggerEventListener(trigger_event_e ckpSignalType, int index, void *arg) {
|
||||
static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index, void *arg) {
|
||||
if (index != 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -235,5 +235,5 @@ void firmwareError(const char *fmt, ...) {
|
|||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 20140920;
|
||||
return 20140924;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue