bail from trigger_central (#4210)

This commit is contained in:
Matthew Kennedy 2022-05-29 07:42:08 -07:00 committed by GitHub
parent 6733a60a27
commit 6ea78efbe7
4 changed files with 10 additions and 28 deletions

View File

@ -226,6 +226,11 @@ static void logFront(bool isImportantFront, efitick_t nowNt, int index) {
}
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index) {
if (engine->directSelfStimulation || !engine->hwTriggerInputEnabled) {
// sensor noise + self-stim = loss of trigger sync
return;
}
int bankIndex = index / CAMS_PER_BANK;
int camIndex = index % CAMS_PER_BANK;
TriggerCentral *tc = &engine->triggerCentral;
@ -412,6 +417,11 @@ void hwHandleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp) {
palWritePad(criticalErrorLedPort, criticalErrorLedPin, 0);
#endif // VR_HW_CHECK_MODE
if (engine->directSelfStimulation || !engine->hwTriggerInputEnabled) {
// sensor noise + self-stim = loss of trigger sync
return;
}
handleShaftSignal(signalIndex, isRising, timestamp);
}

View File

@ -11,18 +11,6 @@
#include "trigger_structure.h"
#include "trigger_central.h"
#define TRIGGER_BAIL_IF_DISABLED \
if (!engine->hwTriggerInputEnabled) { \
return; \
}
#define TRIGGER_BAIL_IF_SELF_STIM \
if (engine->directSelfStimulation) { \
/* sensor noise + self-stim = loss of trigger sync */ \
return; \
}
#define TRIGGER_SUPPORTED_CHANNELS 2
void turnOnTriggerInputPins();

View File

@ -26,9 +26,6 @@ static ioline_t camLines[CAM_INPUTS_COUNT];
static void shaft_callback(void *arg, efitick_t stamp) {
// do the time sensitive things as early as possible!
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
int index = (int)arg;
ioline_t pal_line = shaftLines[index];
bool rise = (palReadLine(pal_line) == PAL_HIGH);
@ -40,9 +37,6 @@ static void shaft_callback(void *arg, efitick_t stamp) {
}
static void cam_callback(void *arg, efitick_t stamp) {
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
int index = (int)arg;
ioline_t pal_line = camLines[index];

View File

@ -25,8 +25,6 @@ int icuFallingCallbackCounter = 0;
static void vvtRisingCallback(void *arg) {
efitick_t now = getTimeNowNt();
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
int index = (int)arg;
@ -41,8 +39,6 @@ static void vvtRisingCallback(void *arg) {
static void vvtFallingCallback(void * arg) {
efitick_t now = getTimeNowNt();
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
int index = (int)arg;
#if EFI_TOOTH_LOGGER
@ -59,9 +55,6 @@ static void vvtFallingCallback(void * arg) {
static void shaftRisingCallback(bool isPrimary) {
efitick_t stamp = getTimeNowNt();
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
icuRisingCallbackCounter++;
// icucnt_t last_width = icuGetWidth(icup); so far we are fine with system time
@ -72,9 +65,6 @@ static void shaftRisingCallback(bool isPrimary) {
static void shaftFallingCallback(bool isPrimary) {
efitick_t stamp = getTimeNowNt();
TRIGGER_BAIL_IF_DISABLED
TRIGGER_BAIL_IF_SELF_STIM
icuFallingCallbackCounter++;
hwHandleShaftSignal(isPrimary ? 0 : 1, false, stamp);