BUG: phase sensor validation attending - detect missing CAM signal #659
refactoring and unit test first phase
This commit is contained in:
parent
4e61505620
commit
c6198e34ec
|
@ -62,6 +62,7 @@ uint32_t RpmCalculator::getRevolutionCounterSinceStart(void) {
|
|||
|
||||
/**
|
||||
* @return -1 in case of isNoisySignal(), current RPM otherwise
|
||||
* See NOISY_RPM
|
||||
*/
|
||||
// todo: migrate to float return result or add a float version? this would have with calculations
|
||||
int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const {
|
||||
|
|
|
@ -556,7 +556,7 @@ void triggerInfo(void) {
|
|||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
if (engineConfiguration->camInput != GPIO_UNASSIGNED) {
|
||||
if (HAVE_CAM_INPUT()) {
|
||||
scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInput),
|
||||
getVvt_mode_e(engineConfiguration->vvtMode));
|
||||
scheduleMsg(logger, "VVT event counters: %d/%d", vvtEventRiseCounter, vvtEventFallCounter);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
class Engine;
|
||||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
#define HAVE_CAM_INPUT() engineConfiguration->camInput != GPIO_UNASSIGNED
|
||||
|
||||
#define HW_EVENT_TYPES 6
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,11 +33,11 @@ public:
|
|||
void fireFall(int delayMs);
|
||||
|
||||
/**
|
||||
* See also #fireRise()
|
||||
* See also #fireRise() which would also move time forward
|
||||
*/
|
||||
void firePrimaryTriggerRise();
|
||||
/**
|
||||
* See also #fireFall()
|
||||
* See also #fireFall() which would also move time forward
|
||||
*/
|
||||
void firePrimaryTriggerFall();
|
||||
void fireTriggerEvents(int count);
|
||||
|
|
|
@ -8,6 +8,30 @@
|
|||
#include "engine_test_helper.h"
|
||||
|
||||
TEST(sensors, testCamInput) {
|
||||
// setting some weird engine
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
||||
|
||||
// and now changing to ONE trigger on CRANK with CAM/VVT
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
engineConfiguration->camInput = GPIOA_10;
|
||||
|
||||
ASSERT_EQ( 0, GET_RPM()) << "testCamInput RPM";
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
eth.firePrimaryTriggerRise();
|
||||
eth.firePrimaryTriggerRise();
|
||||
eth.firePrimaryTriggerRise();
|
||||
// error condition since two events happened too quick
|
||||
ASSERT_EQ(NOISY_RPM, GET_RPM()) << "testCamInput RPM should be noisy";
|
||||
|
||||
|
||||
eth.fireRise(50);
|
||||
eth.fireRise(50);
|
||||
eth.fireRise(50);
|
||||
eth.fireRise(50);
|
||||
eth.fireRise(50);
|
||||
ASSERT_EQ(1200, GET_RPM()) << "testCamInput RPM";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue