unique error codes #598

This commit is contained in:
rusefi 2018-07-25 23:03:04 -04:00
parent bb15cb20fd
commit 959a91ae4c
48 changed files with 240 additions and 108 deletions

View File

@ -155,7 +155,7 @@ bool stopTsPort(ts_channel_s *tsChannel) {
}
void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 64, "tunerStudioWriteData");
efiAssertVoid(CUSTOM_ERR_6570, getRemainingStack(chThdGetSelfX()) > 64, "tunerStudioWriteData");
#if EFI_SIMULATOR || defined(__DOXYGEN__)
logMsg("chSequentialStreamWrite [%d]\r\n", size);
#endif

View File

@ -155,7 +155,7 @@ void runConsoleLoop(ts_channel_s *console) {
}
while (true) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstck#9e");
efiAssertVoid(CUSTOM_ERR_6571, getRemainingStack(chThdGetSelfX()) > 256, "lowstck#9e");
bool end = getConsoleLine((BaseSequentialStream*) console->channel, console->crcReadBuffer, sizeof(console->crcReadBuffer) - 3);
if (end) {
// firmware simulator is the only case when this happens

View File

@ -1301,7 +1301,7 @@ void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "apply c");
efiAssertVoid(CUSTOM_ERR_6620, getRemainingStack(chThdGetSelfX()) > 256, "apply c");
scheduleMsg(logger, "applyNonPersistentConfiguration()");
#endif

View File

@ -1927,9 +1927,141 @@ typedef enum {
CUSTOM_ERR_6565 = 6565,
CUSTOM_ERR_6566 = 6566,
CUSTOM_ERR_6567 = 6567,
CUSTOM_ERR_6568 = 6567,
CUSTOM_ERR_6568 = 6568,
CUSTOM_ERR_6569 = 6569,
CUSTOM_ERR_6570 = 6570,
CUSTOM_ERR_6571 = 6571,
CUSTOM_ERR_6572 = 6572,
CUSTOM_ERR_6573 = 6573,
CUSTOM_ERR_6574 = 6574,
CUSTOM_ERR_6575 = 6575,
CUSTOM_ERR_6576 = 6576,
CUSTOM_ERR_6577 = 6577,
CUSTOM_ERR_6578 = 6578,
CUSTOM_ERR_6579 = 6579,
CUSTOM_ERR_6580 = 6580,
CUSTOM_ERR_6581 = 6581,
CUSTOM_ERR_6582 = 6582,
CUSTOM_ERR_6583 = 6583,
CUSTOM_ERR_6584 = 6584,
CUSTOM_ERR_6585 = 6585,
CUSTOM_ERR_6586 = 6586,
CUSTOM_ERR_6587 = 6587,
CUSTOM_ERR_6588 = 6588,
CUSTOM_ERR_6589 = 6589,
CUSTOM_ERR_6590 = 6590,
CUSTOM_ERR_6591 = 6591,
CUSTOM_ERR_6592 = 6592,
CUSTOM_ERR_6593 = 6593,
CUSTOM_ERR_6594 = 6594,
CUSTOM_ERR_6595 = 6595,
CUSTOM_ERR_6596 = 6596,
CUSTOM_ERR_6597 = 6597,
CUSTOM_ERR_6598 = 6598,
CUSTOM_ERR_6599 = 6599,
CUSTOM_ERR_6600 = 6600,
CUSTOM_ERR_6601 = 6601,
CUSTOM_ERR_6602 = 6602,
CUSTOM_ERR_6603 = 6603,
CUSTOM_ERR_6604 = 6604,
CUSTOM_ERR_6605 = 6605,
CUSTOM_ERR_6606 = 6606,
CUSTOM_ERR_6607 = 6607,
CUSTOM_ERR_6608 = 6608,
CUSTOM_ERR_6609 = 6609,
CUSTOM_ERR_6610 = 6610,
CUSTOM_ERR_6611 = 6611,
CUSTOM_ERR_6612 = 6612,
CUSTOM_ERR_6613 = 6613,
CUSTOM_ERR_6614 = 6614,
CUSTOM_ERR_6615 = 6615,
CUSTOM_ERR_6616 = 6616,
CUSTOM_ERR_6617 = 6617,
CUSTOM_ERR_6618 = 6618,
CUSTOM_ERR_6619 = 6619,
CUSTOM_ERR_6620 = 6620,
CUSTOM_ERR_6621 = 6621,
CUSTOM_ERR_6622 = 6622,
CUSTOM_ERR_6623 = 6623,
CUSTOM_ERR_6624 = 6624,
CUSTOM_ERR_6625 = 6625,
CUSTOM_ERR_6626 = 6626,
CUSTOM_ERR_6627 = 6627,
CUSTOM_ERR_6628 = 6628,
CUSTOM_ERR_6629 = 6629,
CUSTOM_ERR_6630 = 6630,
CUSTOM_ERR_6631 = 6631,
CUSTOM_ERR_6632 = 6632,
CUSTOM_ERR_6633 = 6633,
CUSTOM_ERR_6634 = 6634,
CUSTOM_ERR_6635 = 6635,
CUSTOM_ERR_6636 = 6636,
CUSTOM_ERR_6637 = 6637,
CUSTOM_ERR_6638 = 6638,
CUSTOM_ERR_6639 = 6639,
CUSTOM_ERR_6640 = 6640,
CUSTOM_ERR_6641 = 6641,
CUSTOM_ERR_6642 = 6642,
CUSTOM_ERR_6643 = 6643,
CUSTOM_ERR_6644 = 6644,
CUSTOM_ERR_6645 = 6645,
CUSTOM_ERR_6646 = 6646,
CUSTOM_ERR_6647 = 6647,
CUSTOM_ERR_6648 = 6648,
CUSTOM_ERR_6649 = 6649,
CUSTOM_ERR_6650 = 6650,
CUSTOM_ERR_6651 = 6651,
CUSTOM_ERR_6652 = 6652,
CUSTOM_ERR_6653 = 6653,
CUSTOM_ERR_6654 = 6654,
CUSTOM_ERR_6655 = 6655,
CUSTOM_ERR_6656 = 6656,
CUSTOM_ERR_6657 = 6657,
CUSTOM_ERR_6658 = 6658,
CUSTOM_ERR_6659 = 6659,
CUSTOM_ERR_6660 = 6660,
CUSTOM_ERR_6661 = 6661,
CUSTOM_ERR_6662 = 6662,
CUSTOM_ERR_6663 = 6663,
CUSTOM_ERR_6664 = 6664,
CUSTOM_ERR_6665 = 6665,
CUSTOM_ERR_6666 = 6666,
CUSTOM_ERR_6667 = 6667,
CUSTOM_ERR_6668 = 6668,
CUSTOM_ERR_6669 = 6669,
CUSTOM_ERR_6670 = 6670,
CUSTOM_ERR_6671 = 6671,
CUSTOM_ERR_6672 = 6672,
CUSTOM_ERR_6673 = 6673,
CUSTOM_ERR_6674 = 6674,
CUSTOM_ERR_6675 = 6675,
CUSTOM_ERR_6676 = 6676,
CUSTOM_ERR_6677 = 6677,
CUSTOM_ERR_6678 = 6678,
CUSTOM_ERR_6679 = 6679,
CUSTOM_ERR_6680 = 6680,
CUSTOM_ERR_6681 = 6681,
CUSTOM_ERR_6682 = 6682,
CUSTOM_ERR_6683 = 6683,
CUSTOM_ERR_6684 = 6684,
CUSTOM_ERR_6685 = 6685,
CUSTOM_ERR_6686 = 6686,
CUSTOM_ERR_6687 = 6687,
CUSTOM_ERR_6688 = 6688,
CUSTOM_ERR_6689 = 6689,
// this is needed for proper enum size, this matters for malfunction_central
Internal_ForceMyEnumIntSize_cranking_obd_code = ENUM_32_BITS,
} obd_code_e;

