oh my god we've had no asserts (#3595)

This commit is contained in:
Matthew Kennedy 2021-11-22 14:52:03 -08:00 committed by GitHub
parent 6ca471494b
commit 9bd8a19564
18 changed files with 15 additions and 43 deletions

View File

@ -72,6 +72,8 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "pch.h"
#include "bmw_m73.h" #include "bmw_m73.h"
#include "custom_engine.h" #include "custom_engine.h"
#include "hip9011_logic.h" #include "hip9011_logic.h"

View File

@ -57,8 +57,6 @@ case CUSTOM_EGO_TYPE:
return "CUSTOM_EGO_TYPE"; return "CUSTOM_EGO_TYPE";
case CUSTOM_EMPTY_FSIO_STACK: case CUSTOM_EMPTY_FSIO_STACK:
return "CUSTOM_EMPTY_FSIO_STACK"; return "CUSTOM_EMPTY_FSIO_STACK";
case CUSTOM_ENGINE_REF:
return "CUSTOM_ENGINE_REF";
case CUSTOM_ERROR_ICU: case CUSTOM_ERROR_ICU:
return "CUSTOM_ERROR_ICU"; return "CUSTOM_ERROR_ICU";
case CUSTOM_ERR_2ND_WATCHDOG: case CUSTOM_ERR_2ND_WATCHDOG:

View File

