parent
e4f3989603
commit
b28740c20e
|
@ -107,8 +107,9 @@ static scheduling_s endTimer[INJECTION_PIN_COUNT][2];
|
|||
*/
|
||||
static bool isAveraging = false;
|
||||
|
||||
static void startAveraging(void *arg) {
|
||||
(void) arg;
|
||||
static void endAveraging(void *arg);
|
||||
|
||||
static void startAveraging(scheduling_s *endAveragingScheduling) {
|
||||
efiAssertVoid(CUSTOM_ERR_6649, getCurrentRemainingStack() > 128, "lowstck#9");
|
||||
|
||||
bool wasLocked = lockAnyContext();
|
||||
|
@ -121,6 +122,11 @@ static void startAveraging(void *arg) {
|
|||
}
|
||||
|
||||
mapAveragingPin.setHigh();
|
||||
|
||||
#if ! EFI_UNIT_TEST
|
||||
scheduleByAngle(endAveragingScheduling, getTimeNowNt(), ENGINE(engineState.mapAveragingDuration),
|
||||
endAveraging PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAL_USE_ADC
|
||||
|
@ -304,7 +310,6 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
fixAngle(samplingEnd, "samplingEnd", CUSTOM_ERR_6563);
|
||||
// only if value is already prepared
|
||||
int structIndex = getRevolutionCounter() % 2;
|
||||
|
@ -312,9 +317,7 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
|||
// 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(&startTimer[i][structIndex], edgeTimestamp, samplingStart,
|
||||
startAveraging PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
scheduleByAngle(&endTimer[i][structIndex], edgeTimestamp, samplingEnd,
|
||||
endAveraging PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
{ startAveraging, &endTimer[i][structIndex] } PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -347,11 +350,6 @@ float getMap(void) {
|
|||
void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
logger = sharedLogger;
|
||||
|
||||
// startTimer[0].name = "map start0";
|
||||
// startTimer[1].name = "map start1";
|
||||
// endTimer[0].name = "map end0";
|
||||
// endTimer[1].name = "map end1";
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine);
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
|
Loading…
Reference in New Issue