View File

@ -127,8 +127,8 @@ void setAltPFactor(float p) {
}
static void applyAlternatorPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(state->multiWave.waveCount == 1, "invalid idle waveCount");
efiAssertVoid(CUSTOM_ERR_6643, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6644, state->multiWave.waveCount == 1, "invalid idle waveCount");
OutputPin *output = state->outputPins[0];
int value = state->multiWave.waves[0].pinStates[stateIndex];
/**

View File

@ -107,7 +107,7 @@ ArrayList<Type, Dimention>::ArrayList(void) {
template<class Type, int Dimention>
void ArrayList<Type, Dimention>::removeAt(int index) {
efiAssertVoid(index < size, "index greater then size");
efiAssertVoid(CUSTOM_ERR_6572, index < size, "index greater then size");
memcpy(&elements[index], &elements[size - 1], sizeof(Type));
memset(&elements[size - 1], 0, sizeof(Type));
size--;

View File

@ -114,7 +114,7 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl
// a*x1 + b = y1
// a*x2 + b = y2
// efiAssertVoid(x1 != x2, "no way we can interpolate");
// efiAssertVoid(CUSTOM_ERR_ASSERT_VOID, x1 != x2, "no way we can interpolate");
float a = INTERPOLATION_A(x1, y1, x2, y2);
float b = y1 - a * x1;
float result = a * x + b;

View File

@ -118,7 +118,7 @@ void Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE, vType>::create(const char *name, float m
template<int RPM_BIN_SIZE, int LOAD_BIN_SIZE, typename vType>
void Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE, vType>::setAll(vType value) {
efiAssertVoid(initialized, "map not initialized");
efiAssertVoid(CUSTOM_ERR_6573, initialized, "map not initialized");
for (int l = 0; l < LOAD_BIN_SIZE; l++) {
for (int r = 0; r < RPM_BIN_SIZE; r++) {
pointers[l][r] = value / multiplier;

View File

@ -244,7 +244,7 @@ static void resetAccel(void) {
}
static void periodicSlowCallback(Engine *engine) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 64, "lowStckOnEv");
efiAssertVoid(CUSTOM_ERR_6661, getRemainingStack(chThdGetSelfX()) > 64, "lowStckOnEv");
#if EFI_PROD_CODE
/**
* We need to push current value into the 64 bit counter often enough so that we do not miss an overflow
@ -733,5 +733,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20180722;
return 20180723;
}

View File

@ -56,10 +56,10 @@ int getRusEfiVersion(void);
*/
#if EFI_ENABLE_ASSERTS
#define efiAssert(condition, message, result) { if (!(condition)) { firmwareError(CUSTOM_ERR_ASSERT, message); return result; } }
#define efiAssertVoid(condition, message) { if (!(condition)) { firmwareError(CUSTOM_ERR_ASSERT_VOID, message); return; } }
#define efiAssertVoid(code, condition, message) { if (!(condition)) { firmwareError(code, message); return; } }
#else /* EFI_ENABLE_ASSERTS */
#define efiAssert(condition, message, result) { }
#define efiAssertVoid(condition, message) { }
#define efiAssertVoid(code, condition, message) { }
#endif /* EFI_ENABLE_ASSERTS */
#ifdef __cplusplus

View File

@ -411,8 +411,8 @@ void setDefaultIdleParameters(void) {
}
static void applyIdleSolenoidPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(state->multiWave.waveCount == 1, "invalid idle waveCount");
efiAssertVoid(CUSTOM_ERR_6645, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6646, state->multiWave.waveCount == 1, "invalid idle waveCount");
OutputPin *output = state->outputPins[0];
int value = state->multiWave.waves[0].pinStates[stateIndex];
if (!value /* always allow turning solenoid off */ ||

View File

@ -54,7 +54,7 @@ static void assertCylinderId(int cylinderId, const char *msg) {
// we are here only in case of a fatal issue - at this point it is fine to make some blocking i-o
//scheduleSimpleMsg(&logger, "cid=", cylinderId);
print("ERROR [%s] cid=%d\r\n", msg, cylinderId);
efiAssertVoid(false, "Cylinder ID");
efiAssertVoid(CUSTOM_ERR_6647, false, "Cylinder ID");
}
}
@ -73,7 +73,7 @@ static void printInjectorsStatus(void) {
}
static void setInjectorEnabled(int id, int value) {
efiAssertVoid(id >= 0 && id < engineConfiguration->specs.cylindersCount, "injector id");
efiAssertVoid(CUSTOM_ERR_6648, id >= 0 && id < engineConfiguration->specs.cylindersCount, "injector id");
is_injector_enabled[id] = value;
printInjectorsStatus();
}

