diff --git a/firmware/config/boards/hellen/hellen_board_id.cpp b/firmware/config/boards/hellen/hellen_board_id.cpp index 056dd0d777..b87a9dd993 100644 --- a/firmware/config/boards/hellen/hellen_board_id.cpp +++ b/firmware/config/boards/hellen/hellen_board_id.cpp @@ -92,7 +92,7 @@ float HellenBoardIdSolver::solve(float Tc1, float Tc2, float x0, float y, float // since we had https://github.com/rusefi/rusefi/issues/4084 let's add paranoia check // All real cases seem to converge in <= 5 iterations, so we don't need to try more than 20. if (!result) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "hellen boardID is broken"); + criticalError("hellen boardID is broken"); return 0; } diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 1844e923d0..952bf0da0d 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -92,7 +92,7 @@ TsChannelBase::TsChannelBase(const char *name) { void TsChannelBase::assertPacketSize(size_t size, bool allowLongPackets) { if (isBigPacket(size) && !allowLongPackets) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "[USE PROPER CONSOLE VERSION ] disallowed long packet of size %d", size); + criticalError("[USE PROPER CONSOLE VERSION ] disallowed long packet of size %d", size); } } diff --git a/firmware/console/eficonsole.cpp b/firmware/console/eficonsole.cpp index 3c5e27f643..840e649593 100644 --- a/firmware/console/eficonsole.cpp +++ b/firmware/console/eficonsole.cpp @@ -77,7 +77,7 @@ static void sayHello() { int flashSize = TM_ID_GetFlashSize(); if (flashSize < MIN_FLASH_SIZE) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "rusEFI expected at least %dK of flash", MIN_FLASH_SIZE); + criticalError("rusEFI expected at least %dK of flash", MIN_FLASH_SIZE); } // todo: bug, at the moment we report 1MB on dual-bank F7 @@ -172,7 +172,7 @@ static void cmd_threads() { efiPrintf("%s\t%08x\t%lu\t%d", tp->name, tp->wabase, tp->time, freeBytes); if (freeBytes < 100) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Ran out of stack on thread %s, %d bytes remain", tp->name, freeBytes); + criticalError("Ran out of stack on thread %s, %d bytes remain", tp->name, freeBytes); } tp = chRegNextThread(tp); diff --git a/firmware/controllers/actuators/dc_motors.cpp b/firmware/controllers/actuators/dc_motors.cpp index e32e5b53aa..16c7a0f0c1 100644 --- a/firmware/controllers/actuators/dc_motors.cpp +++ b/firmware/controllers/actuators/dc_motors.cpp @@ -37,7 +37,7 @@ int clampedFrequency = maxI(100, frequency); if (clampedFrequency > ETB_HW_MAX_FREQUENCY) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Electronic throttle frequency too high, maximum %d hz", ETB_HW_MAX_FREQUENCY); + criticalError("Electronic throttle frequency too high, maximum %d hz", ETB_HW_MAX_FREQUENCY); return; } diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index b8535c6d34..92cb01196b 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -1061,7 +1061,7 @@ void doInitElectronicThrottle() { if (!engineConfiguration->etb1configured && !engineConfiguration->etb2configured) { // It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal if (hasPedal) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "A pedal position sensor was configured, but no electronic throttles are configured."); + criticalError("A pedal position sensor was configured, but no electronic throttles are configured."); } } diff --git a/firmware/controllers/actuators/idle_hardware.cpp b/firmware/controllers/actuators/idle_hardware.cpp index 35ba4250f8..515abfeec9 100644 --- a/firmware/controllers/actuators/idle_hardware.cpp +++ b/firmware/controllers/actuators/idle_hardware.cpp @@ -154,7 +154,7 @@ void initIdleHardware() { if (engineConfiguration->isDoubleSolenoidIdle) { if (!isBrainPinValid(engineConfiguration->secondSolenoidPin)) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Second idle pin should be configured for double solenoid mode."); + criticalError("Second idle pin should be configured for double solenoid mode."); return; } diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index e7b351ad42..470ccea48c 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -101,7 +101,7 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { case VVT_MITSUBISHI_4G63: return trigger_type_e::TT_MITSU_4G63_CAM; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "getVvtTriggerType for %s", getVvt_mode_e(vvtMode)); + criticalError("getVvtTriggerType for %s", getVvt_mode_e(vvtMode)); return trigger_type_e::TT_HALF_MOON; // we have to return something for the sake of -Werror=return-type } } @@ -125,7 +125,7 @@ void Engine::updateTriggerWaveform() { #if ANALOG_HW_CHECK_MODE static void assertCloseTo(const char* msg, float actual, float expected) { if (actual < 0.95f * expected || actual > 1.05f * expected) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "%s validation failed actual=%f vs expected=%f", msg, actual, expected); + criticalError("%s validation failed actual=%f vs expected=%f", msg, actual, expected); } } #endif // ANALOG_HW_CHECK_MODE diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index 05fb4ec6aa..802ae53fa6 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -256,7 +256,7 @@ bool isLockedFromUser() { int lock = engineConfiguration->tuneHidingKey; bool isLocked = lock > 0; if (isLocked) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "password protected"); + criticalError("password protected"); } return isLocked; } diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index c608bc0edd..8f408fe821 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -173,7 +173,7 @@ __attribute__((weak)) void boardOnConfigurationChange(engine_configuration_s* /* void incrementGlobalConfigurationVersion(const char * msg) { assertStackVoid("increment", ObdCode::STACK_USAGE_MISC, EXPECTED_REMAINING_STACK); if (!hasRememberedConfiguration) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "too early to invoke incrementGlobalConfigurationVersion %s", msg); + criticalError("too early to invoke incrementGlobalConfigurationVersion %s", msg); } engine->globalConfigurationVersion++; #if EFI_DEFAILED_LOGGING diff --git a/firmware/controllers/algo/fuel/injector_model.cpp b/firmware/controllers/algo/fuel/injector_model.cpp index 338093eb0a..48583a009b 100644 --- a/firmware/controllers/algo/fuel/injector_model.cpp +++ b/firmware/controllers/algo/fuel/injector_model.cpp @@ -63,7 +63,7 @@ expected InjectorModel::getFuelDifferentialPressure() const { - map.value_or(101.325); case ICM_SensedRailPressure: { if (!Sensor::hasSensor(SensorType::FuelPressureInjector)) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Fuel pressure compensation is set to use a pressure sensor, but none is configured."); + criticalError("Fuel pressure compensation is set to use a pressure sensor, but none is configured."); return unexpected; } @@ -106,7 +106,7 @@ float InjectorModel::getInjectorFlowRatio() { if (referencePressure < 50) { // impossibly low fuel ref pressure - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Impossible fuel reference pressure: %f", referencePressure); + criticalError("Impossible fuel reference pressure: %f", referencePressure); return 1.0f; } diff --git a/firmware/controllers/algo/gear_detector.cpp b/firmware/controllers/algo/gear_detector.cpp index 77d8315c7e..69a94b2cff 100644 --- a/firmware/controllers/algo/gear_detector.cpp +++ b/firmware/controllers/algo/gear_detector.cpp @@ -24,14 +24,14 @@ void GearDetector::initGearDetector() { } if (gearCount > GEARS_COUNT) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "too many gears"); + criticalError("too many gears"); return; } // validate gears for (size_t i = 0; i < gearCount; i++) { if (engineConfiguration->gearRatio[i] <= 0) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Expecting positive gear ratio for #%d", i + 1); + criticalError("Expecting positive gear ratio for #%d", i + 1); return; } } @@ -42,7 +42,7 @@ void GearDetector::initGearDetector() { float gearIplusOne = engineConfiguration->gearRatio[i + 1]; if (gearI <= gearIplusOne) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Invalid gear ordering near gear #%d", i + 1); + criticalError("Invalid gear ordering near gear #%d", i + 1); } m_gearThresholds[i] = geometricMean(gearI, gearIplusOne); diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index fe9512a88a..d7dde7195d 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -331,7 +331,7 @@ static void handleBenchCategory(uint16_t index) { cancelBenchTest(); return; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected bench function %d", index); + criticalError("Unexpected bench function %d", index); } } @@ -410,7 +410,7 @@ static void handleCommandX14(uint16_t index) { sys_dual_bank(); rebootNow(); #else - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected dbank command", index); + criticalError("Unexpected dbank command", index); #endif return; case 0x15: @@ -420,7 +420,7 @@ static void handleCommandX14(uint16_t index) { #endif // EFI_PROD_CODE return; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected bench x14 %d", index); + criticalError("Unexpected bench x14 %d", index); } } @@ -523,7 +523,7 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) { #endif default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected bench subsystem %d %d", subsystem, index); + criticalError("Unexpected bench subsystem %d %d", subsystem, index); } } diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp index b7ea52f66c..b4dc28a54c 100644 --- a/firmware/controllers/can/can_dash.cpp +++ b/firmware/controllers/can/can_dash.cpp @@ -1307,7 +1307,7 @@ void updateDash(CanCycle cycle) { canDashboardTS(cycle); break; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Nothing for canNbcType %s", getCan_nbc_e(engineConfiguration->canNbcType)); + criticalError("Nothing for canNbcType %s", getCan_nbc_e(engineConfiguration->canNbcType)); break; } } diff --git a/firmware/controllers/can/rusefi_wideband.cpp b/firmware/controllers/can/rusefi_wideband.cpp index 4495995b2c..2116d97ca5 100644 --- a/firmware/controllers/can/rusefi_wideband.cpp +++ b/firmware/controllers/can/rusefi_wideband.cpp @@ -124,7 +124,7 @@ void setWidebandOffset(uint8_t index) { } if (!waitAck()) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Wideband index set failed: no controller detected!"); + criticalError("Wideband index set failed: no controller detected!"); } waitingBootloaderThread = nullptr; diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index f0f24dade6..4dabeca2b8 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -37,7 +37,7 @@ void checkLastBootError() { case ErrorCookie::HardFault: { efiPrintf("Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->FaultType, sramState->FaultAddress, sramState->Csfr); if (engineConfiguration->rethrowHardFault) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->FaultType, sramState->FaultAddress, sramState->Csfr); + criticalError("Last boot had hard fault type: %x addr: %x CSFR: %x", sramState->FaultType, sramState->FaultAddress, sramState->Csfr); } auto ctx = &sramState->FaultCtx; @@ -114,7 +114,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) { exit(-1); #else // EFI_PROD_CODE - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "assert fail %s %s:%d", msg, file, line); + criticalError("assert fail %s %s:%d", msg, file, line); // If on the main thread, longjmp back to the init process so we can keep USB alive if (chThdGetSelfX()->threadId == 0) { diff --git a/firmware/controllers/core/state_sequence.h b/firmware/controllers/core/state_sequence.h index 20a11f573f..f1a6bf3a3c 100644 --- a/firmware/controllers/core/state_sequence.h +++ b/firmware/controllers/core/state_sequence.h @@ -81,7 +81,7 @@ public: pin_state_t getChannelState(int channelIndex, int phaseIndex) const override { if (channelIndex >= waveCount) { // todo: would be nice to get this asserting working - //firmwareError(ObdCode::OBD_PCM_Processor_Fault, "channel index %d/%d", channelIndex, waveCount); + //criticalError("channel index %d/%d", channelIndex, waveCount); } return ((waveForm[phaseIndex] >> channelIndex) & 1) ? TriggerValue::RISE : TriggerValue::FALL; } @@ -97,7 +97,7 @@ public: void setChannelState(const int channelIndex, const int phaseIndex, pin_state_t state) { if (channelIndex >= waveCount) { // todo: would be nice to get this asserting working - //firmwareError(ObdCode::OBD_PCM_Processor_Fault, "channel index %d/%d", channelIndex, waveCount); + //criticalError("channel index %d/%d", channelIndex, waveCount); } uint8_t & ref = waveForm[phaseIndex]; ref = (ref & ~(1U << channelIndex)) | ((state == TriggerValue::RISE ? 1 : 0) << channelIndex); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index eadad2debd..36583db23a 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -490,7 +490,7 @@ void commonInitEngineController() { // Returns false if there's an obvious problem with the loaded configuration bool validateConfig() { if (engineConfiguration->cylindersCount > MAX_CYLINDER_COUNT) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Invalid cylinder count: %d", engineConfiguration->cylindersCount); + criticalError("Invalid cylinder count: %d", engineConfiguration->cylindersCount); return false; } diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index 51e6ab1bc4..4180c9bbd6 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -139,13 +139,13 @@ int eraseAndFlashCopy(flashaddr_t storageAddress, const TStorage& data) { auto err = intFlashErase(storageAddress, sizeof(TStorage)); if (FLASH_RETURN_SUCCESS != err) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Failed to erase flash at 0x%08x: %d", storageAddress, err); + criticalError("Failed to erase flash at 0x%08x: %d", storageAddress, err); return err; } err = intFlashWrite(storageAddress, reinterpret_cast(&data), sizeof(TStorage)); if (FLASH_RETURN_SUCCESS != err) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Failed to write flash at 0x%08x: %d", storageAddress, err); + criticalError("Failed to write flash at 0x%08x: %d", storageAddress, err); return err; } diff --git a/firmware/controllers/lua/can_filter.cpp b/firmware/controllers/lua/can_filter.cpp index 9820b6020a..6274adc4f0 100644 --- a/firmware/controllers/lua/can_filter.cpp +++ b/firmware/controllers/lua/can_filter.cpp @@ -28,7 +28,7 @@ void resetLuaCanRx() { void addLuaCanRxFilter(int32_t eid, uint32_t mask, int bus, int callback) { if (filterCount >= maxFilterCount) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Too many Lua CAN RX filters"); + criticalError("Too many Lua CAN RX filters"); } efiPrintf("Added Lua CAN RX filter id 0x%x mask 0x%x with%s custom function", eid, mask, (callback == -1 ? "out" : "")); diff --git a/firmware/controllers/lua/lua.cpp b/firmware/controllers/lua/lua.cpp index 06ff854c70..cbb047400a 100644 --- a/firmware/controllers/lua/lua.cpp +++ b/firmware/controllers/lua/lua.cpp @@ -168,13 +168,13 @@ static LuaHandle setupLuaState(lua_Alloc alloc) { LuaHandle ls = lua_newstate(alloc, NULL); if (!ls) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Failed to start Lua interpreter"); + criticalError("Failed to start Lua interpreter"); return nullptr; } lua_atpanic(ls, [](lua_State* l) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Lua panic: %s", lua_tostring(l, -1)); + criticalError("Lua panic: %s", lua_tostring(l, -1)); // hang the lua thread while (true) ; diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 71e86c0ced..77c4851934 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -64,7 +64,7 @@ float IFuelComputer::getTChargeCoefficient(int rpm, float tps) { engineConfiguration->tchargeValues ); } else { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected tChargeMode: %d", engineConfiguration->tChargeMode); + criticalError("Unexpected tChargeMode: %d", engineConfiguration->tChargeMode); return 0; } } diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp index 1ec56509ca..6bc04d56d9 100644 --- a/firmware/controllers/system/efi_gpio.cpp +++ b/firmware/controllers/system/efi_gpio.cpp @@ -626,7 +626,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e // Validate port if (port == GPIO_NULL) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "OutputPin::initPin got invalid port for pin idx %d", static_cast(brainPin)); + criticalError("OutputPin::initPin got invalid port for pin idx %d", static_cast(brainPin)); return; } @@ -664,7 +664,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e #ifndef DISABLE_PIN_STATE_VALIDATION // if the pin was set to logical 1, then set an error and disable the pin so that things don't catch fire if (logicalValue) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "HARDWARE VALIDATION FAILED %s: unexpected startup pin state %s actual value=%d logical value=%d mode=%s", msg, hwPortname(brainPin), actualValue, logicalValue, getPin_output_mode_e(outputMode)); + criticalError("HARDWARE VALIDATION FAILED %s: unexpected startup pin state %s actual value=%d logical value=%d mode=%s", msg, hwPortname(brainPin), actualValue, logicalValue, getPin_output_mode_e(outputMode)); OutputPin::deInit(); } #endif diff --git a/firmware/controllers/system/periodic_thread_controller.h b/firmware/controllers/system/periodic_thread_controller.h index f1e9d6b379..bff46495d0 100644 --- a/firmware/controllers/system/periodic_thread_controller.h +++ b/firmware/controllers/system/periodic_thread_controller.h @@ -79,7 +79,7 @@ private: chThdSleepUntilWindowed(before, before + m_period); } - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Thread died: %s", this->m_name); + criticalError("Thread died: %s", this->m_name); } public: diff --git a/firmware/controllers/system/timer/event_queue.cpp b/firmware/controllers/system/timer/event_queue.cpp index 4cb503a44c..806b20ddaf 100644 --- a/firmware/controllers/system/timer/event_queue.cpp +++ b/firmware/controllers/system/timer/event_queue.cpp @@ -103,7 +103,7 @@ void EventQueue::remove(scheduling_s* scheduling) { // Walked off the end, this is an error since this *should* have been scheduled if (!current) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "EventQueue::remove didn't find element"); + criticalError("EventQueue::remove didn't find element"); return; } diff --git a/firmware/controllers/system/timer/trigger_scheduler.cpp b/firmware/controllers/system/timer/trigger_scheduler.cpp index d18f520702..a0220057cd 100644 --- a/firmware/controllers/system/timer/trigger_scheduler.cpp +++ b/firmware/controllers/system/timer/trigger_scheduler.cpp @@ -151,7 +151,7 @@ AngleBasedEvent * TriggerScheduler::getElementAtIndexForUnitTest(int index) { return current; index--; } - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "getElementAtIndexForUnitText: null"); + criticalError("getElementAtIndexForUnitText: null"); return nullptr; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index d7fa00d982..57f4f9347b 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -123,7 +123,7 @@ bool TriggerWaveform::needsDisambiguation() const { case TWO_STROKE: return false; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "bad operationMode() in needsDisambiguation"); + criticalError("bad operationMode() in needsDisambiguation"); return true; } } diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index ace3b56f59..5241b7ee1c 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -194,7 +194,7 @@ static angle_t adjustCrankPhase(int camIndex) { return tc->syncAndReport(crankDivider, 0); case VVT_HONDA_K_INTAKE: // with 4 evenly spaced tooth we cannot use this wheel for engine sync - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Honda K Intake is not suitable for engine sync"); + criticalError("Honda K Intake is not suitable for engine sync"); [[fallthrough]]; case VVT_INACTIVE: // do nothing @@ -1145,11 +1145,11 @@ bool TriggerCentral::isTriggerConfigChanged() { void validateTriggerInputs() { if (!isBrainPinValid(engineConfiguration->triggerInputPins[0]) && isBrainPinValid(engineConfiguration->triggerInputPins[1])) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "First trigger channel is missing"); + criticalError("First trigger channel is missing"); } if (!isBrainPinValid(engineConfiguration->camInputs[0]) && isBrainPinValid(engineConfiguration->camInputs[2])) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "First bank cam input is required if second bank specified"); + criticalError("First bank cam input is required if second bank specified"); } } diff --git a/firmware/hw_layer/adc/adc_inputs.cpp b/firmware/hw_layer/adc/adc_inputs.cpp index 6599d8bc11..b517f2e1e5 100644 --- a/firmware/hw_layer/adc/adc_inputs.cpp +++ b/firmware/hw_layer/adc/adc_inputs.cpp @@ -164,7 +164,7 @@ static void fast_adc_callback(GPTDriver*) { ADC_FAST_DEVICE.state != ADC_COMPLETE && ADC_FAST_DEVICE.state != ADC_ERROR) { fastAdc.errorsCount++; - // todo: when? why? firmwareError(ObdCode::OBD_PCM_Processor_Fault, "ADC fast not ready?"); + // todo: when? why? criticalError("ADC fast not ready?"); chSysUnlockFromISR() ; return; @@ -253,7 +253,7 @@ bool AdcDevice::isHwUsed(adc_channel_e hwChannelIndex) const { void AdcDevice::enableChannel(adc_channel_e hwChannel) { if ((channelCount + 1) >= ADC_MAX_CHANNELS_COUNT) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Too many ADC channels configured"); + criticalError("Too many ADC channels configured"); return; } diff --git a/firmware/hw_layer/digital_input/digital_input_exti.cpp b/firmware/hw_layer/digital_input/digital_input_exti.cpp index 70d217f410..043ae29ce9 100644 --- a/firmware/hw_layer/digital_input/digital_input_exti.cpp +++ b/firmware/hw_layer/digital_input/digital_input_exti.cpp @@ -253,7 +253,7 @@ CH_FAST_IRQ_HANDLER(VectorE0) { // TODO: non-stm32 exti void efiExtiInit() { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "exti not supported"); + criticalError("exti not supported"); } void efiExtiEnablePin(const char *, brain_pin_e, uint32_t, ExtiCallback, void *) { } diff --git a/firmware/hw_layer/drivers/can/can_hw.cpp b/firmware/hw_layer/drivers/can/can_hw.cpp index 81822a881a..af706c8169 100644 --- a/firmware/hw_layer/drivers/can/can_hw.cpp +++ b/firmware/hw_layer/drivers/can/can_hw.cpp @@ -360,7 +360,7 @@ void initCan() { // Devices can't be the same! if (device1 == device2) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "CAN pins must be set to different devices"); + criticalError("CAN pins must be set to different devices"); return; } diff --git a/firmware/hw_layer/drivers/sent/sent_hw_icu.cpp b/firmware/hw_layer/drivers/sent/sent_hw_icu.cpp index 3b31884d86..a1256e2865 100644 --- a/firmware/hw_layer/drivers/sent/sent_hw_icu.cpp +++ b/firmware/hw_layer/drivers/sent/sent_hw_icu.cpp @@ -61,7 +61,7 @@ void startSent() { if (getIcuParams(sentPin, &pinAF, &icu, &cfg->channel, &baseClock) != true) { /* this pin has no ICU functionality, of ICU driver is not enabled for TIM on this pin */ - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "No ICU on selected SENT pin"); + criticalError("No ICU on selected SENT pin"); continue; } diff --git a/firmware/hw_layer/ports/stm32/backup_ram.cpp b/firmware/hw_layer/ports/stm32/backup_ram.cpp index c782ed3988..3edb53e75b 100644 --- a/firmware/hw_layer/ports/stm32/backup_ram.cpp +++ b/firmware/hw_layer/ports/stm32/backup_ram.cpp @@ -19,7 +19,7 @@ uint32_t backupRamLoad(backup_ram_e idx) { // case DFU_JUMP_REQUESTED: // return RTCD1.rtc->BKP4R; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Invalid backup ram idx %d", idx); + criticalError("Invalid backup ram idx %d", idx); return 0; } #else @@ -43,7 +43,7 @@ void backupRamSave(backup_ram_e idx, uint32_t value) { RTCD1.rtc->BKP4R = value; break; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Invalid backup ram idx %d, value 0x08x", idx, value); + criticalError("Invalid backup ram idx %d, value 0x08x", idx, value); break; } #endif /* HAL_USE_RTC */ diff --git a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp index ab10991fcc..905d67eca3 100644 --- a/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp @@ -105,7 +105,7 @@ float getMcuTemperature() { if (degrees > 150.0f || degrees < -50.0f) { /* * we have a sporadic issue with this check todo https://github.com/rusefi/rusefi/issues/2552 - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Invalid CPU temperature measured %f", degrees); + criticalError("Invalid CPU temperature measured %f", degrees); */ } diff --git a/firmware/hw_layer/ports/stm32/stm32_common.cpp b/firmware/hw_layer/ports/stm32/stm32_common.cpp index 7d860595c9..c408eb2b62 100644 --- a/firmware/hw_layer/ports/stm32/stm32_common.cpp +++ b/firmware/hw_layer/ports/stm32/stm32_common.cpp @@ -135,7 +135,7 @@ adc_channel_e getAdcChannel(brain_pin_e pin) { case Gpio::Unassigned: return EFI_ADC_NONE; default: - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "getAdcChannel %d", pin); + criticalError("getAdcChannel %d", pin); return EFI_ADC_ERROR; } } @@ -218,7 +218,7 @@ public: void setDuty(float duty) override { if (!m_driver) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Attempted to set duty on null hard PWM device"); + criticalError("Attempted to set duty on null hard PWM device"); return; } @@ -312,7 +312,7 @@ stm32_hardware_pwm* getNextPwmDevice() { } } - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Run out of hardware PWM devices!"); + criticalError("Run out of hardware PWM devices!"); return nullptr; } @@ -497,7 +497,7 @@ static int getSpiAf(SPIDriver *driver) { return EFI_SPI3_AF; } #endif - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "SPI AF not available"); + criticalError("SPI AF not available"); return -1; } @@ -558,7 +558,7 @@ void turnOnSpi(spi_device_e device) { engineConfiguration->spi1MosiMode, engineConfiguration->spi1MisoMode); #else - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "SPI1 not available in this binary"); + criticalError("SPI1 not available in this binary"); #endif /* STM32_SPI_USE_SPI1 */ } if (device == SPI_DEVICE_2) { @@ -571,7 +571,7 @@ void turnOnSpi(spi_device_e device) { engineConfiguration->spi2MosiMode, engineConfiguration->spi2MisoMode); #else - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "SPI2 not available in this binary"); + criticalError("SPI2 not available in this binary"); #endif /* STM32_SPI_USE_SPI2 */ } if (device == SPI_DEVICE_3) { @@ -584,7 +584,7 @@ void turnOnSpi(spi_device_e device) { engineConfiguration->spi3MosiMode, engineConfiguration->spi3MisoMode); #else - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "SPI3 not available in this binary"); + criticalError("SPI3 not available in this binary"); #endif /* STM32_SPI_USE_SPI3 */ } if (device == SPI_DEVICE_4) { @@ -593,7 +593,7 @@ void turnOnSpi(spi_device_e device) { /* there are no configuration fields for SPI4 in engineConfiguration, rely on board init code * it should set proper functions for SPI4 pins */ #else - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "SPI4 not available in this binary"); + criticalError("SPI4 not available in this binary"); #endif /* STM32_SPI_USE_SPI4 */ } } @@ -722,7 +722,7 @@ CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx) { if (isValidCan2RxPin(pinRx) && isValidCan2TxPin(pinTx)) return &CAND2; #endif - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "invalid CAN pins tx %s and rx %s", hwPortname(pinTx), hwPortname(pinRx)); + criticalError("invalid CAN pins tx %s and rx %s", hwPortname(pinTx), hwPortname(pinRx)); return nullptr; } diff --git a/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp b/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp index 282c7f5325..0b0af3a19b 100644 --- a/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp +++ b/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp @@ -39,14 +39,14 @@ static DeviceType determineDevice() { } else { if (fs == 1024) { // Unsupported scenario! Not enough space for program plus two config copies - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "1MB single bank MCU detected: please clear nDBANK option bit and reinstall FW."); + criticalError("1MB single bank MCU detected: please clear nDBANK option bit and reinstall FW."); return DeviceType::SingleBank1MB; } else if (fs == 2048) { return DeviceType::SingleBank2MB; } } - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unrecognized flash memory layout db=%d, size=%d", db, fs); + criticalError("Unrecognized flash memory layout db=%d, size=%d", db, fs); return DeviceType::Unknown; } diff --git a/firmware/init/sensor/init_lambda.cpp b/firmware/init/sensor/init_lambda.cpp index a68fac7119..d14712e98a 100644 --- a/firmware/init/sensor/init_lambda.cpp +++ b/firmware/init/sensor/init_lambda.cpp @@ -50,7 +50,7 @@ void initLambda() { #if EFI_CAN_SUPPORT if (engineConfiguration->enableAemXSeries) { if (!engineConfiguration->canWriteEnabled || !engineConfiguration->canReadEnabled) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "CAN read and write are required to use CAN wideband."); + criticalError("CAN read and write are required to use CAN wideband."); return; } diff --git a/firmware/init/sensor/init_sensors.cpp b/firmware/init/sensor/init_sensors.cpp index 6699e57438..23fc04c8c3 100644 --- a/firmware/init/sensor/init_sensors.cpp +++ b/firmware/init/sensor/init_sensors.cpp @@ -42,7 +42,7 @@ void deInitIfValid(const char* msg, adc_channel_e channel) { static void initOldAnalogInputs() { if (isAdcChannelValid(engineConfiguration->afr.hwChannel) && engineConfiguration->enableAemXSeries) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Please pick either analog AFR or CAN AFR input not both."); + criticalError("Please pick either analog AFR or CAN AFR input not both."); } initIfValid("AFR", engineConfiguration->afr.hwChannel); initIfValid("AUXF#1", engineConfiguration->auxFastSensor1_adcChannel); diff --git a/firmware/util/math/interpolation.cpp b/firmware/util/math/interpolation.cpp index c40d0a9dd7..fe08a17f7c 100644 --- a/firmware/util/math/interpolation.cpp +++ b/firmware/util/math/interpolation.cpp @@ -103,7 +103,7 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl float interpolateClampedWithValidation(float x1, float y1, float x2, float y2, float x) { if (x1 >= x2) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "interpolateClamped %f has to be smaller than %f", x1, x2); + criticalError("interpolateClamped %f has to be smaller than %f", x1, x2); } return interpolateClamped(x1, y1, x2, y2, x); } diff --git a/misc/stm32f1_test_project/timer/event_queue.cpp b/misc/stm32f1_test_project/timer/event_queue.cpp index 266399ecf8..2dc5655b18 100644 --- a/misc/stm32f1_test_project/timer/event_queue.cpp +++ b/misc/stm32f1_test_project/timer/event_queue.cpp @@ -104,7 +104,7 @@ void EventQueue::remove(scheduling_s* scheduling) { // Walked off the end, this is an error since this *should* have been scheduled if (!current) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "EventQueue::remove didn't find element"); + criticalError("EventQueue::remove didn't find element"); return; } diff --git a/simulator/simulator/rusEfiFunctionalTest.cpp b/simulator/simulator/rusEfiFunctionalTest.cpp index 8521ada750..d4d6794db5 100644 --- a/simulator/simulator/rusEfiFunctionalTest.cpp +++ b/simulator/simulator/rusEfiFunctionalTest.cpp @@ -39,7 +39,7 @@ int getRemainingStack(thread_t*) { static void assertString(const char*actual, const char *expected) { if (strcmp(actual, expected) != 0) { printf("assertString FAILED\n"); - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "chprintf test: got %s while %s", actual, expected); + criticalError("chprintf test: got %s while %s", actual, expected); } } @@ -105,7 +105,7 @@ static void runToothLoggerTest() { // no data yet CompositeBuffer * toothBuffer = GetToothLoggerBufferNonblocking(); if (toothBuffer != nullptr) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "nullptr buffer expected"); + criticalError("nullptr buffer expected"); } } diff --git a/unit_tests/test-framework/logicdata_csv_reader.cpp b/unit_tests/test-framework/logicdata_csv_reader.cpp index c30f28a44e..dd0ffd8973 100644 --- a/unit_tests/test-framework/logicdata_csv_reader.cpp +++ b/unit_tests/test-framework/logicdata_csv_reader.cpp @@ -80,7 +80,7 @@ void CsvReader::processLine(EngineTestHelper *eth) { } if (timeStampstr == nullptr) { - firmwareError(ObdCode::OBD_PCM_Processor_Fault, "End of File"); + criticalError("End of File"); return; }