auto-sync
This commit is contained in:
parent
486fa92451
commit
3991db4f01
|
@ -157,12 +157,12 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg, const cha
|
||||||
int beforeCallback = hal_lld_get_counter_value();
|
int beforeCallback = hal_lld_get_counter_value();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t nowUs = getTimeNowUs();
|
uint64_t nowNt = getTimeNowNt();
|
||||||
|
|
||||||
bool alreadyLocked = lockOutputBuffer(); // we have multiple threads writing to the same output buffer
|
bool alreadyLocked = lockOutputBuffer(); // we have multiple threads writing to the same output buffer
|
||||||
|
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
startTimeNt = US2NT(nowUs);
|
startTimeNt = nowNt;
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
|
@ -172,8 +172,11 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg, const cha
|
||||||
/**
|
/**
|
||||||
* todo: migrate to binary fractions in order to eliminate
|
* todo: migrate to binary fractions in order to eliminate
|
||||||
* this division? I do not like division
|
* this division? I do not like division
|
||||||
|
*
|
||||||
|
* at least that's 32 bit division now
|
||||||
*/
|
*/
|
||||||
uint64_t time100 = (nowUs - NT2US(startTimeNt)) / 10;
|
uint32_t diffNt = nowNt - startTimeNt;
|
||||||
|
uint32_t time100 = diffNt / 10 / 168;
|
||||||
|
|
||||||
|
|
||||||
if (remainingSize(&logging) > 30) {
|
if (remainingSize(&logging) > 30) {
|
||||||
|
|
|
@ -76,6 +76,9 @@ static cyclic_buffer ignitionErrorDetection;
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
|
|
||||||
static void handleFuelInjectionEvent(MainTriggerCallback *mainTriggerCallback, ActuatorEvent *event, int rpm) {
|
static void handleFuelInjectionEvent(MainTriggerCallback *mainTriggerCallback, ActuatorEvent *event, int rpm) {
|
||||||
|
/**
|
||||||
|
* todo: we do not really need to calculate fuel for each individual cylinder
|
||||||
|
*/
|
||||||
float fuelMs = getFuelMs(rpm, mainTriggerCallback->engine)
|
float fuelMs = getFuelMs(rpm, mainTriggerCallback->engine)
|
||||||
* mainTriggerCallback->engineConfiguration->globalFuelCorrection;
|
* mainTriggerCallback->engineConfiguration->globalFuelCorrection;
|
||||||
if (cisnan(fuelMs)) {
|
if (cisnan(fuelMs)) {
|
||||||
|
@ -301,7 +304,6 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
|
||||||
|
|
||||||
triggerEventsQueue.executeAll(getCrankEventCounter());
|
triggerEventsQueue.executeAll(getCrankEventCounter());
|
||||||
|
|
||||||
//todo handleFuel(mainTriggerCallback->engine, mainTriggerCallback, eventIndex, rpm);
|
|
||||||
handleFuel(&engine, mainTriggerCallback, eventIndex, rpm);
|
handleFuel(&engine, mainTriggerCallback, eventIndex, rpm);
|
||||||
handleSpark(mainTriggerCallback, eventIndex, rpm,
|
handleSpark(mainTriggerCallback, eventIndex, rpm,
|
||||||
&mainTriggerCallback->engineConfiguration2->engineEventConfiguration.ignitionEvents[revolutionIndex]);
|
&mainTriggerCallback->engineConfiguration2->engineEventConfiguration.ignitionEvents[revolutionIndex]);
|
||||||
|
|
Loading…
Reference in New Issue