save some ram (#1211)

* remove dead stuff

* why store those pointers twice?
This commit is contained in:
Matthew Kennedy 2020-03-22 16:06:29 -07:00 committed by GitHub
parent f587b9f555
commit 4740f525ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 14 additions and 98 deletions

View File

@ -9,8 +9,6 @@
* The whole idea of bootloader is to make it as small as possible. And reasonably independent.
*/
int maxNesting = 0;
void chDbgPanic3(const char */*msg*/, const char * /*file*/, int /*line*/) {
}

View File

@ -39,9 +39,6 @@ extern SerialUSBDriver SDU1;
// 10 seconds
#define CONSOLE_WRITE_TIMEOUT 10000
int lastWriteSize;
int lastWriteActual;
static bool isSerialConsoleStarted = false;
static event_listener_t consoleEventListener;
@ -253,11 +250,8 @@ void consolePutChar(int x) {
}
void consoleOutputBuffer(const uint8_t *buf, int size) {
lastWriteSize = size;
#if !EFI_UART_ECHO_TEST_MODE
lastWriteActual = chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
// if (r != size)
// firmwareError(OBD_PCM_Processor_Fault, "Partial console write");
chnWriteTimeout(getConsoleChannel(), buf, size, CONSOLE_WRITE_TIMEOUT);
#endif /* EFI_UART_ECHO_TEST_MODE */
}

View File

@ -36,8 +36,7 @@ EXTERN_ENGINE
static Logging *logger;
static SimplePwm alternatorControl("alt");
static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
static PidIndustrial alternatorPid(altPidS);
static PidIndustrial alternatorPid(&persistentState.persistentConfiguration.engineConfiguration.alternatorControl);
static percent_t currentAltDuty;

View File

@ -57,8 +57,7 @@ public:
void init(int index) {
this->index = index;
pid_s *auxPidS = &persistentState.persistentConfiguration.engineConfiguration.auxPid[index];
auxPid.initPidClass(auxPidS);
auxPid.initPidClass(&persistentState.persistentConfiguration.engineConfiguration.auxPid[index]);
table = getFSIOTable(index);
}

View File

@ -37,8 +37,7 @@ static Logging *logger;
static boostOpenLoop_Map3D_t boostMapOpen("boostmapopen", 1);
static boostOpenLoop_Map3D_t boostMapClosed("boostmapclosed", 1);
static SimplePwm boostPwmControl("boost");
static pid_s *boostPidS = &persistentState.persistentConfiguration.engineConfiguration.boostPid;
static Pid boostControlPid(boostPidS);
static Pid boostControlPid(&persistentState.persistentConfiguration.engineConfiguration.boostPid);
static bool shouldResetPid = false;

View File

@ -64,8 +64,7 @@ static InjectionEvent primeInjEvent;
static Logging *logger;
#if ! EFI_UNIT_TEST
static pid_s *fuelPidS = &persistentState.persistentConfiguration.engineConfiguration.fuelClosedLoopPid;
static Pid fuelPid(fuelPidS);
static Pid fuelPid(&persistentState.persistentConfiguration.engineConfiguration.fuelClosedLoopPid);
#endif
// todo: figure out if this even helps?

View File

@ -130,64 +130,6 @@ void initLcdController(void) {
msObjectInit(&lcdLineStream, (uint8_t *) lcdLineBuffer, sizeof(lcdLineBuffer), 0);
}
static const char* ignitionModeStr[] = { "1C", "IND", "WS" };
static const char* injectionModeStr[] = { "Sim", "Seq", "Bch" };
static const char* idleModeStr[] = { "I:A", "I:M" };
//static const char *getPinShortName(io_pin_e pin) {
// switch (pin) {
// case ALTERNATOR_SWITCH:
// return "AL";
// case FUEL_PUMP_RELAY:
// return "FP";
// case FAN_RELAY:
// return "FN";
// case O2_HEATER:
// return "O2H";
// default:
// firmwareError(OBD_PCM_Processor_Fault, "No short name for %d", (int) pin);
// return "";
// }
//}
//char * appendPinStatus(char *buffer, io_pin_e pin) {
// char *ptr = appendStr(buffer, getPinShortName(pin));
// int state = getOutputPinValue(pin);
// // todo: should we handle INITIAL_PIN_STATE?
// if (state) {
// return appendStr(ptr, ":Y ");
// } else {
// return appendStr(ptr, ":n ");
// }
//}
#if 0
static char * prepareInfoLine(engine_configuration_s *engineConfiguration, char *buffer) {
char *ptr = buffer;
ptr = appendStr(ptr, " ");
ptr = appendStr(ptr, ignitionModeStr[engineConfiguration->ignitionMode]);
ptr = appendStr(ptr, " ");
ptr = appendStr(ptr, injectionModeStr[engineConfiguration->injectionMode]);
ptr = appendStr(ptr, " ");
ptr = appendStr(ptr, idleModeStr[engineConfiguration->idleMode]);
ptr = appendStr(ptr, " ");
return ptr;
}
#endif
//static char * prepareStatusLine(char *buffer) {
// char *ptr = buffer;
//
// ptr = appendPinStatus(ptr, FUEL_PUMP_RELAY);
// ptr = appendPinStatus(ptr, FAN_RELAY);
// ptr = appendPinStatus(ptr, O2_HEATER);
// return ptr;
//}
static char buffer[MAX_LCD_WIDTH + 4];
static void lcdPrintf(const char *fmt, ...) {

View File

@ -43,9 +43,10 @@ static const float maxAfrDeviation = 5.0f; // 9.7..19.7
static const int minAvgSize = (EGO_AVG_BUF_SIZE / 2); // ~0.6 sec for 20ms period of 'fast' callback, and it matches a lag time of most narrow EGOs
static const int maxAvgSize = (EGO_AVG_BUF_SIZE - 1); // the whole buffer
#ifdef EFI_NARROW_EGO_AVERAGING
// we store the last measured AFR value to predict the current averaging window size
static float lastAfr = stoichAfr;
#endif
void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// Our averaging is intended for use only with Narrow EGOs.

View File

@ -58,7 +58,6 @@ extern WaveChart waveChart;
static char LOGGING_BUFFER[SETTINGS_LOGGING_BUFFER_SIZE];
static Logging logger("settings control", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
extern int maxNesting;
EXTERN_ENGINE
;
@ -279,8 +278,6 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(engineConfiguration->clutchDownPin),
boolToString(engine->clutchDownState));
scheduleMsg(&logger, "nesting=%d", maxNesting);
scheduleMsg(&logger, "digitalPotentiometerSpiDevice %d", engineConfiguration->digitalPotentiometerSpiDevice);
for (int i = 0; i < DIGIPOT_COUNT; i++) {

View File

@ -194,9 +194,6 @@ int maxTriggerReentraint = 0;
uint32_t triggerDuration;
uint32_t triggerMaxDuration = 0;
static bool isInsideTriggerHandler = false;
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
ScopePerf perf(PE::HandleShaftSignal, static_cast<uint8_t>(signal));
@ -215,15 +212,15 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
}
}
uint32_t triggerHandlerEntryTime = getTimeNowLowerNt();
isInsideTriggerHandler = true;
if (triggerReentraint > maxTriggerReentraint)
maxTriggerReentraint = triggerReentraint;
triggerReentraint++;
efiAssertVoid(CUSTOM_ERR_6636, getCurrentRemainingStack() > 128, "lowstck#8");
engine->triggerCentral.handleShaftSignal(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
triggerReentraint--;
triggerDuration = getTimeNowLowerNt() - triggerHandlerEntryTime;
isInsideTriggerHandler = false;
if (triggerDuration > triggerMaxDuration)
triggerMaxDuration = triggerDuration;
}

View File

@ -67,18 +67,6 @@ extern bool hasFirmwareErrorFlag;
static mutex_t spiMtx;
/**
* this depends on patch to chdebug.c
+extern int maxNesting;
ch.dbg.isr_cnt++;
+ if (ch.dbg.isr_cnt > maxNesting)
+ maxNesting = ch.dbg.isr_cnt;
port_unlock_from_isr();
*
*/
// todo: rename this to 'rusefiMaxISRNesting' one day
int maxNesting = 0;
#if HAL_USE_SPI
extern bool isSpiInitialized[5];

View File

@ -3,6 +3,9 @@
*
*/
#include "global.h"
#if EFI_MC33816
// Data to be loaded into the Code RAM 1 memory space
const unsigned short MC33816_code_RAM1[62] =
@ -85,3 +88,5 @@ const unsigned short MC33816_diag_config[44] =
0x001E, 0x0000, 0x0000, 0x001E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0001
};
#endif // EFI_MC33816

View File

@ -141,8 +141,6 @@ void printPendingMessages(void) {
int isSerialOverTcpReady;
int maxNesting = 0;
bool isCommandLineConsoleReady(void) {
return isSerialOverTcpReady;
}