fome-fw/firmware/controllers/trigger/decoders/trigger_rover.cpp

56 lines
1.5 KiB
C++
Raw Normal View History

2015-12-27 12:02:51 -08:00
/*
* @file trigger_rover.cpp
*
* @date Dec 27, 2015
2015-12-31 13:02:30 -08:00
* @author PhilTheGeek
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-12-27 12:02:51 -08:00
*/
#include "trigger_rover.h"
2017-01-14 10:06:21 -08:00
/**
* https://en.wikipedia.org/wiki/Rover_K-series_engine
*/
2016-10-31 19:02:12 -07:00
void initializeRoverK(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
2015-12-27 12:02:51 -08:00
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
float tooth = 20;
2015-12-27 13:02:44 -08:00
s->setTriggerSynchronizationGap(2.0);
s->setThirdTriggerSynchronizationGap(2);
s->isSynchronizationNeeded = true;
2015-12-27 12:02:51 -08:00
float base = 0;
for (int i = 0; i < 2; i++) {
2016-10-31 18:02:36 -07:00
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
2015-12-27 12:02:51 -08:00
base += tooth;
}
base += tooth;
for (int i = 0; i < 2; i++) {
2016-10-31 18:02:36 -07:00
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
2015-12-27 12:02:51 -08:00
base += tooth;
}
base += tooth;
for (int i = 0; i < 14; i++) {
2016-10-31 18:02:36 -07:00
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
2015-12-27 12:02:51 -08:00
base += tooth;
}
base += tooth;
for (int i = 0; i < 3; i++) {
2016-10-31 18:02:36 -07:00
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
2015-12-27 12:02:51 -08:00
base += tooth;
}
base += tooth;
for (int i = 0; i < 11; i++) {
2016-10-31 18:02:36 -07:00
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
2015-12-27 12:02:51 -08:00
base += tooth;
}
}