Refactor Trigger System #635

This commit is contained in:
rusefi 2019-02-03 01:19:16 -05:00
parent 8011d287c4
commit 0b41d011b7
4 changed files with 6 additions and 6 deletions

View File

@ -21,11 +21,11 @@ void SingleWave::init(pin_state_t *pinStates) {
this->pinStates = pinStates;
}
int SingleWave::getState(int switchIndex) {
pin_state_t SingleWave::getState(int switchIndex) {
return pinStates[switchIndex];
}
void SingleWave::setState(int switchIndex, int state) {
void SingleWave::setState(int switchIndex, pin_state_t state) {
pinStates[switchIndex] = state;
}

View File

@ -39,8 +39,8 @@ public:
* todo: confirm that we only deal with two states here, no magic '-1'?
* @return HIGH or LOW state at given index
*/
int getState(int switchIndex);
void setState(int switchIndex, int state);
pin_state_t getState(int switchIndex);
void setState(int switchIndex, pin_state_t state);
// todo: make this private by using 'getState' and 'setState' methods
pin_state_t *pinStates;

View File

@ -254,7 +254,7 @@ void copyPwmParameters(PwmConfig *state, int phaseCount, float const *switchTime
for (int channelIndex = 0; channelIndex < waveCount; channelIndex++) {
// print("output switch time index (%d/%d) at %.2f to %d\r\n", phaseIndex, channelIndex,
// switchTimes[phaseIndex], pinStates[waveIndex][phaseIndex]);
int value = pinStates[channelIndex][phaseIndex];
pin_state_t value = pinStates[channelIndex][phaseIndex];
state->multiWave.channels[channelIndex].setState(phaseIndex, value);
}
}

View File

@ -186,7 +186,7 @@ public:
// todo: add a runtime validation which would verify that this field was set properly
// todo: maybe even automate this flag calculation?
int initialState[PWM_PHASE_MAX_WAVE_PER_PWM];
pin_state_t initialState[PWM_PHASE_MAX_WAVE_PER_PWM];
int8_t isFrontEvent[PWM_PHASE_MAX_COUNT];
/**