Tooth logger to use engineSnifferRpmThreshold #3161

refactoring
This commit is contained in:
rusefillc 2021-08-15 13:55:28 -04:00
parent 4e51572131
commit 87a2a70554
1 changed files with 14 additions and 16 deletions

View File

@ -70,6 +70,12 @@ int copyCompositeEvents(CompositeEvent *events) {
#endif // EFI_UNIT_TEST
static void setToothLogReady(bool value) {
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = value;
#endif // EFI_TUNER_STUDIO
}
static void SetNextCompositeEntry(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
uint32_t nowUs = NT2US(timestamp);
@ -89,21 +95,15 @@ static void SetNextCompositeEntry(efitick_t timestamp DECLARE_ENGINE_PARAMETER_S
//If we hit the end, loop
if ((firstBuffer) && (NextIdx >= (COMPOSITE_PACKET_COUNT/2))) {
/* first half is full */
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = true;
#endif
setToothLogReady(true);
firstBuffer = false;
}
if ((!firstBuffer) && (NextIdx >= sizeof(buffer) / sizeof(buffer[0]))) {
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = true;
#endif
setToothLogReady(true);
NextIdx = 0;
firstBuffer = true;
}
/////tsOutputChannels.toothLogReady = true;
}
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -206,13 +206,13 @@ void EnableToothLogger() {
// Enable logging of edges as they come
ToothLoggerEnabled = true;
#if EFI_TUNER_STUDIO
// Tell TS that we're ready for it to read out the log
// nb: this is a lie, as we may not have written anything
// yet. However, we can let it continuously read out the buffer
// as we update it, which looks pretty nice.
tsOutputChannels.toothLogReady = false;
#endif // EFI_TUNER_STUDIO
setToothLogReady(false);
}
void EnableToothLoggerIfNotEnabled() {
@ -223,20 +223,18 @@ void EnableToothLoggerIfNotEnabled() {
void DisableToothLogger() {
ToothLoggerEnabled = false;
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = false;
#endif // EFI_TUNER_STUDIO
setToothLogReady(false);
}
ToothLoggerBuffer GetToothLoggerBuffer() {
if (firstBuffer) {
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = false;
setToothLogReady(false);
#endif
return { reinterpret_cast<uint8_t*>(ptr_buffer_second), (sizeof(buffer)/2) };
} else {
#if EFI_TUNER_STUDIO
tsOutputChannels.toothLogReady = false;
setToothLogReady(false);
#endif
return { reinterpret_cast<uint8_t*>(ptr_buffer_first), (sizeof(buffer)/2) };
}