trigger_adc helping simulator
This commit is contained in:
parent
aaf732f738
commit
c80a37503e
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "trigger_structure.h"
|
#include "trigger_structure.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
#include "trigger_input.h"
|
|
||||||
|
|
||||||
#define TRIGGER_BAIL_IF_DISABLED \
|
#define TRIGGER_BAIL_IF_DISABLED \
|
||||||
if (!engine->hwTriggerInputEnabled) { \
|
if (!engine->hwTriggerInputEnabled) { \
|
||||||
|
@ -36,6 +35,8 @@ void startTriggerDebugPins();
|
||||||
|
|
||||||
#if HAL_USE_ADC
|
#if HAL_USE_ADC
|
||||||
typedef adcsample_t triggerAdcSample_t;
|
typedef adcsample_t triggerAdcSample_t;
|
||||||
|
#else
|
||||||
|
typedef uint16_t triggerAdcSample_t;
|
||||||
#endif /* HAL_USE_ADC */
|
#endif /* HAL_USE_ADC */
|
||||||
|
|
||||||
// This detector has 2 modes for low-RPM (ADC) and fast-RPM (EXTI)
|
// This detector has 2 modes for low-RPM (ADC) and fast-RPM (EXTI)
|
||||||
|
|
|
@ -153,6 +153,8 @@ void onTriggerChanged(efitick_t stamp, bool isPrimary, bool isRising) {
|
||||||
|
|
||||||
|
|
||||||
void TriggerAdcDetector::init() {
|
void TriggerAdcDetector::init() {
|
||||||
|
#if ! EFI_SIMULATOR
|
||||||
|
|
||||||
// todo: move some of these to config
|
// todo: move some of these to config
|
||||||
|
|
||||||
// we need to make at least minNumAdcMeasurementsPerTooth for 1 tooth (i.e. between two consequent events)
|
// we need to make at least minNumAdcMeasurementsPerTooth for 1 tooth (i.e. between two consequent events)
|
||||||
|
@ -176,6 +178,7 @@ void TriggerAdcDetector::init() {
|
||||||
adcMaxThreshold = adcDefaultThreshold - adcDeltaThreshold;
|
adcMaxThreshold = adcDefaultThreshold - adcDeltaThreshold;
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
#endif // EFI_SIMULATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerAdcDetector::reset() {
|
void TriggerAdcDetector::reset() {
|
||||||
|
@ -226,6 +229,7 @@ void TriggerAdcDetector::digitalCallback(efitick_t stamp, bool isPrimary, bool r
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerAdcDetector::analogCallback(efitick_t stamp, triggerAdcSample_t value) {
|
void TriggerAdcDetector::analogCallback(efitick_t stamp, triggerAdcSample_t value) {
|
||||||
|
#if ! EFI_SIMULATOR
|
||||||
if (curAdcMode != TRIGGER_ADC_ADC) {
|
if (curAdcMode != TRIGGER_ADC_ADC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -353,5 +357,6 @@ void TriggerAdcDetector::analogCallback(efitick_t stamp, triggerAdcSample_t valu
|
||||||
|
|
||||||
prevValue = transition;
|
prevValue = transition;
|
||||||
prevStamp = stamp;
|
prevStamp = stamp;
|
||||||
|
#endif // EFI_SIMULATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ typedef uint32_t iomode_t;
|
||||||
typedef uint32_t ioportid_t;
|
typedef uint32_t ioportid_t;
|
||||||
typedef uint32_t ioportmask_t;
|
typedef uint32_t ioportmask_t;
|
||||||
|
|
||||||
typedef uint16_t triggerAdcSample_t;
|
|
||||||
|
|
||||||
#define DL_OUTPUT_BUFFER 200
|
#define DL_OUTPUT_BUFFER 200
|
||||||
|
|
||||||
// just a stub implementation for unit tests
|
// just a stub implementation for unit tests
|
||||||
|
|
Loading…
Reference in New Issue