composite log for console

This commit is contained in:
rusefi 2020-05-26 00:07:18 -04:00
parent 1dd2e68908
commit 5d75c36651
9 changed files with 61 additions and 4 deletions

View File

@ -1273,6 +1273,7 @@
#define TS_CRC_CHECK_COMMAND 'k'
#define TS_EXECUTE 'E'
#define TS_FILE_VERSION 20200310
#define TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY '8'
#define TS_GET_LOGGER_GET_BUFFER 'L'
#define TS_GET_STRUCT '9'
#define TS_GET_TEXT 'G'

View File

@ -30,6 +30,8 @@ typedef struct __attribute__ ((packed)) {
bool secLevel : 1;
bool trigger : 1;
bool sync : 1;
bool coil : 1;
bool injector : 1;
} composite_logger_s;
/**
@ -44,6 +46,10 @@ static uint32_t lastEdgeTimestamp = 0;
static bool trigger1 = false;
static bool trigger2 = false;
// any coil, all coils thrown together
static bool coil = false;
// same about injectors
static bool injector = false;
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
bool isTDC DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -54,6 +60,8 @@ static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigg
buffer[NextIdx].secLevel = trigger2;
buffer[NextIdx].trigger = isTDC;
buffer[NextIdx].sync = engine->triggerCentral.triggerState.shaft_is_synchronized;
buffer[NextIdx].coil = coil;
buffer[NextIdx].injector = injector;
NextIdx++;
@ -115,6 +123,22 @@ void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX
SetNextCompositeEntry(timestamp, trigger1, trigger2, true PASS_ENGINE_PARAMETER_SUFFIX);
}
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!ToothLoggerEnabled) {
return;
}
coil = state;
SetNextCompositeEntry(timestamp, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
}
void LogTriggerInjectorState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!ToothLoggerEnabled) {
return;
}
injector = state;
SetNextCompositeEntry(timestamp, trigger1, trigger2, false PASS_ENGINE_PARAMETER_SUFFIX);
}
void EnableToothLogger() {
// Clear the buffer
memset(buffer, 0, sizeof(buffer));

View File

@ -24,6 +24,10 @@ void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp DECLARE_ENGINE_P
void LogTriggerTopDeadCenter(efitick_t timestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
void LogTriggerCoilState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX);
void LogTriggerInjectorState(efitick_t timestamp, bool state DECLARE_ENGINE_PARAMETER_SUFFIX);
struct ToothLoggerBuffer
{
const uint8_t* const Buffer;

View File

@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200523;
return 20200525;
}
#endif /* EFI_UNIT_TEST */

View File

@ -41,9 +41,8 @@
#include "cdm_ion_sense.h"
#include "engine_controller.h"
#include "efi_gpio.h"
#if EFI_PROD_CODE
#include "tooth_logger.h"
#include "os_util.h"
#endif /* EFI_PROD_CODE */
#include "local_version_holder.h"
#include "event_queue.h"
#include "engine.h"
@ -120,6 +119,12 @@ static inline void turnInjectionPinHigh(InjectorOutputPin *output) {
}
void turnInjectionPinHigh(InjectionEvent *event) {
efitick_t nowNt = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerInjectorState(nowNt, true PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_TOOTH_LOGGER
for (int i = 0;i < MAX_WIRES_COUNT;i++) {
InjectorOutputPin *output = event->outputs[i];
@ -154,6 +159,12 @@ static inline void turnInjectionPinLow(InjectorOutputPin *output) {
}
void turnInjectionPinLow(InjectionEvent *event) {
efitick_t nowNt = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerInjectorState(nowNt, false PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_TOOTH_LOGGER
event->isScheduled = false;
for (int i = 0;i<MAX_WIRES_COUNT;i++) {
InjectorOutputPin *output = event->outputs[i];

View File

@ -12,6 +12,7 @@
#include "utlist.h"
#include "event_queue.h"
#include "perf_trace.h"
#include "tooth_logger.h"
#if EFI_ENGINE_CONTROL
@ -124,6 +125,12 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
}
void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
efitick_t nowNt = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerCoilState(nowNt, false PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_TOOTH_LOGGER
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
IgnitionOutputPin *output = event->outputs[i];
@ -235,6 +242,13 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
void turnSparkPinHigh(IgnitionEvent *event) {
event->actualStartOfDwellNt = getTimeNowLowerNt();
efitick_t nowNt = getTimeNowNt();
#if EFI_TOOTH_LOGGER
LogTriggerCoilState(nowNt, true PASS_ENGINE_PARAMETER_SUFFIX);
#endif // EFI_TOOTH_LOGGER
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
IgnitionOutputPin *output = event->outputs[i];
if (output != NULL) {

View File

@ -1273,6 +1273,7 @@
#define TS_CRC_CHECK_COMMAND 'k'
#define TS_EXECUTE 'E'
#define TS_FILE_VERSION 20200310
#define TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY '8'
#define TS_GET_LOGGER_GET_BUFFER 'L'
#define TS_GET_STRUCT '9'
#define TS_GET_TEXT 'G'

View File

@ -1578,6 +1578,7 @@ end_struct
#define TS_EXECUTE 'E'
// 0x39
#define TS_GET_STRUCT '9'
#define TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY '8'

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon May 25 19:18:41 EDT 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon May 25 23:12:49 EDT 2020
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
@ -1254,6 +1254,7 @@ public class Fields {
public static final char TS_CRC_CHECK_COMMAND = 'k';
public static final char TS_EXECUTE = 'E';
public static final int TS_FILE_VERSION = 20200310;
public static final char TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY = '8';
public static final char TS_GET_LOGGER_GET_BUFFER = 'L';
public static final char TS_GET_STRUCT = '9';
public static final char TS_GET_TEXT = 'G';