multi-channel Tuner Studio tooth logger #1284
This commit is contained in:
parent
0cce98793a
commit
e32aa5266b
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#if EFI_TOOTH_LOGGER
|
#if EFI_TOOTH_LOGGER
|
||||||
|
|
||||||
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "efitime.h"
|
#include "efitime.h"
|
||||||
#include "efilib.h"
|
#include "efilib.h"
|
||||||
|
@ -48,11 +50,12 @@ static bool trigger2 = false;
|
||||||
//NextIdx++;
|
//NextIdx++;
|
||||||
|
|
||||||
|
|
||||||
static void SetNextCompositeEntry(uint32_t nowUs, bool trigger1, bool trigger2) {
|
static void SetNextCompositeEntry(uint32_t nowUs, bool trigger1, bool trigger2, bool isSync) {
|
||||||
// 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 = trigger1;
|
||||||
buffer[NextIdx].secLevel = trigger2;
|
buffer[NextIdx].secLevel = trigger2;
|
||||||
|
buffer[NextIdx].sync = isSync;
|
||||||
// todo:
|
// todo:
|
||||||
//buffer[NextIdx].sync = isSynced;
|
//buffer[NextIdx].sync = isSynced;
|
||||||
//buffer[NextIdx].trigger = wtfIsTriggerIdk;
|
//buffer[NextIdx].trigger = wtfIsTriggerIdk;
|
||||||
|
@ -67,7 +70,7 @@ static void SetNextCompositeEntry(uint32_t nowUs, bool trigger1, bool trigger2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp) {
|
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
// bail if we aren't enabled
|
// bail if we aren't enabled
|
||||||
if (!ToothLoggerEnabled) {
|
if (!ToothLoggerEnabled) {
|
||||||
return;
|
return;
|
||||||
|
@ -107,7 +110,8 @@ void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nowUs = NT2US(timestamp);
|
uint32_t nowUs = NT2US(timestamp);
|
||||||
SetNextCompositeEntry(nowUs, trigger1, trigger2);
|
bool isSync = engine->triggerCentral.triggerState.shaft_is_synchronized;
|
||||||
|
SetNextCompositeEntry(nowUs, trigger1, trigger2, isSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableToothLogger() {
|
void EnableToothLogger() {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include "efitime.h"
|
#include "efitime.h"
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
|
#include "engine.h"
|
||||||
|
|
||||||
// Enable the tooth logger - this clears the buffer starts logging
|
// Enable the tooth logger - this clears the buffer starts logging
|
||||||
void EnableToothLogger();
|
void EnableToothLogger();
|
||||||
|
@ -19,7 +20,7 @@ void EnableToothLogger();
|
||||||
void DisableToothLogger();
|
void DisableToothLogger();
|
||||||
|
|
||||||
// A new tooth has arrived! Log to the buffer if enabled.
|
// A new tooth has arrived! Log to the buffer if enabled.
|
||||||
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp);
|
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
struct ToothLoggerBuffer
|
struct ToothLoggerBuffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,7 +206,7 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
|
||||||
// Log to the Tunerstudio tooth logger
|
// Log to the Tunerstudio tooth logger
|
||||||
// We want to do this before anything else as we
|
// We want to do this before anything else as we
|
||||||
// actually want to capture any noise/jitter that may be occurring
|
// actually want to capture any noise/jitter that may be occurring
|
||||||
LogTriggerTooth(signal, timestamp);
|
LogTriggerTooth(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_TOOTH_LOGGER */
|
#endif /* EFI_TOOTH_LOGGER */
|
||||||
|
|
||||||
// for effective noise filtering, we need both signal edges,
|
// for effective noise filtering, we need both signal edges,
|
||||||
|
|
|
@ -21,17 +21,26 @@ int icuFallingCallbackCounter = 0;
|
||||||
|
|
||||||
#include "trigger_input.h"
|
#include "trigger_input.h"
|
||||||
#include "digital_input_icu.h"
|
#include "digital_input_icu.h"
|
||||||
|
#include "tooth_logger.h"
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
static void vvtRisingCallback(void *) {
|
static void vvtRisingCallback(void *) {
|
||||||
hwHandleVvtCamSignal(TV_RISE, getTimeNowNt());
|
efitick_t now = getTimeNowNt();
|
||||||
|
#if EFI_TOOTH_LOGGER
|
||||||
|
LogTriggerTooth(SHAFT_SECONDARY_RISING, now);
|
||||||
|
#endif /* EFI_TOOTH_LOGGER */
|
||||||
|
hwHandleVvtCamSignal(TV_RISE, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vvtFallingCallback(void *) {
|
static void vvtFallingCallback(void *) {
|
||||||
hwHandleVvtCamSignal(TV_FALL, getTimeNowNt());
|
efitick_t now = getTimeNowNt();
|
||||||
|
#if EFI_TOOTH_LOGGER
|
||||||
|
LogTriggerTooth(SHAFT_SECONDARY_FALLING, now);
|
||||||
|
#endif /* EFI_TOOTH_LOGGER */
|
||||||
|
hwHandleVvtCamSignal(TV_FALL, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue