diff --git a/firmware/controllers/core/state_sequence.cpp b/firmware/controllers/core/state_sequence.cpp index 77b58f78c7..0c71a2591b 100644 --- a/firmware/controllers/core/state_sequence.cpp +++ b/firmware/controllers/core/state_sequence.cpp @@ -53,9 +53,10 @@ float MultiChannelStateSequence::getSwitchTime(const int index) const { return switchTimes[index]; } -void MultiChannelStateSequence::checkSwitchTimes(const int size) { +void MultiChannelStateSequence::checkSwitchTimes(const int size, const float scale) { if (switchTimes[size - 1] != 1) { - firmwareError(CUSTOM_ERR_WAVE_1, "last switch time has to be 1 not %.2f", switchTimes[size - 1]); + firmwareError(CUSTOM_ERR_WAVE_1, "last switch time has to be 1/%f not %.2f/%f", scale, + switchTimes[size - 1], scale * switchTimes[size - 1]); return; } for (int i = 0; i < size - 1; i++) { diff --git a/firmware/controllers/core/state_sequence.h b/firmware/controllers/core/state_sequence.h index ee6969a7f2..d94fd22cea 100644 --- a/firmware/controllers/core/state_sequence.h +++ b/firmware/controllers/core/state_sequence.h @@ -71,7 +71,7 @@ public: void reset(void); float getSwitchTime(const int phaseIndex) const; void setSwitchTime(const int phaseIndex, const float value); - void checkSwitchTimes(const int size); + void checkSwitchTimes(const int size, const float scale); pin_state_t getChannelState(const int channelIndex, const int phaseIndex) const; int findAngleMatch(const float angle, const int size) const; diff --git a/firmware/controllers/system/timer/pwm_generator_logic.cpp b/firmware/controllers/system/timer/pwm_generator_logic.cpp index 6c3c90d1dc..dc24038a63 100644 --- a/firmware/controllers/system/timer/pwm_generator_logic.cpp +++ b/firmware/controllers/system/timer/pwm_generator_logic.cpp @@ -283,7 +283,7 @@ void copyPwmParameters(PwmConfig *state, int phaseCount, float const *switchTime } } if (state->mode == PM_NORMAL) { - state->multiChannelStateSequence.checkSwitchTimes(phaseCount); + state->multiChannelStateSequence.checkSwitchTimes(phaseCount, 1); } } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 48de5b58eb..f0d3b1537f 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -237,7 +237,10 @@ void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex efiAssertVoid(CUSTOM_ERR_6599, angle > 0, "angle should be positive"); if (privateTriggerDefinitionSize > 0) { if (angle <= previousAngle) { - warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: new=%.2f and prev=%.2f, size=%d", angle, previousAngle, privateTriggerDefinitionSize); + warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: new=%.2f/%f and prev=%.2f/%f, size=%d", + angle, angle * getCycleDuration(), + previousAngle, previousAngle * getCycleDuration(), + privateTriggerDefinitionSize); setShapeDefinitionError(true); return; } @@ -653,7 +656,7 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_ version++; if (!shapeDefinitionError) { - wave.checkSwitchTimes(getSize()); + wave.checkSwitchTimes(getSize(), getCycleDuration()); } }