step towards more unique codes

This commit is contained in:
rusefi 2018-07-25 23:30:00 -04:00
parent 959a91ae4c
commit 99e74635ef
20 changed files with 58 additions and 58 deletions

View File

@ -74,7 +74,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
warning(CUSTOM_NAN_ENGINE_LOAD, "NaN engine load");
return NAN;
}
efiAssert(!cisnan(engineLoad), "invalid el", NAN);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(engineLoad), "invalid el", NAN);
engine->m.beforeZeroTest = GET_TIMESTAMP();
engine->m.zeroTestTime = GET_TIMESTAMP() - engine->m.beforeZeroTest;
@ -144,12 +144,12 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
angle = getCrankingAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
assertAngleRange(angle, "crAngle", CUSTOM_ERR_6541);
efiAssert(!cisnan(angle), "crAngleN", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "crAngleN", 0);
if (CONFIG(useAdvanceCorrectionsForCranking))
angle += getAdvanceCorrections(rpm PASS_ENGINE_PARAMETER_SUFFIX);
} else {
angle = getRunningAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER_SUFFIX);
efiAssert(!cisnan(angle), "rAngleN", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "rAngleN", 0);
angle += getAdvanceCorrections(rpm PASS_ENGINE_PARAMETER_SUFFIX);
}
angle -= engineConfiguration->ignitionOffset;

View File

