mirror of https://github.com/rusefi/rusefi.git
only: encapsulation/better name
This commit is contained in:
parent
86d21fffa9
commit
002a2ce016
|
@ -21,7 +21,10 @@ struct AngleBasedEvent {
|
||||||
*/
|
*/
|
||||||
AngleBasedEvent *nextToothEvent = nullptr;
|
AngleBasedEvent *nextToothEvent = nullptr;
|
||||||
|
|
||||||
angle_t enginePhase;
|
// angular position of this event
|
||||||
|
angle_t getAngle() const {
|
||||||
|
return enginePhase;
|
||||||
|
}
|
||||||
|
|
||||||
void setAngle(angle_t p_enginePhase) {
|
void setAngle(angle_t p_enginePhase) {
|
||||||
enginePhase = p_enginePhase;
|
enginePhase = p_enginePhase;
|
||||||
|
@ -29,6 +32,8 @@ struct AngleBasedEvent {
|
||||||
|
|
||||||
bool shouldSchedule(float currentPhase, float nextPhase) const;
|
bool shouldSchedule(float currentPhase, float nextPhase) const;
|
||||||
float getAngleFromNow(float currentPhase) const;
|
float getAngleFromNow(float currentPhase) const;
|
||||||
|
private:
|
||||||
|
angle_t enginePhase;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_OUTPUTS_FOR_IGNITION 2
|
#define MAX_OUTPUTS_FOR_IGNITION 2
|
||||||
|
|
|
@ -402,7 +402,7 @@ static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
if (verboseMode) {
|
if (verboseMode) {
|
||||||
printf("spark dwell@ %.1f spark@ %.2f id=%d\r\n", event->dwellAngle,
|
printf("spark dwell@ %.1f spark@ %.2f id=%d\r\n", event->dwellAngle,
|
||||||
event->sparkEvent.enginePhase,
|
event->sparkEvent.getAngle(),
|
||||||
event->sparkId);
|
event->sparkId);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,10 +45,10 @@ bool TriggerScheduler::scheduleOrQueue(const char *msg, AngleBasedEvent *event,
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerScheduler::schedule(const char *msg, AngleBasedEvent* event, action_s action) {
|
void TriggerScheduler::schedule(const char *msg, AngleBasedEvent* event, action_s action) {
|
||||||
if (event->enginePhase < 0) {
|
if (event->getAngle() < 0) {
|
||||||
// at the moment we expect API consumer to wrap angle. shall we do the wrapping in the enginePhase setter?
|
// at the moment we expect API consumer to wrap angle. shall we do the wrapping in the enginePhase setter?
|
||||||
// i.e. what is the best level to take care of the range constraint?
|
// i.e. what is the best level to take care of the range constraint?
|
||||||
criticalError("Negative angle %s %f", msg, event->enginePhase);
|
criticalError("Negative angle %s %f", msg, event->getAngle());
|
||||||
}
|
}
|
||||||
|
|
||||||
event->action = action;
|
event->action = action;
|
||||||
|
|
|
@ -320,7 +320,7 @@ const AngleBasedEvent * EngineTestHelper::assertTriggerEvent(const char *msg,
|
||||||
assertEqualsM4(msg, " callback up/down", (void*)event->action.getCallback() == (void*) callback, 1);
|
assertEqualsM4(msg, " callback up/down", (void*)event->action.getCallback() == (void*) callback, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEqualsM4(msg, " angle", enginePhase, event->enginePhase);
|
assertEqualsM4(msg, " angle", enginePhase, event->getAngle());
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue