better error handling

This commit is contained in:
rusefi 2017-03-12 22:46:01 -04:00
parent c1aae6cae2
commit a0d9617570
2 changed files with 7 additions and 3 deletions

View File

@ -214,6 +214,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
va_start(ap, fmt); va_start(ap, fmt);
vprintf(fmt, ap); vprintf(fmt, ap);
va_end(ap); va_end(ap);
printf("\r\n");
#if EFI_SIMULATOR || defined(__DOXYGEN__) #if EFI_SIMULATOR || defined(__DOXYGEN__)
exit(-1); exit(-1);

View File

@ -316,7 +316,8 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
efiAssertVoid(angle > 0, "angle should be positive"); efiAssertVoid(angle > 0, "angle should be positive");
if (size > 0) { if (size > 0) {
if (angle <= previousAngle) { if (angle <= previousAngle) {
firmwareError(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: %f and %f, size=%d", angle, previousAngle, size); warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: %f and %f, size=%d", angle, previousAngle, size);
shapeDefinitionError = true;
return; return;
} }
} }
@ -327,7 +328,8 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
single_wave_s *wave = &this->wave.waves[i]; single_wave_s *wave = &this->wave.waves[i];
if (wave->pinStates == NULL) { if (wave->pinStates == NULL) {
firmwareError(CUSTOM_ERR_STATE_NULL, "wave pinStates is NULL"); warning(CUSTOM_ERR_STATE_NULL, "wave pinStates is NULL");
shapeDefinitionError = true;
return; return;
} }
wave->pinStates[0] = initialState[i]; wave->pinStates[0] = initialState[i];
@ -341,7 +343,8 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
int exactMatch = wave.findAngleMatch(angle, size); int exactMatch = wave.findAngleMatch(angle, size);
if (exactMatch != EFI_ERROR_CODE) { if (exactMatch != EFI_ERROR_CODE) {
firmwareError(CUSTOM_ERR_6512, "same angle: not supported"); warning(CUSTOM_ERR_6512, "same angle: not supported");
shapeDefinitionError = true;
return; return;
} }