@ -76,20 +76,20 @@ float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
*/
floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t tpsAccelEnrich = ENGINE(tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE));
efiAssert(!cisnan(tpsAccelEnrich), "NaN tpsAccelEnrich", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(tpsAccelEnrich), "NaN tpsAccelEnrich", 0);
ENGINE(engineState.tpsAccelEnrich) = tpsAccelEnrich;
floatms_t baseFuel;
if (CONFIG(fuelAlgorithm) == LM_SPEED_DENSITY) {
baseFuel = getSpeedDensityFuel(PASS_ENGINE_PARAMETER_SIGNATURE);
efiAssert(!cisnan(baseFuel), "NaN sd baseFuel", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN sd baseFuel", 0);
} else if (engineConfiguration->fuelAlgorithm == LM_REAL_MAF) {
float maf = getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE) + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE);
baseFuel = getRealMafFuel(maf, rpm PASS_ENGINE_PARAMETER_SUFFIX);
efiAssert(!cisnan(baseFuel), "NaN rm baseFuel", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN rm baseFuel", 0);
} else {
baseFuel = engine->engineState.baseTableFuel;
efiAssert(!cisnan(baseFuel), "NaN bt baseFuel", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseFuel), "NaN bt baseFuel", 0);
}
engine->engineState.baseFuel = baseFuel;
@ -109,7 +109,7 @@ angle_t getInjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
firmwareError(CUSTOM_ERR_ASSERT, "inj offset#1 %.2f %.2f", rpm, engineLoad);
return 0;
}
efiAssert(!cisnan(value), "inj offset#1", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(value), "inj offset#1", 0);
angle_t result = value + CONFIG(extraInjectionOffset);
fixAngle(result, "inj offset#2", CUSTOM_ERR_6553);
return result;
@ -161,11 +161,11 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
floatms_t fuelPerCycle;
if (isCranking) {
fuelPerCycle = getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE);
efiAssert(!cisnan(fuelPerCycle), "NaN cranking fuelPerCycle", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN cranking fuelPerCycle", 0);
} else {
floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
fuelPerCycle = getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX);
efiAssert(!cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("baseFuel=%.2f fuelPerCycle=%.2f \t\n",
baseFuel, fuelPerCycle);
@ -194,12 +194,12 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
float iatCorrection = ENGINE(engineState.iatFuelCorrection);
float cltCorrection = ENGINE(engineState.cltFuelCorrection);
float postCrankingFuelCorrection = ENGINE(engineState.postCrankingFuelCorrection);
efiAssert(!cisnan(iatCorrection), "NaN iatCorrection", 0);
efiAssert(!cisnan(cltCorrection), "NaN cltCorrection", 0);
efiAssert(!cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(iatCorrection), "NaN iatCorrection", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(cltCorrection), "NaN cltCorrection", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0);
floatms_t runningFuel = baseFuel * iatCorrection * cltCorrection * postCrankingFuelCorrection + ENGINE(engineState.fuelPidCorrection);
efiAssert(!cisnan(runningFuel), "NaN runningFuel", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(runningFuel), "NaN runningFuel", 0);
ENGINE(engineState.runningFuel) = runningFuel;
return runningFuel;

View File

@ -79,7 +79,7 @@ T FLStack<T, MAXSIZE>::pop() {
*/
template<typename T, int MAXSIZE>
T FLStack<T, MAXSIZE>::get(int index) {
efiAssert(index >= 0 && index < MAXSIZE, "FLget", values[0]);
efiAssert(CUSTOM_ERR_ASSERT, index >= 0 && index < MAXSIZE, "FLget", values[0]);
return values[index];
}
@ -120,7 +120,7 @@ void ArrayList<Type, Dimention>::reset(void) {
template<class Type, int Dimention>
Type * ArrayList<Type, Dimention>::add(void) {
efiAssert(size < Dimention, "add() too many elements", (Type *)NULL);
efiAssert(CUSTOM_ERR_ASSERT, size < Dimention, "add() too many elements", (Type *)NULL);
return &elements[size++];
}

View File

@ -139,7 +139,7 @@ void LECalculator::push(le_action_e action, float value) {
*/
bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssert(getRemainingStack(chThdGetSelfX()) > 64, "FSIO logic", false);
efiAssert(CUSTOM_ERR_ASSERT, getRemainingStack(chThdGetSelfX()) > 64, "FSIO logic", false);
#endif
switch (element->action) {
@ -314,7 +314,7 @@ float LECalculator::getValue(float selfValue DECLARE_ENGINE_PARAMETER_SUFFIX) {
int counter = 0;
while (element != NULL) {
efiAssert(counter < 200, "FSIOcount", NAN); // just in case
efiAssert(CUSTOM_ERR_ASSERT, counter < 200, "FSIOcount", NAN); // just in case
if (element->action == LE_METHOD_SELF) {
push(element->action, selfValue);
@ -379,7 +379,7 @@ const char *getNextToken(const char *line, char *buffer, const int bufferSize) {
// no space - the whole remaining line is the token
tokenLen = strlen(line);
}
efiAssert(tokenLen < bufferSize, "token overflow", NULL);
efiAssert(CUSTOM_ERR_ASSERT, tokenLen < bufferSize, "token overflow", NULL);
strncpy(buffer, line, tokenLen);
buffer[tokenLen] = 0;
line += tokenLen;

View File

@ -94,7 +94,7 @@ EXTERN_ENGINE
static Logging *logger;
float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssert(engine!=NULL, "getLEValue", NAN);
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "getLEValue", NAN);
switch (action) {
case LE_METHOD_FAN:
return enginePins.fanRelay.getLogicValue();

View File

@ -140,15 +140,15 @@ float interpolateClamped(float x1, float y1, float x2, float y2, float x) {
* Another implementation, which one is faster?
*/
int findIndex2(const float array[], unsigned size, float value) {
efiAssert(!cisnan(value), "NaN in findIndex2", 0);
efiAssert(size > 1, "size in findIndex", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(value), "NaN in findIndex2", 0);
efiAssert(CUSTOM_ERR_ASSERT, size > 1, "size in findIndex", 0);
// if (size <= 1)
// return size && *array <= value ? 0 : -1;
signed i = 0;
//unsigned b = 1 << int(log(float(size) - 1) / 0.69314718055994530942);
unsigned b = size >> 1; // in our case size is always a power of 2
efiAssert(b + b == size, "Size not power of 2", -1);
efiAssert(CUSTOM_ERR_ASSERT, b + b == size, "Size not power of 2", -1);
for (; b; b >>= 1) {
unsigned j = i | b;
/**
@ -156,7 +156,7 @@ int findIndex2(const float array[], unsigned size, float value) {
* "if (j < size && array[j] <= value)"
* but in our case size is always power of 2 thus size is always more then j
*/
// efiAssert(j < size, "size", 0);
// efiAssert(CUSTOM_ERR_ASSERT, j < size, "size", 0);
if (array[j] <= value)
i = j;
}
@ -199,7 +199,7 @@ int findIndexMsg(const char *msg, const float array[], int size, float value) {
#if 0
// that's an assertion to make sure we do not loop here
size--;
efiAssert(size > 0, "Unexpected state in binary search", 0);
efiAssert(CUSTOM_ERR_ASSERT, size > 0, "Unexpected state in binary search", 0);
#endif
// todo: compare current implementation with

View File

@ -87,7 +87,7 @@ void Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE, vType>::init(vType table[RPM_BIN_SIZE][L
template<int RPM_BIN_SIZE, int LOAD_BIN_SIZE, typename vType>
float Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE, vType>::getValue(float xRpm, float y) {
efiAssert(initialized, "map not initialized", NAN);
efiAssert(CUSTOM_ERR_ASSERT, initialized, "map not initialized", NAN);
if (cisnan(y)) {
warning(CUSTOM_PARAM_RANGE, "%s: y is NaN", name);
return NAN;

View File

@ -55,10 +55,10 @@ int getRusEfiVersion(void);
* is stopped. Please use firmwareWarning() instead
*/
#if EFI_ENABLE_ASSERTS
#define efiAssert(condition, message, result) { if (!(condition)) { firmwareError(CUSTOM_ERR_ASSERT, message); return result; } }
#define efiAssert(code, condition, message, result) { if (!(condition)) { firmwareError(code, message); return result; } }
#define efiAssertVoid(code, condition, message) { if (!(condition)) { firmwareError(code, message); return; } }
#else /* EFI_ENABLE_ASSERTS */
#define efiAssert(condition, message, result) { }
#define efiAssert(code, condition, message, result) { }
#define efiAssertVoid(code, condition, message) { }
#endif /* EFI_ENABLE_ASSERTS */

View File

@ -131,7 +131,7 @@ static persisted_configuration_state_e doReadConfiguration(flashaddr_t address,
* connectivity so no console output here
*/
persisted_configuration_state_e readConfiguration(Logging * logger) {
efiAssert(getRemainingStack(chThdGetSelfX()) > 256, "read f", PC_ERROR);
efiAssert(CUSTOM_ERR_ASSERT, getRemainingStack(chThdGetSelfX()) > 256, "read f", PC_ERROR);
persisted_configuration_state_e result = doReadConfiguration(FLASH_ADDR, logger);
if (result != PC_OK) {
printMsg(logger, "Reading second configuration copy");

View File

@ -57,8 +57,8 @@ floatms_t getCrankshaftRevolutionTimeMs(int rpm) {
*
*/
float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
efiAssert(engine!=NULL, "engine 2NULL", NAN);
efiAssert(engineConfiguration!=NULL, "engineConfiguration 2NULL", NAN);
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "engine 2NULL", NAN);
efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "engineConfiguration 2NULL", NAN);
switch (engineConfiguration->fuelAlgorithm) {
case LM_PLAIN_MAF:
if (!hasMafSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
@ -111,7 +111,7 @@ void FuelSchedule::clear() {
* @returns false in case of error, true if success
*/
bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssert(engine!=NULL, "engine is NULL", false);
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "engine is NULL", false);
floatus_t oneDegreeUs = ENGINE(rpmCalculator.oneDegreeUs); // local copy
if (cisnan(oneDegreeUs)) {
@ -128,9 +128,9 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
* engineState.injectionOffset is calculated from the same utility timer should we more that logic here?
*/
floatms_t fuelMs = ENGINE(injectionDuration);
efiAssert(!cisnan(fuelMs), "NaN fuelMs", false);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelMs), "NaN fuelMs", false);
angle_t injectionDuration = MS2US(fuelMs) / oneDegreeUs;
efiAssert(!cisnan(injectionDuration), "NaN injectionDuration", false);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(injectionDuration), "NaN injectionDuration", false);
assertAngleRange(injectionDuration, "injectionDuration_r", CUSTOM_ERR_6542);
floatus_t injectionOffset = ENGINE(engineState.injectionOffset);
if (cisnan(injectionOffset)) {
@ -138,7 +138,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
return false;
}
angle_t baseAngle = injectionOffset - injectionDuration;
efiAssert(!cisnan(baseAngle), "NaN baseAngle", false);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(baseAngle), "NaN baseAngle", false);
assertAngleRange(baseAngle, "baseAngle_r", CUSTOM_ERR_6554);
int injectorIndex;
@ -205,7 +205,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
return false;
}
efiAssert(!cisnan(angle), "findAngle#3", false);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "findAngle#3", false);
assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544);
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER_SUFFIX));
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
@ -247,7 +247,7 @@ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE);
} else {
efiAssert(!cisnan(rpm), "invalid rpm", NAN);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN);
dwellMs = interpolate2d("dwell", rpm, engineConfiguration->sparkDwellRpmBins, engineConfiguration->sparkDwellValues, DWELL_CURVE_SIZE);
}
@ -266,7 +266,7 @@ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
int TriggerShape::findAngleIndex(float target DECLARE_ENGINE_PARAMETER_SUFFIX) {
int engineCycleEventCount = TRIGGER_SHAPE(getLength());
efiAssert(engineCycleEventCount > 0, "engineCycleEventCount", 0);
efiAssert(CUSTOM_ERR_ASSERT, engineCycleEventCount > 0, "engineCycleEventCount", 0);
uint32_t left = 0;
uint32_t right = engineCycleEventCount - 1;

View File

@ -103,13 +103,13 @@ floatms_t getSpeedDensityFuel(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return 0;
}
float map = getMap();
efiAssert(!cisnan(map), "NaN map", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(map), "NaN map", 0);
float adjustedMap = map + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_SIGNATURE);
efiAssert(!cisnan(adjustedMap), "NaN adjustedMap", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(adjustedMap), "NaN adjustedMap", 0);
float airMass = getCylinderAirMass(engineConfiguration, ENGINE(engineState.currentVE), adjustedMap, tChargeK);
efiAssert(!cisnan(airMass), "NaN airMass", 0);
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(airMass), "NaN airMass", 0);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("map=%.2f adjustedMap=%.2f airMass=%.2f\t\n",
map, adjustedMap, engine->engineState.airMass);

View File

@ -70,7 +70,7 @@ float convertKelvinToFahrenheit(float kelvin) {
}
float getResistance(ThermistorConf *config, float voltage) {
efiAssert(config != NULL, "thermistor config is null", NAN);
efiAssert(CUSTOM_ERR_ASSERT, config != NULL, "thermistor config is null", NAN);
thermistor_conf_s *tc = &config->config;
float resistance = getR2InVoltageDividor(voltage, _5_VOLTS, tc->bias_resistor);
@ -122,7 +122,7 @@ float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float temperature = getTemperatureC(&engineConfiguration->clt, &engine->engineState.cltCurve,
engineConfiguration->useLinearCltSensor);
if (!isValidCoolantTemperature(temperature)) {
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
warning(OBD_Engine_Coolant_Temperature_Circuit_Malfunction, "unrealistic CLT %.2f", temperature);
engine->isCltBroken = true;
return LIMPING_MODE_CLT_TEMPERATURE;
@ -203,7 +203,7 @@ float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve,
engineConfiguration->useLinearIatSensor);
if (!isValidIntakeAirTemperature(temperature)) {
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
#if EFI_PROD_CODE || EFI_UNIT_TEST || defined(__DOXYGEN__)
warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %.2f", temperature);
#endif /* EFI_PROD_CODE */

View File

@ -42,7 +42,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
assertListIsSorted();
#endif /* EFI_UNIT_TEST */
efiAssert(callback != NULL, "NULL callback", false);
efiAssert(CUSTOM_ERR_ASSERT, callback != NULL, "NULL callback", false);
// please note that simulator does not use this code at all - simulator uses signal_executor_sleep
@ -129,14 +129,14 @@ int EventQueue::executeAll(efitime_t now) {
// we need safe iteration because we are removing elements inside the loop
LL_FOREACH_SAFE(head, current, tmp)
{
efiAssert(current->callback != NULL, "callback==null1", 0);
efiAssert(CUSTOM_ERR_ASSERT, current->callback != NULL, "callback==null1", 0);
if (++listIterationCounter > QUEUE_LENGTH_LIMIT) {
firmwareError(CUSTOM_LIST_LOOP, "Is this list looped?");
return false;
}
if (current->momentX <= now) {
executionCounter++;
efiAssert(head == current, "removing from head", -1);
efiAssert(CUSTOM_ERR_ASSERT, head == current, "removing from head", -1);
//LL_DELETE(head, current);
head = head->next;
if (executionList == NULL) {
@ -164,7 +164,7 @@ int EventQueue::executeAll(efitime_t now) {
*/
LL_FOREACH_SAFE(executionList, current, tmp)
{
efiAssert(current->callback != NULL, "callback==null2", 0);
efiAssert(CUSTOM_ERR_ASSERT, current->callback != NULL, "callback==null2", 0);
uint32_t before = GET_TIMESTAMP();
current->isScheduled = false;
uint32_t howFarOff = now - current->momentX;

View File

@ -59,7 +59,7 @@ void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
}
static efitimeus_t getNextSwitchTimeUs(PwmConfig *state) {
efiAssert(state->safe.phaseIndex < PWM_PHASE_MAX_COUNT, "phaseIndex range", 0);
efiAssert(CUSTOM_ERR_ASSERT, state->safe.phaseIndex < PWM_PHASE_MAX_COUNT, "phaseIndex range", 0);
int iteration = state->safe.iteration;
float switchTime = state->multiWave.getSwitchTime(state->safe.phaseIndex);
float periodNt = state->safe.periodNt;

View File

@ -672,11 +672,11 @@ static void onFindIndexCallback(TriggerState *state) {
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
efiAssert(getRemainingStack(chThdGetSelfX()) > 128, "findPos", -1);
efiAssert(CUSTOM_ERR_ASSERT, getRemainingStack(chThdGetSelfX()) > 128, "findPos", -1);
#endif
isInitializingTrigger = true;
errorDetection.clear();
efiAssert(state != NULL, "NULL state", -1);
efiAssert(CUSTOM_ERR_ASSERT, state != NULL, "NULL state", -1);
state->reset();
@ -692,7 +692,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
isInitializingTrigger = false;
return syncIndex;
}
efiAssert(state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
efiAssert(CUSTOM_ERR_ASSERT, state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {

View File

@ -301,7 +301,7 @@ angle_t TriggerShape::getAngle(int index) const {
* See also trigger_central.cpp
* See also getEngineCycleEventCount()
*/
efiAssert(size != 0, "shapeSize=0", NAN);
efiAssert(CUSTOM_ERR_ASSERT, size != 0, "shapeSize=0", NAN);
int crankCycle = index / size;
int remainder = index % size;

View File

@ -37,7 +37,7 @@ PinRepository::PinRepository() {
}
static int getPortIndex(ioportid_t port) {
efiAssert(port != NULL, "null port", -1);
efiAssert(CUSTOM_ERR_ASSERT, port != NULL, "null port", -1);
if (port == GPIOA)
return 0;
if (port == GPIOB)

View File

@ -121,8 +121,8 @@ static ICUDriver *turnOnTriggerInputPin(const char *msg, brain_pin_e hwPin, ICUC
efiIcuStart(driver, icucfg);
if (driver->state == ICU_READY) {
efiAssert(driver != NULL, "ti: driver is NULL", NULL);
efiAssert(driver->state == ICU_READY, "ti: driver not ready", NULL);
efiAssert(CUSTOM_ERR_ASSERT, driver != NULL, "ti: driver is NULL", NULL);
efiAssert(CUSTOM_ERR_ASSERT, driver->state == ICU_READY, "ti: driver not ready", NULL);
icuStartCapture(driver); // this would change state from READY to WAITING
icuEnableNotifications(driver);
} else {

View File

@ -34,7 +34,7 @@ float efiFloor(float value, float precision) {
* @param precision for example '0.1' for one digit fractional part
*/
float efiRound(float value, float precision) {
efiAssert(precision != 0, "zero precision", NAN);
efiAssert(CUSTOM_ERR_ASSERT, precision != 0, "zero precision", NAN);
float a = rintf (value / precision);
return a * precision;
}

View File

@ -59,7 +59,7 @@ void initHistogramsModule(void) {
* @brief This internal method is only public so that we can test it.
*/
int histogramGetIndex(int64_t value) {
efiAssert(initialized, "histo initialized", 0);
efiAssert(CUSTOM_ERR_ASSERT, initialized, "histo initialized", 0);
if (value < 0)
return 0;
if (value < SBI_SIZE)