auto-sync

This commit is contained in:
rusEfi 2014-11-06 21:03:12 -06:00
parent 486fa92451
commit 3991db4f01
2 changed files with 9 additions and 4 deletions

View File

@ -157,12 +157,12 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg, const cha
int beforeCallback = hal_lld_get_counter_value();
#endif
uint64_t nowUs = getTimeNowUs();
uint64_t nowNt = getTimeNowNt();
bool alreadyLocked = lockOutputBuffer(); // we have multiple threads writing to the same output buffer
if (counter == 0) {
startTimeNt = US2NT(nowUs);
startTimeNt = nowNt;
}
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
* 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) {

View File

@ -76,6 +76,9 @@ static cyclic_buffer ignitionErrorDetection;
static Logging logger;
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)
* mainTriggerCallback->engineConfiguration->globalFuelCorrection;
if (cisnan(fuelMs)) {
@ -301,7 +304,6 @@ void onTriggerEvent(trigger_event_e ckpSignalType, uint32_t eventIndex, MainTrig
triggerEventsQueue.executeAll(getCrankEventCounter());
//todo handleFuel(mainTriggerCallback->engine, mainTriggerCallback, eventIndex, rpm);
handleFuel(&engine, mainTriggerCallback, eventIndex, rpm);
handleSpark(mainTriggerCallback, eventIndex, rpm,
&mainTriggerCallback->engineConfiguration2->engineEventConfiguration.ignitionEvents[revolutionIndex]);