less broken code?
This commit is contained in:
parent
e7d7d79f13
commit
e766279b5b
|
@ -47,13 +47,13 @@ static volatile bool ToothLoggerEnabled = false;
|
||||||
static volatile bool firstBuffer = true;
|
static volatile bool firstBuffer = true;
|
||||||
static uint32_t lastEdgeTimestamp = 0;
|
static uint32_t lastEdgeTimestamp = 0;
|
||||||
|
|
||||||
static bool trigger1 = false;
|
static bool currentTrigger1 = false;
|
||||||
static bool trigger2 = false;
|
static bool currentTrigger2 = false;
|
||||||
static bool trigger = false;
|
static bool currentTdc = false;
|
||||||
// any coil, all coils thrown together
|
// any coil, all coils thrown together
|
||||||
static bool coil = false;
|
static bool currentCoilState = false;
|
||||||
// same about injectors
|
// same about injectors
|
||||||
static bool injector = false;
|
static bool currentInjectorState = false;
|
||||||
|
|
||||||
int getCompositeRecordCount() {
|
int getCompositeRecordCount() {
|
||||||
return NextIdx;
|
return NextIdx;
|
||||||
|
@ -78,18 +78,17 @@ int copyCompositeEvents(CompositeEvent *events) {
|
||||||
|
|
||||||
#endif // EFI_UNIT_TEST
|
#endif // EFI_UNIT_TEST
|
||||||
|
|
||||||
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
|
static void SetNextCompositeEntry(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
bool trigger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|
||||||
uint32_t nowUs = NT2US(timestamp);
|
uint32_t nowUs = NT2US(timestamp);
|
||||||
|
|
||||||
// TS uses big endian, grumble
|
// TS uses big endian, grumble
|
||||||
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
|
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
|
||||||
buffer[NextIdx].priLevel = trigger1;
|
buffer[NextIdx].priLevel = currentTrigger1;
|
||||||
buffer[NextIdx].secLevel = trigger2;
|
buffer[NextIdx].secLevel = currentTrigger2;
|
||||||
buffer[NextIdx].trigger = trigger;
|
buffer[NextIdx].trigger = currentTdc;
|
||||||
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
|
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
|
||||||
buffer[NextIdx].coil = coil;
|
buffer[NextIdx].coil = currentCoilState;
|
||||||
buffer[NextIdx].injector = injector;
|
buffer[NextIdx].injector = currentInjectorState;
|
||||||
|
|
||||||
NextIdx++;
|
NextIdx++;
|
||||||
|
|
||||||
|
@ -146,26 +145,22 @@ void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_P
|
||||||
|
|
||||||
switch (tooth) {
|
switch (tooth) {
|
||||||
case SHAFT_PRIMARY_FALLING:
|
case SHAFT_PRIMARY_FALLING:
|
||||||
trigger1 = false;
|
currentTrigger1 = false;
|
||||||
trigger = false;
|
|
||||||
break;
|
break;
|
||||||
case SHAFT_PRIMARY_RISING:
|
case SHAFT_PRIMARY_RISING:
|
||||||
trigger1 = true;
|
currentTrigger1 = true;
|
||||||
trigger = false;
|
|
||||||
break;
|
break;
|
||||||
case SHAFT_SECONDARY_FALLING:
|
case SHAFT_SECONDARY_FALLING:
|
||||||
trigger2 = false;
|
currentTrigger2 = false;
|
||||||
trigger = true;
|
|
||||||
break;
|
break;
|
||||||
case SHAFT_SECONDARY_RISING:
|
case SHAFT_SECONDARY_RISING:
|
||||||
trigger2 = true;
|
currentTrigger2 = true;
|
||||||
trigger = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetNextCompositeEntry(timestamp, trigger1, trigger2, trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
SetNextCompositeEntry(timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
@ -173,16 +168,17 @@ void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX
|
||||||
if (!ToothLoggerEnabled) {
|
if (!ToothLoggerEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UNUSED(timestamp);
|
currentTdc = true;
|
||||||
//SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
|
SetNextCompositeEntry(timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
//SetNextCompositeEntry(timestamp + 10, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
|
currentTdc = false;
|
||||||
|
SetNextCompositeEntry(timestamp + 10 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
if (!ToothLoggerEnabled) {
|
if (!ToothLoggerEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
coil = state;
|
currentCoilState = state;
|
||||||
UNUSED(timestamp);
|
UNUSED(timestamp);
|
||||||
//SetNextCompositeEntry(timestamp, trigger1, trigger2, trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
//SetNextCompositeEntry(timestamp, trigger1, trigger2, trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +187,7 @@ void LogTriggerInjectorState(efitick_t timestamp, bool state DECLARE_ENGINE_PARA
|
||||||
if (!ToothLoggerEnabled) {
|
if (!ToothLoggerEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
injector = state;
|
currentInjectorState = state;
|
||||||
UNUSED(timestamp);
|
UNUSED(timestamp);
|
||||||
//SetNextCompositeEntry(timestamp, trigger1, trigger2, trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
//SetNextCompositeEntry(timestamp, trigger1, trigger2, trigger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue