NB2 trigger shape does not seem to match JimStim #2980
only first steps of unit test
This commit is contained in:
parent
a1791836b9
commit
9345e5d2e0
|
@ -366,7 +366,7 @@ void TriggerWaveform::setTriggerSynchronizationGap3(int gapIndex, float syncRati
|
|||
/**
|
||||
* this method is only used on initialization
|
||||
*/
|
||||
uint16_t TriggerWaveform::findAngleIndex(TriggerFormDetails *details, float target) const {
|
||||
uint16_t TriggerWaveform::findAngleIndex(TriggerFormDetails *details, angle_t targetAngle) const {
|
||||
size_t engineCycleEventCount = getLength();
|
||||
|
||||
efiAssert(CUSTOM_ERR_ASSERT, engineCycleEventCount != 0 && engineCycleEventCount <= 0xFFFF, "engineCycleEventCount", 0);
|
||||
|
@ -382,9 +382,9 @@ uint16_t TriggerWaveform::findAngleIndex(TriggerFormDetails *details, float targ
|
|||
int middle = (left + right) / 2;
|
||||
angle_t eventAngle = details->eventAngles[middle];
|
||||
|
||||
if (eventAngle < target) {
|
||||
if (eventAngle < targetAngle) {
|
||||
left = middle + 1;
|
||||
} else if (eventAngle > target) {
|
||||
} else if (eventAngle > targetAngle) {
|
||||
right = middle - 1;
|
||||
} else {
|
||||
// Values are equal
|
||||
|
|
|
@ -276,10 +276,11 @@ public:
|
|||
const trigger_config_s& triggerConfig
|
||||
);
|
||||
|
||||
uint16_t findAngleIndex(TriggerFormDetails *details, angle_t angle) const;
|
||||
|
||||
private:
|
||||
trigger_shape_helper h;
|
||||
|
||||
uint16_t findAngleIndex(TriggerFormDetails *details, float angle) const;
|
||||
|
||||
/**
|
||||
* Working buffer for 'wave' instance
|
||||
|
|
|
@ -14,6 +14,18 @@ static void postFourEvents(EngineTestHelper *eth, float mult) {
|
|||
eth->fireRise(mult * 16);
|
||||
}
|
||||
|
||||
TEST(engine, testAngleLogicInSymmetricalCrankIssue2980) {
|
||||
WITH_ENGINE_TEST_HELPER(MAZDA_MIATA_2003);
|
||||
|
||||
TriggerFormDetails *triggerForm = &ENGINE(triggerCentral.triggerFormDetails);
|
||||
|
||||
TriggerWaveform * form = &ENGINE(triggerCentral.triggerShape);
|
||||
|
||||
ASSERT_EQ(form->findAngleIndex(triggerForm, 10), 1);
|
||||
ASSERT_EQ(form->findAngleIndex(triggerForm, 310), 5);
|
||||
ASSERT_EQ(form->findAngleIndex(triggerForm, 710), 15);
|
||||
}
|
||||
|
||||
TEST(engine, testSymmetricalCrank) {
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(MAZDA_MIATA_2003);
|
||||
|
|
Loading…
Reference in New Issue