From 935a9fa706cf5c50c6185e7bf51ffac62b97bf49 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 3 Feb 2019 01:19:16 -0500 Subject: [PATCH] Refactor Trigger System #635 --- firmware/controllers/core/EfiWave.cpp | 4 ++-- firmware/controllers/core/EfiWave.h | 4 ++-- firmware/controllers/system/pwm_generator_logic.cpp | 2 +- firmware/controllers/trigger/decoders/trigger_structure.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/controllers/core/EfiWave.cpp b/firmware/controllers/core/EfiWave.cpp index ab0a981b71..7ae28726ae 100644 --- a/firmware/controllers/core/EfiWave.cpp +++ b/firmware/controllers/core/EfiWave.cpp @@ -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; } diff --git a/firmware/controllers/core/EfiWave.h b/firmware/controllers/core/EfiWave.h index 275cfa2ead..30dcc4d13f 100644 --- a/firmware/controllers/core/EfiWave.h +++ b/firmware/controllers/core/EfiWave.h @@ -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; diff --git a/firmware/controllers/system/pwm_generator_logic.cpp b/firmware/controllers/system/pwm_generator_logic.cpp index 74db237cf5..2c38a6c846 100644 --- a/firmware/controllers/system/pwm_generator_logic.cpp +++ b/firmware/controllers/system/pwm_generator_logic.cpp @@ -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); } } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.h b/firmware/controllers/trigger/decoders/trigger_structure.h index aaea4ad9a3..88abbf9170 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.h +++ b/firmware/controllers/trigger/decoders/trigger_structure.h @@ -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]; /**