MapAveragingCallback schedules all cylinders at once #974
saving pennies
This commit is contained in:
parent
a89ed00d3e
commit
04f6913d56
|
@ -253,6 +253,13 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// set tps_max 540
|
||||
engineConfiguration->tpsMax = 540;
|
||||
|
||||
// yes, 30K - that's a test configuration
|
||||
engineConfiguration->rpmHardLimit = 30000;
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
|
||||
|
||||
boardConfiguration->ignitionPins[0] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
|
||||
|
|
|
@ -313,9 +313,9 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
|||
// at the moment we schedule based on time prediction based on current RPM and angle
|
||||
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision
|
||||
// todo: schedule this based on closest trigger event, same as ignition works
|
||||
scheduleByAngle(rpm, &startTimer[i][structIndex], samplingStart,
|
||||
scheduleByAngle(&startTimer[i][structIndex], samplingStart,
|
||||
startAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(rpm, &endTimer[i][structIndex], samplingEnd,
|
||||
scheduleByAngle(&endTimer[i][structIndex], samplingEnd,
|
||||
endAveraging, NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->m.mapAveragingCbTime = getTimeNowLowerNt()
|
||||
- engine->m.beforeMapAveragingCb;
|
||||
|
|
|
@ -101,12 +101,12 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
|||
}
|
||||
|
||||
fixAngle(onTime, "onTime", CUSTOM_ERR_6556);
|
||||
scheduleByAngle(rpm, onEvent,
|
||||
scheduleByAngle(onEvent,
|
||||
onTime,
|
||||
(schfunc_t) &plainPinTurnOn, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t offTime = extra + engine->engineState.auxValveEnd;
|
||||
fixAngle(offTime, "offTime", CUSTOM_ERR_6557);
|
||||
scheduleByAngle(rpm, offEvent,
|
||||
scheduleByAngle(offEvent,
|
||||
offTime,
|
||||
(schfunc_t) &plainPinTurnOff, output PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
if (isOverlap) {
|
||||
|
|
|
@ -319,7 +319,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
|||
int rpm = GET_RPM();
|
||||
// todo: use tooth event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
|
||||
scheduleByAngle(&tdcScheduler[revIndex2], tdcPosition(),
|
||||
(schfunc_t) onTdcCallback, engine PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
@ -358,14 +358,11 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
* The callback would be executed once after the duration of time which
|
||||
* it takes the crankshaft to rotate to the specified angle.
|
||||
*/
|
||||
void scheduleByAngle(float rpm, scheduling_s *timer, angle_t angle,
|
||||
void scheduleByAngle(scheduling_s *timer, angle_t angle,
|
||||
schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
ScopePerf perf(PE::ScheduleByAngle);
|
||||
|
||||
efiAssertVoid(CUSTOM_ANGLE_NAN, !cisnan(angle), "NaN angle?");
|
||||
efiAssertVoid(CUSTOM_ERR_6634, isValidRpm(rpm), "RPM check expected");
|
||||
float delayUs = ENGINE(rpmCalculator.oneDegreeUs) * angle;
|
||||
efiAssertVoid(CUSTOM_ERR_6635, !cisnan(delayUs), "NaN delay?");
|
||||
ENGINE(executor.scheduleForLater(timer, (int) delayUs, callback, param));
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,6 @@ float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|||
#define addEngineSnifferEvent(n, msg) {}
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
|
||||
void scheduleByAngle(float rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void scheduleByAngle(scheduling_s *timer, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
#endif /* RPM_REPORTER_H_ */
|
||||
|
|
|
@ -254,12 +254,12 @@ static void intHoldCallback(trigger_event_e ckpEventType, uint32_t index DECLARE
|
|||
|
||||
int structIndex = getRevolutionCounter() % 2;
|
||||
// todo: schedule this based on closest trigger event, same as ignition works
|
||||
scheduleByAngle(rpm, &startTimer[structIndex], engineConfiguration->knockDetectionWindowStart,
|
||||
scheduleByAngle(&startTimer[structIndex], engineConfiguration->knockDetectionWindowStart,
|
||||
(schfunc_t) &startIntegration, NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#if EFI_PROD_CODE
|
||||
hipLastExecutionCount = lastExecutionCount;
|
||||
#endif /* EFI_PROD_CODE */
|
||||
scheduleByAngle(rpm, &endTimer[structIndex], engineConfiguration->knockDetectionWindowEnd,
|
||||
scheduleByAngle(&endTimer[structIndex], engineConfiguration->knockDetectionWindowEnd,
|
||||
(schfunc_t) &endIntegration,
|
||||
NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->m.hipCbTime = getTimeNowLowerNt() - engine->m.beforeHipCb;
|
||||
|
|
Loading…
Reference in New Issue