Live Data for hw VVT signals

This commit is contained in:
rusEfi 2019-09-02 21:02:08 -04:00
parent a027f827e7
commit 1b8219432c
9 changed files with 35 additions and 25 deletions

View File

@ -74,8 +74,6 @@ extern bool main_loop_started;
#include "vehicle_speed.h"
#include "single_timer_executor.h"
#include "periodic_task.h"
extern int vvtEventRiseCounter;
extern int vvtEventFallCounter;
extern int icuWidthCallbackCounter;
extern int icuWidthPeriodCounter;
#endif /* EFI_PROD_CODE */
@ -773,8 +771,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->debugIntField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING);
tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING);
#if EFI_PROD_CODE
tsOutputChannels->debugIntField4 = vvtEventRiseCounter;
tsOutputChannels->debugIntField5 = vvtEventFallCounter;
tsOutputChannels->debugIntField4 = engine->triggerCentral.vvtEventRiseCounter;
tsOutputChannels->debugIntField5 = engine->triggerCentral.vvtEventFallCounter;
tsOutputChannels->debugFloatField5 = icuWidthCallbackCounter + icuWidthPeriodCounter;
#endif /* EFI_PROD_CODE */

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 13:51:51 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_TRIGGER_GENERATED_H
@ -16,11 +16,19 @@ struct trigger_central_s {
* offset 24
*/
int vvtCamCounter = (int)0;
/** total size 28*/
/**
* offset 28
*/
int vvtEventRiseCounter = (int)0;
/**
* offset 32
*/
int vvtEventFallCounter = (int)0;
/** total size 36*/
};
typedef struct trigger_central_s trigger_central_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 13:51:51 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019

View File

@ -89,6 +89,14 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E
}
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX) {
TriggerCentral *tc = &engine->triggerCentral;
if (front == TV_RISE) {
tc->vvtEventRiseCounter++;
} else {
tc->vvtEventFallCounter++;
}
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
@ -102,7 +110,6 @@ void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX)
return;
}
TriggerCentral *tc = &engine->triggerCentral;
tc->vvtCamCounter++;
efitick_t nowNt = getTimeNowNt();
@ -511,9 +518,6 @@ extern bool hwTriggerInputEnabled;
extern uint32_t maxSchedulingPrecisionLoss;
extern uint32_t *cyccnt;
extern int vvtEventRiseCounter;
extern int vvtEventFallCounter;
void resetMaxValues() {
#if EFI_PROD_CODE || EFI_SIMULATOR
maxEventCallbackDuration = triggerMaxDuration = 0;
@ -592,7 +596,7 @@ void triggerInfo(void) {
if (HAVE_CAM_INPUT()) {
scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInputs[0]),
getVvt_mode_e(engineConfiguration->vvtMode));
scheduleMsg(logger, "VVT event counters: %d/%d", vvtEventRiseCounter, vvtEventFallCounter);
scheduleMsg(logger, "VVT event counters: %d/%d", engine->triggerCentral.vvtEventRiseCounter, engine->triggerCentral.vvtEventFallCounter);
}

View File

@ -504,6 +504,8 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
DISPLAY_TEXT(VVT_1);
DISPLAY(DISPLAY_CONFIG(CAMINPUTS1));
DISPLAY(DISPLAY_FIELD(vvtEventRiseCounter));
DISPLAY(DISPLAY_FIELD(vvtEventFallCounter));
DISPLAY(DISPLAY_FIELD(vvtCamCounter));
if (triggerShape->isSynchronizationNeeded) {

View File

@ -36,9 +36,6 @@ EXTERN_ENGINE
;
static Logging *logger;
int vvtEventRiseCounter = 0;
int vvtEventFallCounter = 0;
#if EFI_PROD_CODE
/* PAL based implementation */
#if (HAL_TRIGGER_USE_PAL == TRUE) && (PAL_USE_CALLBACKS == TRUE)
@ -80,10 +77,8 @@ static void cam_callback(void *arg) {
bool rise = (palReadLine(pal_line) == PAL_HIGH);
if (rise) {
vvtEventRiseCounter++;
hwHandleVvtCamSignal(TV_RISE);
} else {
vvtEventFallCounter++;
hwHandleVvtCamSignal(TV_FALL);
}
}
@ -114,13 +109,11 @@ static ICUDriver *primaryCrankDriver;
static void cam_icu_width_callback(ICUDriver *icup) {
(void)icup;
vvtEventRiseCounter++;
hwHandleVvtCamSignal(TV_RISE);
}
static void cam_icu_period_callback(ICUDriver *icup) {
(void)icup;
vvtEventFallCounter++;
hwHandleVvtCamSignal(TV_FALL);
}

View File

@ -28,9 +28,6 @@ EXTERN_ENGINE
;
static Logging *logger;
int vvtEventRiseCounter = 0;
int vvtEventFallCounter = 0;
static void comp_shaft_callback(COMPDriver *comp) {
bool isRising = (comp_lld_get_status(comp) & COMP_IRQ_RISING) != 0;
int isPrimary = (comp == EFI_COMP_PRIMARY_DEVICE);
@ -56,10 +53,8 @@ static void comp_shaft_callback(COMPDriver *comp) {
#if 0
static void comp_cam_callback(COMPDriver *comp) {
if (isRising) {
vvtEventRiseCounter++;
hwHandleVvtCamSignal(TV_RISE);
} else {
vvtEventFallCounter++;
hwHandleVvtCamSignal(TV_FALL);
}
}

View File

@ -6,4 +6,8 @@ struct_no_prefix define_constructor trigger_central_s
int vvtCamCounter
int vvtEventRiseCounter
int vvtEventFallCounter
end_struct

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 13:51:51 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/trigger_state.txt Mon Sep 02 20:41:37 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
@ -14,6 +14,8 @@ public class TriggerState {
public static final Field HWEVENTCOUNTERS5 = Field.create("HWEVENTCOUNTERS5", 16, FieldType.INT);
public static final Field HWEVENTCOUNTERS6 = Field.create("HWEVENTCOUNTERS6", 20, FieldType.INT);
public static final Field VVTCAMCOUNTER = Field.create("VVTCAMCOUNTER", 24, FieldType.INT);
public static final Field VVTEVENTRISECOUNTER = Field.create("VVTEVENTRISECOUNTER", 28, FieldType.INT);
public static final Field VVTEVENTFALLCOUNTER = Field.create("VVTEVENTFALLCOUNTER", 32, FieldType.INT);
public static final Field[] VALUES = {
HWEVENTCOUNTERS1,
HWEVENTCOUNTERS2,
@ -22,5 +24,7 @@ public class TriggerState {
HWEVENTCOUNTERS5,
HWEVENTCOUNTERS6,
VVTCAMCOUNTER,
VVTEVENTRISECOUNTER,
VVTEVENTFALLCOUNTER,
};
}

View File

@ -18,6 +18,8 @@ public class TriggerDecoderMeta {
new TextRequest("EOL"),
new TextRequest("VVT_1"),
new ConfigRequest("CAMINPUTS1"),
new FieldRequest("Trigger", "vvtEventRiseCounter"),
new FieldRequest("Trigger", "vvtEventFallCounter"),
new FieldRequest("Trigger", "vvtCamCounter"),
};
}