trigger signal debug pins - logic level output #2959

This commit is contained in:
Andrey 2021-07-13 20:15:55 -04:00
parent 41ec764617
commit 994230be65
2 changed files with 26 additions and 1 deletions

View File

@ -45,6 +45,8 @@
WaveChart waveChart; WaveChart waveChart;
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */
static scheduling_s debugToggleScheduling;
trigger_central_s::trigger_central_s() : hwEventCounters() { trigger_central_s::trigger_central_s() : hwEventCounters() {
} }
@ -123,6 +125,22 @@ static void syncAndReport(TriggerCentral *tc, int mod, int remainder DECLARE_ENG
} }
} }
static void turnOffAllDebugFields(void *arg) {
(void)arg;
#if EFI_PROD_CODE
for (int index = 0;index<TRIGGER_INPUT_PIN_COUNT;index++) {
if (CONFIG(triggerInputDebugPins[index]) != GPIO_UNASSIGNED) {
writePad("trigger debug", CONFIG(triggerInputDebugPins[index]), 0);
}
}
for (int index = 0;index<CAM_INPUTS_COUNT;index++) {
if (CONFIG(camInputsDebug[index]) != GPIO_UNASSIGNED) {
writePad("cam debug", CONFIG(camInputsDebug[index]), 0);
}
}
#endif /* EFI_PROD_CODE */
}
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECLARE_ENGINE_PARAMETER_SUFFIX) { void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
int bankIndex = index / CAMS_PER_BANK; int bankIndex = index / CAMS_PER_BANK;
int camIndex = index % CAMS_PER_BANK; int camIndex = index % CAMS_PER_BANK;
@ -178,7 +196,10 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
} }
if (isImportantFront && CONFIG(camInputsDebug[index]) != GPIO_UNASSIGNED) { if (isImportantFront && CONFIG(camInputsDebug[index]) != GPIO_UNASSIGNED) {
#if EFI_PROD_CODE
writePad("cam debug", CONFIG(camInputsDebug[index]), 1);
#endif /* EFI_PROD_CODE */
engine->executor.scheduleByTimestamp(&debugToggleScheduling, nowNt + MS2NT(100), &turnOffAllDebugFields);
} }
if (CONFIG(displayLogicLevelsInEngineSniffer) && isImportantFront) { if (CONFIG(displayLogicLevelsInEngineSniffer) && isImportantFront) {

View File

@ -139,6 +139,7 @@ void stopTriggerInputPins(void) {
turnOffTriggerInputPin(i, true); turnOffTriggerInputPin(i, true);
} }
if (isConfigurationChanged(triggerInputDebugPins[i])) { if (isConfigurationChanged(triggerInputDebugPins[i])) {
efiSetPadUnused(CONFIG(triggerInputDebugPins[i]));
} }
} }
for (int i = 0; i < CAM_INPUTS_COUNT; i++) { for (int i = 0; i < CAM_INPUTS_COUNT; i++) {
@ -146,6 +147,7 @@ void stopTriggerInputPins(void) {
turnOffTriggerInputPin(i, false); turnOffTriggerInputPin(i, false);
} }
if (isConfigurationChanged(camInputsDebug[i])) { if (isConfigurationChanged(camInputsDebug[i])) {
efiSetPadUnused(CONFIG(camInputsDebug[i]));
} }
} }
} }
@ -157,6 +159,7 @@ void startTriggerInputPins(void) {
turnOnTriggerInputPin(msg, i, true); turnOnTriggerInputPin(msg, i, true);
} }
if (isConfigurationChanged(triggerInputDebugPins[i])) { if (isConfigurationChanged(triggerInputDebugPins[i])) {
efiSetPadMode("trigger debug", CONFIG(triggerInputDebugPins[i]), PAL_MODE_OUTPUT_PUSHPULL);
} }
} }
@ -165,6 +168,7 @@ void startTriggerInputPins(void) {
turnOnTriggerInputPin("Cam", i, false); turnOnTriggerInputPin("Cam", i, false);
} }
if (isConfigurationChanged(camInputsDebug[i])) { if (isConfigurationChanged(camInputsDebug[i])) {
efiSetPadMode("cam debug", CONFIG(camInputsDebug[i]), PAL_MODE_OUTPUT_PUSHPULL);
} }
} }
} }