refactoring - better method name and removing a bit of dead code
This commit is contained in:
parent
644635bf44
commit
56ec05e37d
|
@ -47,7 +47,7 @@ public:
|
|||
int getChannelState(int channelIndex, int phaseIndex) const;
|
||||
|
||||
int findAngleMatch(float angle, int size) const;
|
||||
int waveIndertionAngle(float angle, int size) const;
|
||||
int findInsertionAngle(float angle, int size) const;
|
||||
|
||||
/**
|
||||
* Number of signal wires
|
||||
|
|
|
@ -146,7 +146,10 @@ int multi_wave_s::getChannelState(int channelIndex, int phaseIndex) const {
|
|||
return waves[channelIndex].pinStates[phaseIndex];
|
||||
}
|
||||
|
||||
int multi_wave_s::waveIndertionAngle(float angle, int size) const {
|
||||
/**
|
||||
* returns the index at which given value would need to be inserted into sorted array
|
||||
*/
|
||||
int multi_wave_s::findInsertionAngle(float angle, int size) const {
|
||||
for (int i = size - 1; i >= 0; i--) {
|
||||
if (angle > switchTimes[i])
|
||||
return i + 1;
|
||||
|
@ -388,24 +391,27 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
|
|||
return;
|
||||
}
|
||||
|
||||
int index = wave.waveIndertionAngle(angle, size);
|
||||
int index = wave.findInsertionAngle(angle, size);
|
||||
|
||||
// shifting existing data
|
||||
/**
|
||||
* todo: it would be nice to be able to provide trigger angles without sorting them externally
|
||||
* The idea here is to shift existing data - including handling high vs low state of the signals
|
||||
*/
|
||||
// todo: does this logic actually work? I think it does not! due to broken state handling
|
||||
/*
|
||||
for (int i = size - 1; i >= index; i--) {
|
||||
for (int j = 0; j < PWM_PHASE_MAX_WAVE_PER_PWM; j++) {
|
||||
wave.waves[j].pinStates[i + 1] = wave.getChannelState(j, index);
|
||||
}
|
||||
wave.setSwitchTime(i + 1, wave.getSwitchTime(i));
|
||||
}
|
||||
|
||||
*/
|
||||
isFrontEvent[index] = TV_RISE == stateParam;
|
||||
|
||||
if (index != size) {
|
||||
firmwareError(ERROR_TRIGGER_DRAMA, "are we ever here?");
|
||||
}
|
||||
|
||||
// int index = size;
|
||||
size++;
|
||||
|
||||
for (int i = 0; i < PWM_PHASE_MAX_WAVE_PER_PWM; i++) {
|
||||
|
|
|
@ -157,8 +157,8 @@ static void confgiureFordAspireTriggerShape(TriggerShape * s DECLARE_ENGINE_PARA
|
|||
assertEqualsM("expecting not found", -1, s->wave.findAngleMatch(53 / 720.0, s->getSize()));
|
||||
assertEquals(7, s->wave.findAngleMatch(588.045 / 720.0, s->getSize()));
|
||||
|
||||
assertEqualsM("expecting 0", 0, s->wave.waveIndertionAngle(23.747 / 720.0, s->getSize()));
|
||||
assertEqualsM("expecting 1", 1, s->wave.waveIndertionAngle(63.747 / 720.0, s->getSize()));
|
||||
assertEqualsM("expecting 0", 0, s->wave.findInsertionAngle(23.747 / 720.0, s->getSize()));
|
||||
assertEqualsM("expecting 1", 1, s->wave.findInsertionAngle(63.747 / 720.0, s->getSize()));
|
||||
}
|
||||
|
||||
void testAngleResolver(void) {
|
||||
|
|
|
@ -2411,7 +2411,7 @@ event 182 1001 541.00
|
|||
event 183 1000 542.00
|
||||
event 184 1001 543.00
|
||||
event 185 0 544.00
|
||||
TRIGGERTYPE 39 32 TT_DODGE_NEON_1995_ONLY_CRANK 0.00
|
||||
TRIGGERTYPE 39 32 TT_DODGE_NEON_1995_ONLY_CRANK 279.00
|
||||
# duty 0.80 0.00
|
||||
event 0 1 0.00
|
||||
event 1 0 4.00
|
||||
|
|
Loading…
Reference in New Issue