trigger_adc helping simulator

(cherry picked from commit c80a37503e)
This commit is contained in:
rusefillc 2021-12-01 14:17:16 -05:00
parent 4e1daef943
commit 5431006ab3
3 changed files with 7 additions and 3 deletions

View File

@ -13,7 +13,6 @@
#include "trigger_structure.h"
#include "trigger_central.h"
#define TRIGGER_BAIL_IF_DISABLED \
if (!engine->hwTriggerInputEnabled) { \
return; \
@ -38,6 +37,8 @@ void startTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
#if HAL_USE_ADC
typedef adcsample_t triggerAdcSample_t;
#else
typedef uint16_t triggerAdcSample_t;
#endif /* HAL_USE_ADC */
// This detector has 2 modes for low-RPM (ADC) and fast-RPM (EXTI)

View File

@ -148,6 +148,8 @@ void onTriggerChanged(efitick_t stamp, bool isPrimary, bool isRising) {
void TriggerAdcDetector::init() {
#if ! EFI_SIMULATOR
// todo: move some of these to config
// we need to make at least minNumAdcMeasurementsPerTooth for 1 tooth (i.e. between two consequent events)
@ -171,6 +173,7 @@ void TriggerAdcDetector::init() {
adcMaxThreshold = adcDefaultThreshold - adcDeltaThreshold;
reset();
#endif // EFI_SIMULATOR
}
void TriggerAdcDetector::reset() {
@ -221,6 +224,7 @@ void TriggerAdcDetector::digitalCallback(efitick_t stamp, bool isPrimary, bool r
}
void TriggerAdcDetector::analogCallback(efitick_t stamp, triggerAdcSample_t value) {
#if ! EFI_SIMULATOR
if (curAdcMode != TRIGGER_ADC_ADC) {
return;
}
@ -348,5 +352,6 @@ void TriggerAdcDetector::analogCallback(efitick_t stamp, triggerAdcSample_t valu
prevValue = transition;
prevStamp = stamp;
#endif // EFI_SIMULATOR
}

View File

@ -18,8 +18,6 @@ typedef uint32_t iomode_t;
typedef uint32_t ioportid_t;
typedef uint32_t ioportmask_t;
typedef uint16_t triggerAdcSample_t;
#define DL_OUTPUT_BUFFER 200
// just a stub implementation for unit tests