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
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-12-27 12:02:51 -08:00
|
|
|
*/
|
|
|
|
|
2022-04-25 17:38:16 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
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
|
|
|
|
*/
|
2019-12-07 22:09:39 -08:00
|
|
|
void initializeRoverK(TriggerWaveform *s) {
|
2022-10-05 17:10:27 -07:00
|
|
|
s->initialize(FOUR_STROKE_CRANK_SENSOR, SyncEdge::RiseOnly);
|
2015-12-27 12:02:51 -08:00
|
|
|
|
|
|
|
float tooth = 20;
|
|
|
|
|
2015-12-27 13:02:44 -08:00
|
|
|
s->setTriggerSynchronizationGap(2.0);
|
2022-07-11 23:42:41 -07:00
|
|
|
// wow that's odd
|
|
|
|
s->setSecondTriggerSynchronizationGap2(0.0001, 100000);
|
2015-12-27 13:02:44 -08:00
|
|
|
s->setThirdTriggerSynchronizationGap(2);
|
2015-12-27 12:02:51 -08:00
|
|
|
|
|
|
|
float base = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(base + tooth / 2, TriggerValue::RISE);
|
|
|
|
s->addEvent720(base + tooth, TriggerValue::FALL);
|
2015-12-27 12:02:51 -08:00
|
|
|
base += tooth;
|
|
|
|
}
|
|
|
|
base += tooth;
|
|
|
|
for (int i = 0; i < 2; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(base + tooth / 2, TriggerValue::RISE);
|
|
|
|
s->addEvent720(base + tooth, TriggerValue::FALL);
|
2015-12-27 12:02:51 -08:00
|
|
|
base += tooth;
|
|
|
|
}
|
|
|
|
base += tooth;
|
|
|
|
for (int i = 0; i < 14; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(base + tooth / 2, TriggerValue::RISE);
|
|
|
|
s->addEvent720(base + tooth, TriggerValue::FALL);
|
2015-12-27 12:02:51 -08:00
|
|
|
base += tooth;
|
|
|
|
}
|
|
|
|
base += tooth;
|
|
|
|
for (int i = 0; i < 3; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(base + tooth / 2, TriggerValue::RISE);
|
|
|
|
s->addEvent720(base + tooth, TriggerValue::FALL);
|
2015-12-27 12:02:51 -08:00
|
|
|
base += tooth;
|
|
|
|
}
|
|
|
|
base += tooth;
|
|
|
|
for (int i = 0; i < 11; i++) {
|
2022-11-16 11:28:43 -08:00
|
|
|
s->addEvent720(base + tooth / 2, TriggerValue::RISE);
|
|
|
|
s->addEvent720(base + tooth, TriggerValue::FALL);
|
2015-12-27 12:02:51 -08:00
|
|
|
base += tooth;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|