View File

@ -109,7 +109,7 @@ static bool isAveraging = false;
static void startAveraging(void *arg) {
(void) arg;
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9");
efiAssertVoid(CUSTOM_ERR_6649, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9");
bool wasLocked = lockAnyContext();
;
// with locking we would have a consistent state
@ -135,7 +135,7 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
/* Calculates the average values from the ADC samples.*/
measurementsPerRevolutionCounter++;
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9a");
efiAssertVoid(CUSTOM_ERR_6650, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9a");
#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
if (ENGINE(sensorChartMode) == SC_MAP) {

View File

@ -292,18 +292,18 @@ int TriggerShape::findAngleIndex(float target DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
void TriggerShape::findTriggerPosition(event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(!cisnan(angleOffset), "findAngle#1");
efiAssertVoid(CUSTOM_ERR_6574, !cisnan(angleOffset), "findAngle#1");
assertAngleRange(angleOffset, "findAngle#a1", CUSTOM_ERR_6545);
efiAssertVoid(!cisnan(ENGINE(triggerCentral.triggerShape.tdcPosition)), "tdcPos#1")
efiAssertVoid(CUSTOM_ERR_6575, !cisnan(ENGINE(triggerCentral.triggerShape.tdcPosition)), "tdcPos#1")
assertAngleRange(ENGINE(triggerCentral.triggerShape.tdcPosition), "tdcPos#a1", CUSTOM_ERR_6546);
efiAssertVoid(!cisnan(CONFIG(globalTriggerAngleOffset)), "tdcPos#2")
efiAssertVoid(CUSTOM_ERR_6576, !cisnan(CONFIG(globalTriggerAngleOffset)), "tdcPos#2")
assertAngleRange(CONFIG(globalTriggerAngleOffset), "tdcPos#a2", CUSTOM_ERR_6547);
// convert engine cycle angle into trigger cycle angle
angleOffset += tdcPosition();
efiAssertVoid(!cisnan(angleOffset), "findAngle#2");
efiAssertVoid(CUSTOM_ERR_6577, !cisnan(angleOffset), "findAngle#2");
fixAngle(angleOffset, "addFuel#2", CUSTOM_ERR_6555);
int index = triggerIndexByAngle[(int)angleOffset];

View File

@ -16,7 +16,7 @@
void setAlgorithm(engine_load_mode_e algo DECLARE_ENGINE_PARAMETER_SUFFIX);
#define assertEngineReference() efiAssertVoid(engine != NULL, "engine is NULL")
#define assertEngineReference() efiAssertVoid(CUSTOM_ERR_6600, engine != NULL, "engine is NULL")
#if EFI_ENABLE_ASSERTS

View File

@ -80,7 +80,7 @@ static void obdSendPacket(int mode, int PID, int numBytes, uint32_t iValue) {
}
static void obdSendValue(int mode, int PID, int numBytes, float value) {
efiAssertVoid(numBytes <= 2, "invalid numBytes");
efiAssertVoid(CUSTOM_ERR_6662, numBytes <= 2, "invalid numBytes");
int iValue = (int)efiRound(value, 1.0f);
// clamp to uint8_t (0..255) or uint16_t (0..65535)
iValue = maxI(minI(iValue, (numBytes == 1) ? 255 : 65535), 0);

View File

@ -242,7 +242,7 @@ static void testCltByR(float resistance) {
void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
efiAssertVoid(engine!=NULL, "e NULL initThermistors");
efiAssertVoid(CUSTOM_ERR_6578, engine!=NULL, "e NULL initThermistors");
#if EFI_PROD_CODE || defined(__DOXYGEN__)
addConsoleActionF("test_clt_by_r", testCltByR);

View File

@ -41,7 +41,7 @@ uint32_t lastExecutionCount;
static void executorCallback(void *arg) {
(void)arg;
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstck#2y");
efiAssertVoid(CUSTOM_ERR_6624, getRemainingStack(chThdGetSelfX()) > 256, "lowstck#2y");
// callbackTime = getTimeNowNt();
// if((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) {
@ -139,7 +139,7 @@ void Executor::scheduleTimerCallback() {
*/
efitick_t nowNt = getTimeNowNt();
nextEventTimeNt = queue.getNextEventTime(nowNt);
efiAssertVoid(nextEventTimeNt > nowNt, "setTimer constraint");
efiAssertVoid(CUSTOM_ERR_6625, nextEventTimeNt > nowNt, "setTimer constraint");
if (nextEventTimeNt == EMPTY_QUEUE)
return; // no pending events in the queue
int32_t hwAlarmTime = NT2US((int32_t)nextEventTimeNt - (int32_t)nowNt);

View File

@ -301,9 +301,9 @@ void OutputPin::toggle() {
void OutputPin::setValue(int logicValue) {
#if EFI_PROD_CODE
if (port != GPIO_NULL) {
efiAssertVoid(modePtr!=NULL, "pin mode not initialized");
efiAssertVoid(CUSTOM_ERR_6621, modePtr!=NULL, "pin mode not initialized");
pin_output_mode_e mode = *modePtr;
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e");
efiAssertVoid(CUSTOM_ERR_6622, mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e");
int eValue = getElectricalValue(logicValue, mode);
setPinValue(this, eValue, logicValue);
}

View File

@ -196,7 +196,7 @@ int EventQueue::size(void) {
void EventQueue::assertListIsSorted() {
scheduling_s *current = head;
while (current != NULL && current->next != NULL) {
efiAssertVoid(current->momentX <= current->next->momentX, "list order");
efiAssertVoid(CUSTOM_ERR_6623, current->momentX <= current->next->momentX, "list order");
current = current->next;
}
}

View File

@ -53,7 +53,7 @@ void PwmConfig::init(float *st, single_wave_s *waves) {
*/
void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
if (dutyCycle < 0 || dutyCycle > 1) {
firmwareError(CUSTOM_ERR_ASSERT_VOID, "spwd:dutyCycle %.2f", dutyCycle);
firmwareError(CUSTOM_ERR_6579, "spwd:dutyCycle %.2f", dutyCycle);
}
multiWave.setSwitchTime(0, dutyCycle);
}
@ -96,7 +96,7 @@ void PwmConfig::handleCycleStart() {
if (pwmCycleCallback != NULL) {
pwmCycleCallback(this);
}
efiAssertVoid(periodNt != 0, "period not initialized");
efiAssertVoid(CUSTOM_ERR_6580, periodNt != 0, "period not initialized");
if (safe.periodNt != periodNt || safe.iteration == ITERATION_LIMIT) {
/**
* period length has changed - we need to reset internal state
@ -168,7 +168,7 @@ efitimeus_t PwmConfig::togglePwmState() {
*/
static void timerCallback(PwmConfig *state) {
state->dbgNestingLevel++;
efiAssertVoid(state->dbgNestingLevel < 25, "PWM nesting issue");
efiAssertVoid(CUSTOM_ERR_6581, state->dbgNestingLevel < 25, "PWM nesting issue");
efitimeus_t switchTimeUs = state->togglePwmState();
scheduleByTimestamp(&state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state);
@ -196,7 +196,7 @@ void copyPwmParameters(PwmConfig *state, int phaseCount, float *switchTimes, int
void PwmConfig::weComplexInit(const char *msg, int phaseCount, float *switchTimes, int waveCount,
pin_state_t **pinStates, pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(periodNt != 0, "period is not initialized");
efiAssertVoid(CUSTOM_ERR_6582, periodNt != 0, "period is not initialized");
if (phaseCount == 0) {
firmwareError(CUSTOM_ERR_PWM_1, "signal length cannot be zero");
return;
@ -205,7 +205,7 @@ void PwmConfig::weComplexInit(const char *msg, int phaseCount, float *switchTime
firmwareError(CUSTOM_ERR_PWM_2, "too many phases in PWM");
return;
}
efiAssertVoid(waveCount > 0, "waveCount should be positive");
efiAssertVoid(CUSTOM_ERR_6583, waveCount > 0, "waveCount should be positive");
checkSwitchTimes2(phaseCount, switchTimes);
this->pwmCycleCallback = pwmCycleCallback;

View File

@ -49,7 +49,7 @@ void configureMiniCooperTriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SU
}
a += 3 * w;
efiAssertVoid(absF(firstGapAngle + 360 - a) < 0.1, "shape constraint");
efiAssertVoid(CUSTOM_ERR_6584, absF(firstGapAngle + 360 - a) < 0.1, "shape constraint");
s->addEvent2(a, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
a += 3 * w;
@ -60,7 +60,7 @@ void configureMiniCooperTriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_SU
a = addPair(s, a, w PASS_ENGINE_PARAMETER_SUFFIX);
}
efiAssertVoid(absF(720 - w / 2 - a) < 0.1, "shape constraint");
efiAssertVoid(CUSTOM_ERR_6585, absF(720 - w / 2 - a) < 0.1, "shape constraint");
s->addEvent2(a, T_SECONDARY, TV_RISE PASS_ENGINE_PARAMETER_SUFFIX);
s->addEvent2(720.0, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -13,8 +13,8 @@ angle_t getEngineCycle(operation_mode_e operationMode) {
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int totalTeethCount, int skippedCount,
float toothWidth, float offset, float engineCycle, float filterLeft, float filterRight DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(totalTeethCount > 0, "total count");
efiAssertVoid(skippedCount >= 0, "skipped count");
efiAssertVoid(CUSTOM_ERR_6586, totalTeethCount > 0, "total count");
efiAssertVoid(CUSTOM_ERR_6587, skippedCount >= 0, "skipped count");
for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
float angleDown = engineCycle / totalTeethCount * (i + (1 - toothWidth));
@ -35,7 +35,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
s->shapeDefinitionError = true;
return;
}
efiAssertVoid(s != NULL, "TriggerShape is NULL");
efiAssertVoid(CUSTOM_ERR_6588, s != NULL, "TriggerShape is NULL");
s->initialize(operationMode, false);
s->setTriggerSynchronizationGap(skippedCount + 1);

View File

@ -188,7 +188,7 @@ void seTurnPinLow(InjectionSignalPair *pair) {
tempTurnPinLow(output);
}
}
efiAssertVoid(pair->event != NULL, "pair event");
efiAssertVoid(CUSTOM_ERR_6626, pair->event != NULL, "pair event");
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
Engine *engine = pair->event->engine;
EXPAND_Engine;
@ -369,8 +369,8 @@ static void fuelClosedLoopCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#3");
efiAssertVoid(trgEventIndex < engine->engineCycleEventCount, "handleFuel/event index");
efiAssertVoid(CUSTOM_ERR_6627, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#3");
efiAssertVoid(CUSTOM_ERR_6628, trgEventIndex < engine->engineCycleEventCount, "handleFuel/event index");
if (!isInjectionEnabled(PASS_ENGINE_PARAMETER_SIGNATURE) || limitedFuel) {
return;
@ -402,7 +402,7 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
InjectionEvent *event = &fs->elements[injEventIndex];
uint32_t eventIndex = event->injectionStart.eventIndex;
// right after trigger change we are still using old & invalid fuel schedule. good news is we do not change trigger on the fly in real life
// efiAssertVoid(eventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event sch index");
// efiAssertVoid(CUSTOM_ERR_ASSERT_VOID, eventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event sch index");
if (eventIndex != trgEventIndex) {
continue;
}
@ -442,7 +442,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
*/
return;
}
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#2");
efiAssertVoid(CUSTOM_ERR_6629, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#2");
if (trgEventIndex >= ENGINE(engineCycleEventCount)) {
/**
@ -500,7 +500,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
}
}
efiAssertVoid(!CONFIG(useOnlyRisingEdgeForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex");
efiAssertVoid(CUSTOM_ERR_6630, !CONFIG(useOnlyRisingEdgeForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex");
if (trgEventIndex == CONFIG(ignMathCalculateAtIndex)) {
if (CONFIG(externalKnockSenseAdc) != EFI_ADC_NONE) {
@ -620,7 +620,7 @@ static void showMainInfo(Engine *engine) {
void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
efiAssertVoid(engine!=NULL, "null engine");
efiAssertVoid(CUSTOM_ERR_6631, engine!=NULL, "null engine");
initSparkLogic(logger);
initAuxValves(logger);

View File

@ -244,7 +244,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
efitick_t nowNt = getTimeNowNt();
#if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstckRCL");
efiAssertVoid(CUSTOM_ERR_6632, getRemainingStack(chThdGetSelfX()) > 256, "lowstckRCL");
#endif
RpmCalculator *rpmState = &engine->rpmCalculator;
@ -378,10 +378,10 @@ void initRpmCalculator(Logging *sharedLogger, Engine *engine) {
*/
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle,
schfunc_t callback, void *param, RpmCalculator *calc) {
efiAssertVoid(!cisnan(angle), "NaN angle?");
efiAssertVoid(isValidRpm(rpm), "RPM check expected");
efiAssertVoid(CUSTOM_ERR_6633, !cisnan(angle), "NaN angle?");
efiAssertVoid(CUSTOM_ERR_6634, isValidRpm(rpm), "RPM check expected");
float delayUs = calc->oneDegreeUs * angle;
efiAssertVoid(!cisnan(delayUs), "NaN delay?");
efiAssertVoid(CUSTOM_ERR_6635, !cisnan(delayUs), "NaN delay?");
scheduleForLater(timer, (int) delayUs, callback, param);
}
#endif

View File

@ -75,7 +75,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e
cfg_float_t_1f timing_offset_cylinder = CONFIG(timing_offset_cylinder[event->cylinderIndex]);
const angle_t localAdvance = -ENGINE(engineState.timingAdvance) + ignitionPositionWithinEngineCycle + timing_offset_cylinder;
efiAssertVoid(!cisnan(localAdvance), "localAdvance#1");
efiAssertVoid(CUSTOM_ERR_6589, !cisnan(localAdvance), "localAdvance#1");
const int index = ENGINE(ignitionPin[event->cylinderIndex]);
const int coilIndex = ID2INDEX(getCylinderId(index PASS_ENGINE_PARAMETER_SUFFIX));
IgnitionOutputPin *output = &enginePins.coils[coilIndex];
@ -97,7 +97,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e
event->advance = localAdvance;
angle_t a = localAdvance - dwellAngle;
efiAssertVoid(!cisnan(a), "findAngle#5");
efiAssertVoid(CUSTOM_ERR_6590, !cisnan(a), "findAngle#5");
assertAngleRange(a, "findAngle#a6", CUSTOM_ERR_6550);
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, a PASS_ENGINE_PARAMETER_SUFFIX));
@ -225,7 +225,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
* TODO: improve precision
*/
float advance = iEvent->advance;
efiAssertVoid(!cisnan(advance), "findAngle#4");
efiAssertVoid(CUSTOM_ERR_6591, !cisnan(advance), "findAngle#4");
assertAngleRange(advance, "findAngle#a5", CUSTOM_ERR_6549);
TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, advance PASS_ENGINE_PARAMETER_SUFFIX));
@ -273,7 +273,7 @@ static void initializeIgnitionActions(IgnitionEventList *list DECLARE_ENGINE_PAR
list->isReady = false;
return;
}
efiAssertVoid(engineConfiguration->specs.cylindersCount > 0, "cylindersCount");
efiAssertVoid(CUSTOM_ERR_6592, engineConfiguration->specs.cylindersCount > 0, "cylindersCount");
for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
list->elements[cylinderIndex].cylinderIndex = cylinderIndex;

View File

@ -189,7 +189,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
if (triggerReentraint > maxTriggerReentraint)
maxTriggerReentraint = triggerReentraint;
triggerReentraint++;
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#8");
efiAssertVoid(CUSTOM_ERR_6636, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#8");
engine->triggerCentral.handleShaftSignal(signal PASS_ENGINE_PARAMETER_SUFFIX);
triggerReentraint--;
triggerDuration = GET_TIMESTAMP() - triggerHandlerEntryTime;
@ -313,7 +313,7 @@ bool TriggerCentral::noiseFilter(efitick_t nowNt, trigger_event_e signal DECLARE
}
void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(engine!=NULL, "configuration");
efiAssertVoid(CUSTOM_ERR_6637, engine!=NULL, "configuration");
if (triggerShape.shapeDefinitionError) {
// trigger is broken, we cannot do anything here
@ -340,7 +340,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
int beforeCallback = hal_lld_get_counter_value();
#endif
int eventIndex = (int) signal;
efiAssertVoid(eventIndex >= 0 && eventIndex < HW_EVENT_TYPES, "signal type");
efiAssertVoid(CUSTOM_ERR_6638, eventIndex >= 0 && eventIndex < HW_EVENT_TYPES, "signal type");
hwEventCounters[eventIndex]++;
if (nowNt - previousShaftEventTimeNt > US2NT(US_PER_SECOND_LL)) {
@ -466,7 +466,7 @@ void printAllTriggers() {
TriggerShape *s = &engine->triggerCentral.triggerShape;
s->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
efiAssertVoid(!s->shapeDefinitionError, "trigger error");
efiAssertVoid(CUSTOM_ERR_6639, !s->shapeDefinitionError, "trigger error");
fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition);

View File

@ -181,7 +181,7 @@ void TriggerState::onSynchronizationLost(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* @param nowNt current time
*/
void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(signal <= SHAFT_3RD_RISING, "unexpected signal");
efiAssertVoid(CUSTOM_ERR_6640, signal <= SHAFT_3RD_RISING, "unexpected signal");
trigger_wheel_e triggerWheel = eventIndex[signal];
trigger_value_e type = eventType[signal];
@ -456,7 +456,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
#endif /* EFI_UNIT_TEST */
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "init t");
efiAssertVoid(CUSTOM_ERR_6641, getRemainingStack(chThdGetSelfX()) > 256, "init t");
scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
#endif

View File

@ -31,7 +31,7 @@ extern bool printTriggerDebug;
void TriggerStimulatorHelper::feedSimulatedEvent(TriggerState *state, TriggerShape * shape, int i
DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(shape->getSize() > 0, "size not zero");
efiAssertVoid(CUSTOM_ERR_6593, shape->getSize() > 0, "size not zero");
int stateIndex = i % shape->getSize();
int prevIndex = (stateIndex + shape->getSize() - 1 ) % shape->getSize();

View File

@ -48,7 +48,7 @@ TriggerShape::TriggerShape() :
void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "calc s");
efiAssertVoid(CUSTOM_ERR_6642, getRemainingStack(chThdGetSelfX()) > 256, "calc s");
#endif
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
@ -56,7 +56,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
int length = getLength();
engine->engineCycleEventCount = length;
efiAssertVoid(length > 0, "shapeLength=0");
efiAssertVoid(CUSTOM_ERR_6594, length > 0, "shapeLength=0");
if (length >= PWM_PHASE_MAX_COUNT) {
warning(CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG, "Count above %d", length);
shapeDefinitionError = true;
@ -78,10 +78,10 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
} else {
assertAngleRange(triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex", CUSTOM_ERR_6552);
int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
efiAssertVoid(engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
efiAssertVoid(CUSTOM_ERR_6595, engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;
float angle = getAngle(triggerDefinitionCoordinate) - firstAngle;
efiAssertVoid(!cisnan(angle), "trgSyncNaN");
efiAssertVoid(CUSTOM_ERR_6596, !cisnan(angle), "trgSyncNaN");
fixAngle(angle, "trgSync", CUSTOM_ERR_6559);
if (engineConfiguration->useOnlyRisingEdgeForTrigger) {
if (isFrontEvent[triggerDefinitionIndex]) {
@ -322,9 +322,9 @@ extern bool printTriggerDebug;
#endif
void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(operationMode != OM_NONE, "operationMode not set");
efiAssertVoid(CUSTOM_ERR_6597, operationMode != OM_NONE, "operationMode not set");
efiAssertVoid(waveIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
efiAssertVoid(CUSTOM_ERR_6598, waveIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {
@ -356,7 +356,7 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
expectedEventCount[waveIndex]++;
}
efiAssertVoid(angle > 0, "angle should be positive");
efiAssertVoid(CUSTOM_ERR_6599, angle > 0, "angle should be positive");
if (size > 0) {
if (angle <= previousAngle) {
warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: new=%.2f and prev=%.2f, size=%d", angle, previousAngle, size);
@ -430,7 +430,7 @@ void multi_wave_s::checkSwitchTimes(int size) {
}
void setVwConfiguration(TriggerShape *s DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(s != NULL, "TriggerShape is NULL");
efiAssertVoid(CUSTOM_ERR_6660, s != NULL, "TriggerShape is NULL");
operation_mode_e operationMode = FOUR_STROKE_CRANK_SENSOR;
s->initialize(operationMode, false);

View File

@ -170,13 +170,13 @@ void WaveChart::addEvent3(const char *name, const char * msg) {
}
if (skipUntilEngineCycle != 0 && ENGINE(rpmCalculator.getRevolutionCounter()) < skipUntilEngineCycle)
return;
efiAssertVoid(name!=NULL, "WC: NULL name");
efiAssertVoid(CUSTOM_ERR_6651, name!=NULL, "WC: NULL name");
#if EFI_PROD_CODE
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 32, "lowstck#2c");
efiAssertVoid(CUSTOM_ERR_6652, getRemainingStack(chThdGetSelfX()) > 32, "lowstck#2c");
#endif
efiAssertVoid(isInitialized, "chart not initialized");
efiAssertVoid(CUSTOM_ERR_6653, isInitialized, "chart not initialized");
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "current", chart->counter);
#endif

View File

@ -51,7 +51,7 @@ static THD_WORKING_AREA(waThreadStack, UTILITY_THREAD_STACK_SIZE);
static Logging * logger;
static void ensureInitialized(WaveReader *reader) {
efiAssertVoid(reader->hw->started, "wave analyzer NOT INITIALIZED");
efiAssertVoid(CUSTOM_ERR_6654, reader->hw->started, "wave analyzer NOT INITIALIZED");
}
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
@ -120,7 +120,7 @@ static void initWave(const char *name, int index) {
bool mode = boardConfiguration->logicAnalyzerMode[index];
waveReaderCount++;
efiAssertVoid(index < MAX_ICU_COUNT, "too many ICUs");
efiAssertVoid(CUSTOM_ERR_6655, index < MAX_ICU_COUNT, "too many ICUs");
WaveReader *reader = &readers[index];
reader->name = name;

View File

@ -172,7 +172,7 @@ AdcDevice fastAdc(&adcgrpcfg_fast);
void doSlowAdc(void) {
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcSlow");
efiAssertVoid(CUSTOM_ERR_6658, getRemainingStack(chThdGetSelfX())> 32, "lwStAdcSlow");
#if EFI_INTERNAL_ADC
@ -203,7 +203,7 @@ static void pwmpcb_slow(PWMDriver *pwmp) {
}
static void pwmpcb_fast(PWMDriver *pwmp) {
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcFast");
efiAssertVoid(CUSTOM_ERR_6659, getRemainingStack(chThdGetSelfX())> 32, "lwStAdcFast");
#if EFI_INTERNAL_ADC
(void) pwmp;
@ -567,7 +567,7 @@ int getSlowAdcCounter() {
static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) buffer;
(void) n;
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9c");
efiAssertVoid(CUSTOM_ERR_6671, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9c");
/* Note, only in the ADC_COMPLETE state because the ADC driver fires
* an intermediate callback when the buffer is half full. */
if (adcp->state == ADC_COMPLETE) {

View File

@ -244,8 +244,8 @@ void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
}
wave_icucfg.channel = getInputCaptureChannel(hw->brainPin);
efiIcuStart(driver, &wave_icucfg);
efiAssertVoid(driver != NULL, "di: driver is NULL");
efiAssertVoid(driver->state == ICU_READY, "di: driver not ready");
efiAssertVoid(CUSTOM_ERR_6672, driver != NULL, "di: driver is NULL");
efiAssertVoid(CUSTOM_ERR_6673, driver->state == ICU_READY, "di: driver not ready");
icuStartCapture(driver); // this would change state from READY to WAITING
icuEnableNotifications(driver);
}

View File

@ -84,7 +84,7 @@ bool rtcWorks = true;
* Only one consumer can use SPI bus at a given time
*/
void lockSpi(spi_device_e device) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lockSpi");
efiAssertVoid(CUSTOM_ERR_6674, getRemainingStack(chThdGetSelfX()) > 128, "lockSpi");
// todo: different locks for different SPI devices!
chMtxLock(&spiMtx);
}
@ -170,7 +170,7 @@ extern int tpsFastAdc;
* This method is not in the adc* lower-level file because it is more business logic then hardware.
*/
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 64, "lowstck12a");
efiAssertVoid(CUSTOM_ERR_6675, getRemainingStack(chThdGetSelfX()) > 64, "lowstck12a");
(void) buffer;
(void) n;
@ -182,7 +182,7 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
/**
* this callback is executed 10 000 times a second, it needs to be as fast as possible
*/
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9b");
efiAssertVoid(CUSTOM_ERR_6676, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9b");
#if EFI_MAP_AVERAGING
mapAveragingAdcCallback(fastAdc.samples[fastMapSampleIndex]);
@ -299,10 +299,10 @@ void showBor(void) {
}
void initHardware(Logging *l) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "init h");
efiAssertVoid(CUSTOM_ERR_6677, getRemainingStack(chThdGetSelfX()) > 256, "init h");
sharedLogger = l;
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
efiAssertVoid(engineConfiguration!=NULL, "engineConfiguration");
efiAssertVoid(CUSTOM_ERR_6678, engineConfiguration!=NULL, "engineConfiguration");
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
printMsg(sharedLogger, "initHardware()");

View File

@ -92,7 +92,7 @@ iomode_t getInputMode(pin_input_mode_e mode) {
#if HAL_USE_ICU || defined(__DOXYGEN__)
void efiIcuStart(ICUDriver *icup, const ICUConfig *config) {
efiAssertVoid((icup->state == ICU_STOP) || (icup->state == ICU_READY),
efiAssertVoid(CUSTOM_ERR_6679, (icup->state == ICU_STOP) || (icup->state == ICU_READY),
"input already used?");
icuStart(icup, config);

View File

@ -17,7 +17,7 @@
// mode >= 0 is always true since that's an unsigned
#define assertOMode(mode) { \
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
efiAssertVoid(CUSTOM_ERR_6578, mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
}

View File

@ -66,7 +66,7 @@ static void lcdSleep(int period) {
for (int i = 0; i < ticks; i++)
a += i;
// the purpose of this code is to fool the compiler so that the loop is not optimized away
efiAssertVoid(a != 0, "true");
efiAssertVoid(CUSTOM_ERR_6656, a != 0, "true");
} else {
chThdSleepMicroseconds(period);
@ -143,7 +143,7 @@ void lcd_HD44780_write_data(uint8_t data) {
//-----------------------------------------------------------------------------
void lcd_HD44780_set_position(uint8_t row, uint8_t column) {
efiAssertVoid(row <= engineConfiguration->HD44780height, "invalid row");
efiAssertVoid(CUSTOM_ERR_6657, row <= engineConfiguration->HD44780height, "invalid row");
currentRow = row;
currentColumn = column;
lcd_HD44780_write_command(LCD_HD44780_DDRAM_ADDR + lineStart[row] + column);

View File

@ -68,7 +68,7 @@ MCP3208_CS_PIN,
};
static void createRequest(McpAdcState *state, int channel) {
efiAssertVoid(channel < 8, "Invalid ADC channel");
efiAssertVoid(CUSTOM_ERR_6680, channel < 8, "Invalid ADC channel");
state->requestedChannel = channel;

View File

@ -64,7 +64,7 @@ void setHardwareUsTimer(int32_t timeUs) {
}
if (timeUs < 2)
timeUs = 2; // for some reason '1' does not really work
efiAssertVoid(timeUs > 0, "not positive timeUs");
efiAssertVoid(CUSTOM_ERR_6681, timeUs > 0, "not positive timeUs");
if (timeUs >= 10 * US_PER_SECOND) {
firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too long: %d", timeUs);
return;
@ -123,7 +123,7 @@ static void usTimerWatchDog(void) {
msg = isTimerPending ? "No_cb too long" : "Timer not awhile";
// 2 seconds of inactivity would not look right
efiAssertVoid(getTimeNowNt() < lastSetTimerTimeNt + 2 * CORE_CLOCK, msg);
efiAssertVoid(CUSTOM_ERR_6682, getTimeNowNt() < lastSetTimerTimeNt + 2 * CORE_CLOCK, msg);
}

View File

@ -23,8 +23,8 @@
* This method takes ~350 ticks.
*/
void applyPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
efiAssertVoid(CUSTOM_ERR_6663, stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
efiAssertVoid(CUSTOM_ERR_6664, state->multiWave.waveCount <= PWM_PHASE_MAX_WAVE_PER_PWM, "invalid waveCount");
for (int waveIndex = 0; waveIndex < state->multiWave.waveCount; waveIndex++) {
OutputPin *output = state->outputPins[waveIndex];
int value = state->multiWave.waves[waveIndex].pinStates[stateIndex];
@ -33,7 +33,7 @@ void applyPinState(PwmConfig *state, int stateIndex) {
}
void startSimplePwm(PwmConfig *state, const char *msg, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
efiAssertVoid(CUSTOM_ERR_6665, dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
if (frequency < 1) {
warning(CUSTOM_OBD_LOW_FREQUENCY, "low frequency %.2f", frequency);
return;

View File

@ -69,7 +69,7 @@ static void SetTimeUnixSec(time_t unix_time) {
static void put2(int offset, char *lcd_str, int value) {
static char buff[_MAX_FILLER];
efiAssertVoid(value >=0 && value <100, "value");
efiAssertVoid(CUSTOM_ERR_6666, value >=0 && value <100, "value");
itoa10(buff, value);
if (value < 10) {
lcd_str[offset] = '0';

View File

@ -162,7 +162,7 @@ static void scheduleReboot(void) {
}
void runRusEfi(void) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 512, "init s");
efiAssertVoid(CUSTOM_ERR_6608, getRemainingStack(chThdGetSelfX()) > 512, "init s");
assertEngineReference();
initIntermediateLoggingBuffer();
initErrorHandling();
@ -234,7 +234,7 @@ void runRusEfi(void) {
* control is around main_trigger_callback
*/
while (true) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "stack#1");
efiAssertVoid(CUSTOM_ERR_6609, getRemainingStack(chThdGetSelfX()) > 128, "stack#1");
#if (EFI_CLI_SUPPORT && !EFI_UART_ECHO_TEST_MODE) || defined(__DOXYGEN__)
// sensor state + all pending messages for our own dev console

View File

@ -57,7 +57,7 @@ static void doAddAction(const char *token, action_type_e type, Void callback, vo
}
}
efiAssertVoid(consoleActionCount < CONSOLE_MAX_ACTIONS, "Too many console actions");
efiAssertVoid(CUSTOM_ERR_6601, consoleActionCount < CONSOLE_MAX_ACTIONS, "Too many console actions");
TokenCallback *current = &consoleActions[consoleActionCount++];
current->token = token;
current->parameterType = type;

View File

@ -66,7 +66,7 @@ static ALWAYS_INLINE bool validateBuffer(Logging *logging, const char *text, uin
}
void append(Logging *logging, const char *text) {
efiAssertVoid(text != NULL, "append NULL");
efiAssertVoid(CUSTOM_ERR_6602, text != NULL, "append NULL");
uint32_t extraLen = efiStrlen(text);
bool isCapacityProblem = validateBuffer(logging, text, extraLen);
if (isCapacityProblem) {
@ -93,7 +93,7 @@ void appendFast(Logging *logging, const char *text) {
// todo: look into chsnprintf once on Chibios 3
static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
intermediateLoggingBuffer.eos = 0; // reset
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#1b");
efiAssertVoid(CUSTOM_ERR_6603, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#1b");
chvprintf((BaseSequentialStream *) &intermediateLoggingBuffer, fmt, arg);
intermediateLoggingBuffer.buffer[intermediateLoggingBuffer.eos] = 0; // need to terminate explicitly
append(logging, (char *) intermediateLoggingBufferData);
@ -103,7 +103,7 @@ static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
* this method acquires system lock to guard the shared intermediateLoggingBuffer memory stream
*/
static void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5b");
efiAssertVoid(CUSTOM_ERR_6604, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5b");
if (!intermediateLoggingBufferInited) {
firmwareError(CUSTOM_ERR_BUFF_INIT_ERROR, "intermediateLoggingBufferInited not inited!");
return;
@ -116,7 +116,7 @@ static void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
}
void appendPrintf(Logging *logging, const char *fmt, ...) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#4");
efiAssertVoid(CUSTOM_ERR_6607, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#4");
va_list ap;
va_start(ap, fmt);
vappendPrintf(logging, fmt, ap);
@ -236,7 +236,7 @@ void resetLogging(Logging *logging) {
* This method should only be invoked on main thread because only the main thread can write to the console
*/
void printMsg(Logging *logger, const char *fmt, ...) {
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5o");
efiAssertVoid(CUSTOM_ERR_6605, getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5o");
// resetLogging(logging); // I guess 'reset' is not needed here?
appendMsgPrefix(logger);

View File

@ -99,7 +99,7 @@ void hsAdd(histogram_s *h, int64_t value) {
int count = 1;
h->total_value += value;
h->total_count += count;
efiAssertVoid(index < BOUND_LENGTH, "histogram issue");
efiAssertVoid(CUSTOM_ERR_6670, index < BOUND_LENGTH, "histogram issue");
h->values[index] += count;
}

View File

@ -65,7 +65,7 @@ void IntListenerArray<MAX_INT_LISTENER_COUNT>::clear() {
template<int MAX_INT_LISTENER_COUNT>
void IntListenerArray<MAX_INT_LISTENER_COUNT>::registerCallback(VoidInt handler, void *arg) {
efiAssertVoid(currentListenersCount < MAX_INT_LISTENER_COUNT, "Too many callbacks");
efiAssertVoid(CUSTOM_ERR_6606, currentListenersCount < MAX_INT_LISTENER_COUNT, "Too many callbacks");
int index = currentListenersCount++;
callbacks[index] = handler;
args[index] = arg;

View File

@ -303,7 +303,7 @@ void testRpmCalculator(void) {
assertEqualsM("engineCycle", 720, eth.engine.engineCycle);
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
efiAssertVoid(CUSTOM_ERR_6683, eth.engine.engineConfiguration!=NULL, "null config in engine");
engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->globalFuelCorrection = 3;