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
*/
#include "pch.h"
#include "bmw_m73.h"
#include "custom_engine.h"
#include "hip9011_logic.h"

View File

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

View File

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

View File

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

View File

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

View File

@ -30,8 +30,6 @@ void FuelSchedule::resetOverlapping() {
* @returns false in case of error, true if success
*/
bool FuelSchedule::addFuelEventsForCylinder(int i ) {
efiAssert(CUSTOM_ERR_ASSERT, engine!=NULL, "engine is NULL", false);
floatus_t oneDegreeUs = engine->rpmCalculator.oneDegreeUs; // local copy
if (cisnan(oneDegreeUs)) {
// 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() {
efiAssertVoid(CUSTOM_ERR_6631, engine!=NULL, "null engine");
#if EFI_PROD_CODE
addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine);
#endif

View File

@ -180,7 +180,7 @@ void initRpmCalculator();
#define getRevolutionCounter() (engine->rpmCalculator.getRevolutionCounterM())
#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
#define addEngineSnifferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */

View File

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

View File

@ -117,7 +117,7 @@ bool doOneLuaCanRx(LuaHandle& ls) {
// We're done, return this frame to the free list
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
return true;

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,6 @@
#include <limits>
#include <string.h>
#include <stdint.h>
#include "rusefi_true.h"
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 {
for (int i = 0; i < currentIndex ; i++) {
if (elements[i] == value) {
return TRUE;
return true;
}
}
return FALSE;
return false;
}
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
#include "rusefi_true.h"
// see SIM_SD1_PORT and SIM_SD2_PORT
#define TS_PRIMARY_SERIAL SD1
#define TS_SECONDARY_SERIAL SD2

View File

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