@ -1164,8 +1164,6 @@ void applyNonPersistentConfiguration() {
efiPrintf("applyNonPersistentConfiguration()"); efiPrintf("applyNonPersistentConfiguration()");
#endif #endif
assertEngineReference();
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
engine->initializeTriggerWaveform(); engine->initializeTriggerWaveform();
#endif // EFI_ENGINE_CONTROL #endif // EFI_ENGINE_CONTROL

View File

@ -1945,7 +1945,7 @@ typedef enum {
CUSTOM_ERR_6598 = 6598, CUSTOM_ERR_6598 = 6598,
CUSTOM_ERR_6599 = 6599, CUSTOM_ERR_6599 = 6599,
CUSTOM_ENGINE_REF = 6600, CUSTOM_ERR_6600 = 6600,
CUSTOM_CONSOLE_TOO_MANY = 6601, CUSTOM_CONSOLE_TOO_MANY = 6601,
CUSTOM_APPEND_NULL = 6602, CUSTOM_APPEND_NULL = 6602,
CUSTOM_ERR_6603 = 6603, CUSTOM_ERR_6603 = 6603,

View File

@ -83,7 +83,6 @@ static LEElement * mainRelayLogic;
#if EFI_PROD_CODE || EFI_SIMULATOR #if EFI_PROD_CODE || EFI_SIMULATOR
FsioResult getEngineValue(le_action_e action) { FsioResult getEngineValue(le_action_e action) {
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "getLEValue", unexpected);
switch (action) { switch (action) {
case LE_METHOD_FAN: case LE_METHOD_FAN:
return enginePins.fanRelay.getLogicValue(); return enginePins.fanRelay.getLogicValue();

View File

@ -30,8 +30,6 @@ void FuelSchedule::resetOverlapping() {
* @returns false in case of error, true if success * @returns false in case of error, true if success
*/ */
bool FuelSchedule::addFuelEventsForCylinder(int i ) { bool FuelSchedule::addFuelEventsForCylinder(int i ) {
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "engine is NULL", false);
floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs; // local copy floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs; // local copy
if (cisnan(oneDegreeUs)) { if (cisnan(oneDegreeUs)) {
// in order to have fuel schedule we need to have current RPM // in order to have fuel schedule we need to have current RPM

View File

@ -503,8 +503,6 @@ static void showMainInfo(Engine *engine) {
} }
void initMainEventListener() { void initMainEventListener() {
efiAssertVoid(CUSTOM_ERR_6631, engine!=NULL, "null engine");
#if EFI_PROD_CODE #if EFI_PROD_CODE
addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine); addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine);
#endif #endif

View File

@ -180,7 +180,7 @@ void initRpmCalculator();
#define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM()) #define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM())
#if EFI_ENGINE_SNIFFER #if EFI_ENGINE_SNIFFER
#define addEngineSnifferEvent(name, msg) { efiAssertVoid(OBD_PCM_Processor_Fault, engine!=NULL, "engine ptr missing"); if (engine->isEngineChartEnabled) { waveChart.addEvent3((name), (msg)); } } #define addEngineSnifferEvent(name, msg) { if (engine->isEngineChartEnabled) { waveChart.addEvent3((name), (msg)); } }
#else #else
#define addEngineSnifferEvent(n, msg) {} #define addEngineSnifferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */

View File

@ -193,7 +193,6 @@ void writeToFlashNow(void) {
} else { } else {
efiPrintf("Flashing failed"); efiPrintf("Flashing failed");
} }
assertEngineReference();
resetMaxValues(); resetMaxValues();

View File

@ -117,7 +117,7 @@ bool doOneLuaCanRx(LuaHandle& ls) {
// We're done, return this frame to the free list // We're done, return this frame to the free list
msg = freeBuffers.post(frame, TIME_IMMEDIATE); msg = freeBuffers.post(frame, TIME_IMMEDIATE);
efiAssertVoid(OBD_PCM_Processor_Fault, msg == MSG_OK, "lua can post to free buffer fail"); efiAssert(OBD_PCM_Processor_Fault, msg == MSG_OK, "lua can post to free buffer fail", false);
// We processed a frame so we should check again // We processed a frame so we should check again
return true; return true;

View File

@ -11,8 +11,6 @@
void setAlgorithm(engine_load_mode_e algo); void setAlgorithm(engine_load_mode_e algo);
#define assertEngineReference() efiAssertVoid(CUSTOM_ENGINE_REF, engine != NULL, "engine is NULL")
void setFlatInjectorLag(float value); void setFlatInjectorLag(float value);
#define fixAngle(angle, msg, code) fixAngle2(angle, msg, code, engine->engineCycle) #define fixAngle(angle, msg, code) fixAngle2(angle, msg, code, engine->engineCycle)

View File

@ -820,8 +820,6 @@ void onConfigurationChangeTriggerCallback() {
changed |= isConfigurationChanged(overrideTriggerGaps); changed |= isConfigurationChanged(overrideTriggerGaps);
if (changed) { if (changed) {
assertEngineReference();
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
engine->initializeTriggerWaveform(); engine->initializeTriggerWaveform();
engine->triggerCentral.noiseFilter.resetAccumSignalData(); engine->triggerCentral.noiseFilter.resetAccumSignalData();

View File

@ -9,6 +9,14 @@
* this file. * this file.
*/ */
#ifndef FALSE
#define FALSE (0)
#endif /* FALSE */
#ifndef TRUE
#define TRUE (!(FALSE))
#endif /* TRUE */
#include "efifeatures.h" #include "efifeatures.h"
#include "rusefi_generated.h" #include "rusefi_generated.h"
#include "loggingcentral.h" #include "loggingcentral.h"

View File

@ -164,7 +164,6 @@ void runMainLoop();
void runRusEfi() { void runRusEfi() {
efiAssertVoid(CUSTOM_RM_STACK_1, getCurrentRemainingStack() > 512, "init s"); efiAssertVoid(CUSTOM_RM_STACK_1, getCurrentRemainingStack() > 512, "init s");
assertEngineReference();
engine->setConfig(); engine->setConfig();
#if EFI_TEXT_LOGGING #if EFI_TEXT_LOGGING

View File

@ -16,7 +16,6 @@
#include <limits> #include <limits>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include "rusefi_true.h"
static const short CB_MAX_SIZE = 128; static const short CB_MAX_SIZE = 128;
@ -78,10 +77,10 @@ template<typename T, size_t maxSize>
bool cyclic_buffer<T, maxSize>::contains(T value) const { bool cyclic_buffer<T, maxSize>::contains(T value) const {
for (int i = 0; i < currentIndex ; i++) { for (int i = 0; i < currentIndex ; i++) {
if (elements[i] == value) { if (elements[i] == value) {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
template<typename T, size_t maxSize> template<typename T, size_t maxSize>

View File

@ -1,18 +0,0 @@
/*
* rusefi_true.h
*
* @date Dec 8, 2018
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
// we still have a minor mess with headers, this header should better be included as high as possible
#ifndef FALSE
#define FALSE (0)
#endif /* FALSE */
#ifndef TRUE
#define TRUE (!(FALSE))
#endif /* TRUE */

View File

@ -7,8 +7,6 @@
#pragma once #pragma once
#include "rusefi_true.h"
// see SIM_SD1_PORT and SIM_SD2_PORT // see SIM_SD1_PORT and SIM_SD2_PORT
#define TS_PRIMARY_SERIAL SD1 #define TS_PRIMARY_SERIAL SD1
#define TS_SECONDARY_SERIAL SD2 #define TS_SECONDARY_SERIAL SD2

View File

@ -7,8 +7,6 @@
#pragma once #pragma once
#include "rusefi_true.h"
#define EFI_ENABLE_ASSERTS TRUE #define EFI_ENABLE_ASSERTS TRUE
#define EFI_EMULATE_POSITION_SENSORS TRUE #define EFI_EMULATE_POSITION_SENSORS TRUE