custom codes cleanup

This commit is contained in:
rusefi 2019-11-04 09:20:00 -05:00
parent bc0cdd484f
commit eae44843b1
4 changed files with 12 additions and 9 deletions

View File

@ -2051,10 +2051,10 @@ typedef enum {
CUSTOM_ERR_6688 = 6688,
CUSTOM_ERR_6689 = 6689,
CUSTOM_ERR_6690 = 6690,
CUSTOM_ERR_MAP_START_ASSERT = 6690,
CUSTOM_ERR_MAP_AVG_OFFSET = 6691,
CUSTOM_ERR_6692 = 6692,
CUSTOM_ERR_6693 = 6693,
CUSTOM_ERR_MAP_CYL_OFFSET = 6692,
CUSTOM_ERR_PWM_DUTY_ASSERT = 6693,
CUSTOM_ERR_ZERO_CRANKING_FUEL = 6694,
CUSTOM_ERR_6695 = 6695,
CUSTOM_ERR_6696 = 6696,
@ -2075,6 +2075,9 @@ typedef enum {
CUSTOM_ERR_PIN_COUNT_TOO_LARGE = 6709,
CUSTOM_DUTY_INVALID = 6710,
CUSTOM_DUTY_TOO_HIGH = 6711,
CUSTOM_ERR_PWM_STATE_ASSERT = 6712,
CUSTOM_ERR_PWM_CALLBACK_ASSERT = 6713,
CUSTOM_ERR_PWM_SWITCH_ASSERT = 6714,
CUSTOM_ERR_TRIGGER_SYNC = 9000,

View File

@ -93,6 +93,6 @@ int MultiWave::findAngleMatch(const float angle, const int size) const {
}
void MultiWave::setSwitchTime(const int index, const float value) {
efiAssertVoid(CUSTOM_ERR_6690, switchTimes != NULL, "switchTimes");
efiAssertVoid(CUSTOM_ERR_PWM_SWITCH_ASSERT, switchTimes != NULL, "switchTimes");
switchTimes[index] = value;
}

View File

@ -233,14 +233,14 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (isValidRpm(rpm)) {
MAP_sensor_config_s * c = &engineConfiguration->map;
angle_t start = interpolate2d("mapa", rpm, c->samplingAngleBins, c->samplingAngle);
efiAssertVoid(CUSTOM_ERR_6690, !cisnan(start), "start");
efiAssertVoid(CUSTOM_ERR_MAP_START_ASSERT, !cisnan(start), "start");
angle_t offsetAngle = TRIGGER_SHAPE(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]);
efiAssertVoid(CUSTOM_ERR_MAP_AVG_OFFSET, !cisnan(offsetAngle), "offsetAngle");
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
angle_t cylinderOffset = getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) * i / engineConfiguration->specs.cylindersCount;
efiAssertVoid(CUSTOM_ERR_6692, !cisnan(cylinderOffset), "cylinderOffset");
efiAssertVoid(CUSTOM_ERR_MAP_CYL_OFFSET, !cisnan(cylinderOffset), "cylinderOffset");
// part of this formula related to specific cylinder offset is never changing - we can
// move the loop into start-up calculation and not have this loop as part of periodic calculation
// todo: change the logic as described above in order to reduce periodic CPU usage?

View File

@ -316,9 +316,9 @@ void PwmConfig::weComplexInit(const char *msg, ExecutorInterface *executor,
void startSimplePwm(SimplePwm *state, const char *msg, ExecutorInterface *executor,
OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(CUSTOM_ERR_6692, state != NULL, "state");
efiAssertVoid(CUSTOM_ERR_6665, dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
efiAssertVoid(CUSTOM_ERR_6693, stateChangeCallback != NULL, "listener");
efiAssertVoid(CUSTOM_ERR_PWM_STATE_ASSERT, state != NULL, "state");
efiAssertVoid(CUSTOM_ERR_PWM_DUTY_ASSERT, dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
efiAssertVoid(CUSTOM_ERR_PWM_CALLBACK_ASSERT, stateChangeCallback != NULL, "listener");
if (frequency < 1) {
warning(CUSTOM_OBD_LOW_FREQUENCY, "low frequency %.2f", frequency);
return;