multi-channel Tuner Studio tooth logger #1284

composite TDC mark not working?
This commit is contained in:
rusefi 2020-04-19 20:46:29 -04:00
parent bb24782bc2
commit 600744c926
3 changed files with 20 additions and 5 deletions

View File

@ -50,12 +50,15 @@ static bool trigger2 = false;
//NextIdx++;
static void SetNextCompositeEntry(uint32_t nowUs, bool trigger1, bool trigger2, bool isSync) {
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
bool isTDC DECLARE_ENGINE_PARAMETER_SUFFIX) {
uint32_t nowUs = NT2US(timestamp);
// TS uses big endian, grumble
buffer[NextIdx].timestamp = SWAP_UINT32(nowUs);
buffer[NextIdx].priLevel = trigger1;
buffer[NextIdx].secLevel = trigger2;
buffer[NextIdx].sync = isSync;
buffer[NextIdx].trigger = isTDC;
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
// todo:
//buffer[NextIdx].sync = isSynced;
//buffer[NextIdx].trigger = wtfIsTriggerIdk;
@ -109,9 +112,15 @@ void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_P
break;
}
uint32_t nowUs = NT2US(timestamp);
bool isSync = engine->triggerCentral.triggerState.shaft_is_synchronized;
SetNextCompositeEntry(nowUs, trigger1, trigger2, isSync);
SetNextCompositeEntry(timestamp, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
}
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
// bail if we aren't enabled
if (!ToothLoggerEnabled) {
return;
}
SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
}
void EnableToothLogger() {

View File

@ -22,6 +22,8 @@ void DisableToothLogger();
// A new tooth has arrived! Log to the buffer if enabled.
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
struct ToothLoggerBuffer
{
const uint8_t* const Buffer;

View File

@ -22,6 +22,7 @@
#include "engine_configuration.h"
#include "engine_math.h"
#include "perf_trace.h"
#include "tooth_logger.h"
#if EFI_PROD_CODE
#include "os_util.h"
@ -300,6 +301,9 @@ static void onTdcCallback(Engine *engine) {
waveChart.startDataCollection();
#endif
addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
#if ! EFI_UNIT_TEST
LogTriggerTopDeadCenter(getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
#endif /* EFI_UNIT_TEST */
}
/**