trigger structure api accepts bool #55

This commit is contained in:
Matthew Kennedy 2023-05-30 22:48:07 -07:00
parent ad3ea57276
commit ce1dad1100
3 changed files with 10 additions and 4 deletions

View File

@ -222,6 +222,10 @@ void TriggerWaveform::addEvent720(angle_t angle, TriggerValue const state, Trigg
}
void TriggerWaveform::addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex) {
addEvent360(angle, state == TriggerValue::RISE, channelIndex);
}
void TriggerWaveform::addEvent360(angle_t angle, bool state, TriggerWheel const channelIndex) {
efiAssertVoid(ObdCode::CUSTOM_OMODE_UNDEF, operationMode == FOUR_STROKE_CAM_SENSOR || operationMode == FOUR_STROKE_CRANK_SENSOR, "Not a mode for 360");
addEvent(CRANK_MODE_MULTIPLIER * angle / FOUR_STROKE_CYCLE_DURATION, state, channelIndex);
}
@ -230,10 +234,11 @@ void TriggerWaveform::addEventAngle(angle_t angle, TriggerValue const state, Tri
addEvent(angle / getCycleDuration(), state, channelIndex);
}
void TriggerWaveform::addEvent(angle_t angle, TriggerValue const stateTv, TriggerWheel const channelIndex) {
// TODO: #55
bool state = stateTv == TriggerValue::RISE;
void TriggerWaveform::addEvent(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex) {
addEvent(angle, state == TriggerValue::RISE, channelIndex);
}
void TriggerWaveform::addEvent(angle_t angle, bool state, TriggerWheel const channelIndex) {
efiAssertVoid(ObdCode::CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set");
if (channelIndex == TriggerWheel:: T_SECONDARY) {

View File

@ -181,6 +181,7 @@ public:
* @param angle (0..1]
*/
void addEvent(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex = TriggerWheel::T_PRIMARY);
void addEvent(angle_t angle, bool state, TriggerWheel const channelIndex = TriggerWheel::T_PRIMARY);
/* (0..720] angle range
* Deprecated! many usages should be replaced by addEvent360
*/
@ -190,6 +191,7 @@ public:
* this method helps us use real world 360 degrees shape for FOUR_STROKE_CAM_SENSOR and FOUR_STROKE_CRANK_SENSOR
*/
void addEvent360(angle_t angle, TriggerValue const state, TriggerWheel const channelIndex = TriggerWheel::T_PRIMARY);
void addEvent360(angle_t angle, bool state, TriggerWheel const channelIndex = TriggerWheel::T_PRIMARY);
/**
* This version of the method is best when same wheel could be mounted either on crank or cam

View File

@ -12,7 +12,6 @@
#include "fuel_math.h"
#include "accel_enrichment.h"
#include "advance_map.h"
#include "tooth_logger.h"
#include "logicdata.h"
#include "hardware.h"