auto-sync
This commit is contained in:
parent
15d09b0c85
commit
cee0d25516
|
@ -122,10 +122,14 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pre-calculated offset for given sequence index within engine cycle
|
* pre-calculated offset for given sequence index within engine cycle
|
||||||
* not cylinder ID
|
* (not cylinder ID)
|
||||||
* todo: better name?
|
* todo: better name?
|
||||||
*/
|
*/
|
||||||
float angleExtra[IGNITION_PIN_COUNT];
|
angle_t angleExtra[IGNITION_PIN_COUNT];
|
||||||
|
/**
|
||||||
|
* pre-calculated reference to which output pin should be used for
|
||||||
|
* given sequence index within engine cycle
|
||||||
|
*/
|
||||||
NamedOutputPin *ignitionPin[IGNITION_PIN_COUNT];
|
NamedOutputPin *ignitionPin[IGNITION_PIN_COUNT];
|
||||||
|
|
||||||
void onTriggerEvent(uint64_t nowNt);
|
void onTriggerEvent(uint64_t nowNt);
|
||||||
|
|
|
@ -102,7 +102,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||||
list->reset();
|
list->reset();
|
||||||
|
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
float localAdvance = advance + ENGINE(angleExtra[i]);
|
angle_t localAdvance = advance + ENGINE(angleExtra[i]);
|
||||||
NamedOutputPin *output = ENGINE(ignitionPin[i]);
|
NamedOutputPin *output = ENGINE(ignitionPin[i]);
|
||||||
|
|
||||||
IgnitionEvent *event = list->add();
|
IgnitionEvent *event = list->add();
|
||||||
|
@ -145,7 +145,6 @@ void FuelSchedule::registerInjectionEvent(OutputSignalList *sourceList, NamedOut
|
||||||
}
|
}
|
||||||
|
|
||||||
FuelSchedule::FuelSchedule() {
|
FuelSchedule::FuelSchedule() {
|
||||||
clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::clear() {
|
void FuelSchedule::clear() {
|
||||||
|
@ -153,6 +152,7 @@ void FuelSchedule::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
||||||
|
clear(); // this method is relatively heavy
|
||||||
sourceList->reset();
|
sourceList->reset();
|
||||||
|
|
||||||
events.reset();
|
events.reset();
|
||||||
|
|
|
@ -278,7 +278,7 @@ void showMainHistogram(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doSomeCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
static void ignitionCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
/**
|
/**
|
||||||
* Within one engine cycle all cylinders are fired with same timing advance.
|
* Within one engine cycle all cylinders are fired with same timing advance.
|
||||||
* todo: one day we can control cylinders individually?
|
* todo: one day we can control cylinders individually?
|
||||||
|
@ -340,7 +340,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
||||||
|
|
||||||
if (eventIndex == engineConfiguration->ignMathCalculateAtIndex) {
|
if (eventIndex == engineConfiguration->ignMathCalculateAtIndex) {
|
||||||
engine->beforeIgnitionMath = GET_TIMESTAMP();
|
engine->beforeIgnitionMath = GET_TIMESTAMP();
|
||||||
doSomeCalc(rpm PASS_ENGINE_PARAMETER);
|
ignitionCalc(rpm PASS_ENGINE_PARAMETER);
|
||||||
engine->ignitionMathTime = GET_TIMESTAMP() - engine->beforeIgnitionMath;
|
engine->ignitionMathTime = GET_TIMESTAMP() - engine->beforeIgnitionMath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
* that's the angle distance from trigger event #0 and actual engine TDC
|
* that's the angle distance from trigger event #0 and actual engine TDC
|
||||||
* see also globalTriggerAngleOffset
|
* see also globalTriggerAngleOffset
|
||||||
*/
|
*/
|
||||||
float tdcPosition;
|
angle_t tdcPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we use falls or rises for gap ratio detection?
|
* Should we use falls or rises for gap ratio detection?
|
||||||
|
|
|
@ -49,6 +49,14 @@ public class TestingUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void assertWave(String msg, WaveChart chart, String key, double width, double... expectedAngles) {
|
static void assertWave(String msg, WaveChart chart, String key, double width, double... expectedAngles) {
|
||||||
|
assertWave(true, msg, chart, key, width, expectedAngles);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void assertWaveFall(String msg, WaveChart chart, String key, double width, double... expectedAngles) {
|
||||||
|
assertWave(false, msg, chart, key, width, expectedAngles);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void assertWave(boolean rise, String msg, WaveChart chart, String key, double width, double... expectedAngles) {
|
||||||
RevolutionLog revolutionLog = chart.getRevolutionsLog();
|
RevolutionLog revolutionLog = chart.getRevolutionsLog();
|
||||||
if (revolutionLog.keySet().isEmpty())
|
if (revolutionLog.keySet().isEmpty())
|
||||||
throw new IllegalStateException(msg + " Empty revolutions in " + chart);
|
throw new IllegalStateException(msg + " Empty revolutions in " + chart);
|
||||||
|
@ -58,8 +66,9 @@ public class TestingUtils {
|
||||||
List<WaveReport.UpDown> wr = WaveReport.parse(events.toString());
|
List<WaveReport.UpDown> wr = WaveReport.parse(events.toString());
|
||||||
assertTrue(msg + " waves for " + key, !wr.isEmpty());
|
assertTrue(msg + " waves for " + key, !wr.isEmpty());
|
||||||
for (WaveReport.UpDown ud : wr) {
|
for (WaveReport.UpDown ud : wr) {
|
||||||
double angleByTime = revolutionLog.getCrankAngleByTime(ud.upTime);
|
int eventTime = rise ? ud.upTime : ud.downTime;
|
||||||
assertCloseEnough(msg + " angle for " + key + "@" + ud.upTime, angleByTime, expectedAngles);
|
double angleByTime = revolutionLog.getCrankAngleByTime(eventTime);
|
||||||
|
assertCloseEnough(msg + " angle for " + key + "@" + eventTime, angleByTime, expectedAngles);
|
||||||
|
|
||||||
assertCloseEnough(msg + "width for " + key, ud.getDutyCycle(revolutionLog), width);
|
assertCloseEnough(msg + "width for " + key, ud.getDutyCycle(revolutionLog), width);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue