remove simple cases of LoggingWithStorage (#2569)

* remove simple cases

* more simple

* serial

* s

* more

* try memory

* easy

* mmc acc

* that's how much memory

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-04-19 05:11:59 -07:00 committed by GitHub
parent 8c0cff1b1b
commit bbb6b6dd14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 102 additions and 144 deletions

View File

@ -44,9 +44,6 @@ static THD_WORKING_AREA(btThreadStack, UTILITY_THREAD_STACK_SIZE);
static thread_t *btThread = nullptr;
static thread_reference_t btThreadRef = nullptr; // used by thread suspend/resume as a flag
static LoggingWithStorage btLogger("bluetooth");
EXTERN_ENGINE;
@ -131,19 +128,19 @@ static void runCommands() {
// the connection is already restored to the current baud rate, so print the result
if (cmdIdx == numCommands)
scheduleMsg(&btLogger, "SUCCESS! All commands (%d of %d) passed to the Bluetooth module!", cmdIdx, numCommands);
efiPrintf("SUCCESS! All commands (%d of %d) passed to the Bluetooth module!", cmdIdx, numCommands);
else
scheduleMsg(&btLogger, "FAIL! Only %d commands (of %d total) were passed to the Bluetooth module!", cmdIdx, numCommands);
efiPrintf("FAIL! Only %d commands (of %d total) were passed to the Bluetooth module!", cmdIdx, numCommands);
}
static THD_FUNCTION(btThreadEntryPoint, arg) {
(void) arg;
chRegSetThreadName("bluetooth thread");
scheduleMsg(&btLogger, "*** Bluetooth module setup procedure ***");
scheduleMsg(&btLogger, "!Warning! Please make sure you're not currently using the BT module for communication (not paired)!");
scheduleMsg(&btLogger, "TO START THE PROCEDURE: PLEASE DISCONNECT YOUR PC COM-PORT FROM THE BOARD NOW!");
scheduleMsg(&btLogger, "After that please don't turn off the board power and wait for ~15 seconds to complete. Then reconnect to the board!");
efiPrintf("*** Bluetooth module setup procedure ***");
efiPrintf("!Warning! Please make sure you're not currently using the BT module for communication (not paired)!");
efiPrintf("TO START THE PROCEDURE: PLEASE DISCONNECT YOUR PC COM-PORT FROM THE BOARD NOW!");
efiPrintf("After that please don't turn off the board power and wait for ~15 seconds to complete. Then reconnect to the board!");
// now wait
chSysLock();
@ -151,7 +148,7 @@ static THD_FUNCTION(btThreadEntryPoint, arg) {
chSysUnlock();
if (msg == MSG_TIMEOUT) {
scheduleMsg(&btLogger, "The Bluetooth module init procedure is cancelled (timeout)!");
efiPrintf("The Bluetooth module init procedure is cancelled (timeout)!");
return;
} else {
// call this when the thread is resumed (after the disconnect)
@ -172,12 +169,12 @@ void bluetoothStart(SerialTsChannelBase *btChan, bluetooth_module_e moduleType,
// if a binary protocol uses USB, we cannot init the bluetooth module!
if (!CONFIG(useSerialPort)) {
scheduleMsg(&btLogger, "Failed! Serial Port connection is disabled!");
efiPrintf("Failed! Serial Port connection is disabled!");
return;
}
if (btProcessIsStarted) {
scheduleMsg(&btLogger, "The Bluetooth module init procedure is already started and waiting! To cancel it, run \"bluetooth_cancel\" command!");
efiPrintf("The Bluetooth module init procedure is already started and waiting! To cancel it, run \"bluetooth_cancel\" command!");
return;
}
@ -198,10 +195,10 @@ void bluetoothStart(SerialTsChannelBase *btChan, bluetooth_module_e moduleType,
// check the baud rate index
if (setBaudIdx < 1) {
if (baud == 0)
scheduleMsg(&btLogger, "The <baud> parameter is set to zero! The baud rate won't be set!");
efiPrintf("The <baud> parameter is set to zero! The baud rate won't be set!");
else {
// unknown baud rate
scheduleMsg(&btLogger, "Wrong <baud> parameter '%s'! %s", baudRate, usage);
efiPrintf("Wrong <baud> parameter '%s'! %s", baudRate, usage);
return;
}
} else {
@ -211,7 +208,7 @@ void bluetoothStart(SerialTsChannelBase *btChan, bluetooth_module_e moduleType,
// 2) check name
if (name == NULL || strlen(name) < 1 || strlen(name) > 20) {
scheduleMsg(&btLogger, "Wrong <name> parameter! Up to 20 characters expected! %s", usage);
efiPrintf("Wrong <name> parameter! Up to 20 characters expected! %s", usage);
return;
}
@ -225,7 +222,7 @@ void bluetoothStart(SerialTsChannelBase *btChan, bluetooth_module_e moduleType,
}
}
if (numDigits != 4) {
scheduleMsg(&btLogger, "Wrong <pincode> parameter! 4 digits expected! %s", usage);
efiPrintf("Wrong <pincode> parameter! 4 digits expected! %s", usage);
return;
}
@ -254,7 +251,7 @@ void bluetoothStart(SerialTsChannelBase *btChan, bluetooth_module_e moduleType,
break;
default:
// todo: add support for other BT module types
scheduleMsg(&btLogger, "This Bluetooth module is currently not supported!");
efiPrintf("This Bluetooth module is currently not supported!");
return;
}
commands[numCommands++] = cmdHello; // this command is added to test a connection
@ -279,7 +276,7 @@ void bluetoothSoftwareDisconnectNotify() {
void bluetoothCancel() {
if (!btProcessIsStarted) {
scheduleMsg(&btLogger, "The Bluetooth module init procedure was not started! Nothing to cancel!");
efiPrintf("The Bluetooth module init procedure was not started! Nothing to cancel!");
return;
}
@ -290,7 +287,7 @@ void bluetoothCancel() {
chThdTerminate(btThread);
btProcessIsStarted = false;
scheduleMsg(&btLogger, "The Bluetooth module init procedure is cancelled!");
efiPrintf("The Bluetooth module init procedure is cancelled!");
}
#endif /* EFI_BLUETOOTH_SETUP */

View File

@ -53,8 +53,6 @@
#include "gpio/tle8888.h"
#endif
LoggingWithStorage engineLogger("engine");
EXTERN_ENGINE;
#if EFI_ENGINE_SNIFFER
@ -181,7 +179,7 @@ static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
if (newValue != engine->isCylinderCleanupMode) {
engine->isCylinderCleanupMode = newValue;
scheduleMsg(&engineLogger, "isCylinderCleanupMode %s", boolToString(newValue));
efiPrintf("isCylinderCleanupMode %s", boolToString(newValue));
}
#endif
}
@ -259,7 +257,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
static bool isHappyTest = false;
if (!isHappyTest) {
setTriggerEmulatorRPM(5 * HW_CHECK_RPM);
scheduleMsg(&engineLogger, "TEST PASSED");
efiPrintf("TEST PASSED");
isHappyTest = true;
}
}
@ -392,7 +390,7 @@ void Engine::OnTriggerStateDecodingError() {
triggerCentral.triggerState.totalTriggerErrorCounter++;
if (CONFIG(verboseTriggerSynchDetails) || (triggerCentral.triggerState.someSortOfTriggerError && !CONFIG(silentTriggerError))) {
#if EFI_PROD_CODE
scheduleMsg(&engineLogger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
efiPrintf("error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
triggerCentral.triggerState.currentCycle.current_index,
TRIGGER_WAVEFORM(expectedEventCount[0]),
TRIGGER_WAVEFORM(expectedEventCount[1]),
@ -476,7 +474,7 @@ void Engine::setConfig(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void Engine::printKnockState(void) {
scheduleMsg(&engineLogger, "knock now=%s/ever=%s", boolToString(knockNow), boolToString(knockEver));
efiPrintf("knock now=%s/ever=%s", boolToString(knockNow), boolToString(knockEver));
}
void Engine::knockLogic(float knockVolts DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -532,8 +530,8 @@ void Engine::watchdog() {
isSpinning = false;
ignitionEvents.isReady = false;
#if EFI_PROD_CODE || EFI_SIMULATOR
scheduleMsg(&engineLogger, "engine has STOPPED");
scheduleMsg(&engineLogger, "templog engine has STOPPED %f", secondsSinceTriggerEvent);
efiPrintf("engine has STOPPED");
efiPrintf("templog engine has STOPPED %f", secondsSinceTriggerEvent);
triggerInfo();
#endif
@ -558,7 +556,7 @@ void Engine::checkShutdown(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if ((Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) > vBattThresholdOn) && !isInShutdownMode(PASS_ENGINE_PARAMETER_SIGNATURE)) {
ignitionOnTimeNt = getTimeNowNt();
stopEngineRequestTimeNt = 0;
scheduleMsg(&engineLogger, "Ignition voltage detected! Cancel the engine shutdown!");
efiPrintf("Ignition voltage detected! Cancel the engine shutdown!");
}
}
#endif /* EFI_MAIN_RELAY_CONTROL */
@ -671,7 +669,7 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
scheduleMsg(&engineLogger, "Starting doScheduleStopEngine");
efiPrintf("Starting doScheduleStopEngine");
engine->stopEngineRequestTimeNt = getTimeNowNt();
engine->ignitionOnTimeNt = 0;
// let's close injectors or else if these happen to be open right now

View File

@ -32,9 +32,6 @@
EXTERN_ENGINE;
// this does not look exactly right
extern LoggingWithStorage engineLogger;
WarningCodeState::WarningCodeState() {
clear();
}
@ -69,7 +66,7 @@ MockAdcState::MockAdcState() {
#if EFI_ENABLE_MOCK_ADC
void MockAdcState::setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds");
scheduleMsg(&engineLogger, "fake voltage: channel %d value %.2f", hwChannel, voltage);
efiPrintf("fake voltage: channel %d value %.2f", hwChannel, voltage);
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
hasMockAdc[hwChannel] = true;
@ -214,10 +211,10 @@ void StartupFuelPumping::setPumpsCounter(int newValue) {
pumpsCounter = newValue;
if (pumpsCounter == PUMPS_TO_PRIME) {
scheduleMsg(&engineLogger, "let's squirt prime pulse %.2f", pumpsCounter);
efiPrintf("let's squirt prime pulse %.2f", pumpsCounter);
pumpsCounter = 0;
} else {
scheduleMsg(&engineLogger, "setPumpsCounter %d", pumpsCounter);
efiPrintf("setPumpsCounter %d", pumpsCounter);
}
}
}

View File

@ -159,8 +159,6 @@ void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
}
extern LoggingWithStorage sharedLogger;
static void wipeString(char *string, int size) {
// we have to reset bytes after \0 symbol in order to calculate correct tune CRC from MSQ file
for (int i = strlen(string) + 1; i < size; i++) {
@ -194,7 +192,7 @@ void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ENGINE(globalConfigurationVersion++);
#if EFI_DEFAILED_LOGGING
scheduleMsg(&sharedLogger, "set globalConfigurationVersion=%d", globalConfigurationVersion);
efiPrintf("set globalConfigurationVersion=%d", globalConfigurationVersion);
#endif /* EFI_DEFAILED_LOGGING */
/**
* All these callbacks could be implemented as listeners, but these days I am saving RAM

View File

@ -43,27 +43,20 @@ void resetMaxValues() {
#endif /* EFI_PROD_CODE */
}
extern LoggingWithStorage sharedLogger;
void printRuntimeStats(void) {
Logging *logger = &sharedLogger;
scheduleMsg(logger, "maxSchedulingPrecisionLoss=%d", maxSchedulingPrecisionLoss);
efiPrintf("maxSchedulingPrecisionLoss=%d", maxSchedulingPrecisionLoss);
#if EFI_CLOCK_LOCKS
scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint);
efiPrintf("maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint);
scheduleMsg(logger, "perSecondIrqDuration=%d ticks / perSecondIrqCounter=%d", perSecondIrqDuration, perSecondIrqCounter);
scheduleMsg(logger, "IRQ CPU utilization %f%%", perSecondIrqDuration / (float)CORE_CLOCK * 100);
efiPrintf("perSecondIrqDuration=%d ticks / perSecondIrqCounter=%d", perSecondIrqDuration, perSecondIrqCounter);
efiPrintf("IRQ CPU utilization %f%%", perSecondIrqDuration / (float)CORE_CLOCK * 100);
#endif /* EFI_CLOCK_LOCKS */
scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration);
efiPrintf("maxEventCallbackDuration=%d", maxEventCallbackDuration);
#if EFI_HIP_9011
scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount);
efiPrintf("hipLastExecutionCount=%d", hipLastExecutionCount);
#endif /* EFI_HIP_9011 */
}

View File

@ -16,8 +16,6 @@ static critical_msg_t criticalErrorMessageBuffer;
#include "lcd_HD44780.h"
#endif /* EFI_HD44780_LCD */
static LoggingWithStorage logger("error handling");
EXTERN_ENGINE;
extern int warningEnabled;
@ -121,7 +119,7 @@ bool warning(obd_code_e code, const char *fmt, ...) {
#endif /* EFI_TUNER_STUDIO */
}
scheduleMsg(&logger, "WARNING: %s", warningBuffer);
efiPrintf("WARNING: %s", warningBuffer);
#else
// todo: we need access to 'engine' here so that we can migrate to real 'engine->engineState.warnings'
unitTestWarningCodeState.addWarningCode(code);

View File

@ -709,7 +709,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
* UNUSED_SIZE constants.
*/
#ifndef RAM_UNUSED_SIZE
#define RAM_UNUSED_SIZE 2000
#define RAM_UNUSED_SIZE 3000
#endif
#ifndef CCM_UNUSED_SIZE
#define CCM_UNUSED_SIZE 2000

View File

@ -12,7 +12,6 @@
EXTERN_ENGINE;
extern LoggingWithStorage sharedLogger;
extern ButtonDebounce startStopButtonDebounce;
#if ENABLE_PERF_TRACE
@ -135,12 +134,12 @@ static void onStartStopButtonToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
bool wasStarterEngaged = enginePins.starterControl.getAndSet(1);
if (!wasStarterEngaged) {
engine->startStopStateLastPushTime = getTimeNowNt();
scheduleMsg(&sharedLogger, "Let's crank this engine for up to %d seconds via %s!",
efiPrintf("Let's crank this engine for up to %d seconds via %s!",
CONFIG(startCrankingDuration),
hwPortname(CONFIG(starterControlPin)));
}
} else if (engine->rpmCalculator.isRunning()) {
scheduleMsg(&sharedLogger, "Let's stop this engine!");
efiPrintf("Let's stop this engine!");
doScheduleStopEngine(PASS_ENGINE_PARAMETER_SIGNATURE);
}
}
@ -165,7 +164,7 @@ void slowStartStopButtonCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// turn starter off once engine is running
bool wasStarterEngaged = enginePins.starterControl.getAndSet(0);
if (wasStarterEngaged) {
scheduleMsg(&sharedLogger, "Engine runs we can disengage the starter");
efiPrintf("Engine runs we can disengage the starter");
engine->startStopStateLastPushTime = 0;
}
}
@ -173,7 +172,7 @@ void slowStartStopButtonCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (getTimeNowNt() - engine->startStopStateLastPushTime > NT_PER_SECOND * CONFIG(startCrankingDuration)) {
bool wasStarterEngaged = enginePins.starterControl.getAndSet(0);
if (wasStarterEngaged) {
scheduleMsg(&sharedLogger, "Cranking timeout %d seconds", CONFIG(startCrankingDuration));
efiPrintf("Cranking timeout %d seconds", CONFIG(startCrankingDuration));
engine->startStopStateLastPushTime = 0;
}
}

View File

@ -21,8 +21,6 @@
EXTERN_ENGINE;
static LoggingWithStorage logger("AUX Serial RX");
uint8_t ser_buffer[SERBUFFLEN] = {};
size_t innovate_msg_len = 1;
innovate_serial_id_state_t innovate_serial_id_state = UNKNOWN;

View File

@ -58,12 +58,6 @@ int waveChartUsedSize;
//#define DEBUG_WAVE 1
#if DEBUG_WAVE
static LoggingWithStorage debugLogging("debug");
#endif /* DEBUG_WAVE */
static LoggingWithStorage logger("wave info");
/**
* We want to skip some engine cycles to skip what was scheduled before parameters were changed
*/
@ -87,7 +81,7 @@ void WaveChart::init() {
void WaveChart::reset() {
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
efiPrintf("reset while at ", counter);
#endif /* DEBUG_WAVE */
logging.reset();
counter = 0;
@ -121,8 +115,8 @@ int WaveChart::getSize() {
#if ! EFI_UNIT_TEST
static void printStatus(void) {
scheduleMsg(&logger, "engine chart: %s", boolToString(engineConfiguration->isEngineChartEnabled));
scheduleMsg(&logger, "engine chart size=%d", engineConfiguration->engineChartSize);
efiPrintf("engine chart: %s", boolToString(engineConfiguration->isEngineChartEnabled));
efiPrintf("engine chart size=%d", engineConfiguration->engineChartSize);
}
static void setChartActive(int value) {
@ -154,7 +148,7 @@ void WaveChart::publish() {
waveChartUsedSize = logging.loggingSize();
#if DEBUG_WAVE
Logging *l = &chart->logging;
scheduleSimpleMsg(&debugLogging, "IT'S TIME", strlen(l->buffer));
efiPrintf("IT'S TIME", strlen(l->buffer));
#endif
if (ENGINE(isEngineChartEnabled)) {
scheduleLogging(&logging);
@ -192,7 +186,7 @@ void WaveChart::addEvent3(const char *name, const char * msg) {
efiAssertVoid(CUSTOM_ERR_6653, isInitialized, "chart not initialized");
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "current", chart->counter);
efiPrintf("current", chart->counter);
#endif /* DEBUG_WAVE */
if (isFull()) {
return;

View File

@ -96,7 +96,6 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig, adcsample_t *buf, size_t buf_
#endif /* ADC_FAST_DEVICE */
static uint32_t slowAdcCounter = 0;
static LoggingWithStorage logger("ADC");
// todo: move this flag to Engine god object
static int adcDebugReporting = false;
@ -318,7 +317,7 @@ adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) const {
static void printAdcValue(int channel) {
int value = getAdcValue("print", (adc_channel_e)channel);
float volts = adcToVoltsDivided(value);
scheduleMsg(&logger, "adc voltage : %.2f", volts);
efiPrintf("adc voltage : %.2f", volts);
}
static uint32_t slowAdcConversionCount = 0;
@ -326,7 +325,7 @@ static uint32_t slowAdcErrorsCount = 0;
static void printFullAdcReport(Logging *logger) {
#if EFI_USE_FAST_ADC
scheduleMsg(logger, "fast %d slow %d", fastAdc.conversionCount, slowAdcConversionCount);
efiPrintf("fast %d slow %d", fastAdc.conversionCount, slowAdcConversionCount);
for (int index = 0; index < fastAdc.size(); index++) {
appendMsgPrefix(logger);
@ -372,7 +371,7 @@ static void printFullAdcReport(Logging *logger) {
static void setAdcDebugReporting(int value) {
adcDebugReporting = value;
scheduleMsg(&logger, "adcDebug=%d", adcDebugReporting);
efiPrintf("adcDebug=%d", adcDebugReporting);
}
void waitForSlowAdc(uint32_t lastAdcCounter) {
@ -516,7 +515,7 @@ static void configureInputs(void) {
static SlowAdcController slowAdcController;
void initAdcInputs() {
scheduleMsg(&logger, "initAdcInputs()");
efiPrintf("initAdcInputs()");
configureInputs();
@ -538,7 +537,7 @@ void initAdcInputs() {
addConsoleActionI("adc", (VoidInt) printAdcValue);
#else
scheduleMsg(&logger, "ADC disabled");
efiPrintf("ADC disabled");
#endif
}

View File

@ -16,7 +16,6 @@
#include "engine_configuration.h"
EXTERN_CONFIG
extern LoggingWithStorage sharedLogger;
extern int canWriteOk;
extern int canWriteNotOk;
@ -58,7 +57,7 @@ CanTxMessage::~CanTxMessage() {
}
if (CONFIG(debugMode) == DBG_CAN) {
scheduleMsg(&sharedLogger, "Sending CAN message: SID %x/%x %x %x %x %x %x %x %x %x", CAN_SID(m_frame), m_frame.DLC,
efiPrintf("Sending CAN message: SID %x/%x %x %x %x %x %x %x %x %x", CAN_SID(m_frame), m_frame.DLC,
m_frame.data8[0], m_frame.data8[1],
m_frame.data8[2], m_frame.data8[3],
m_frame.data8[4], m_frame.data8[5],

View File

@ -23,19 +23,18 @@ EXTERN_ENGINE;
static bool isSerialEnabled = false;
static bool isSerialTXEnabled = false;
static bool isSerialRXEnabled = false;
static LoggingWithStorage logger("SERIAL driver");
static SerialConfig uartCfg;
static SerialRead serialRead;
static void auxInfo(void) {
if (!isSerialEnabled) {
scheduleMsg(&logger, "AUX Serial is not enabled, please enable & restart");
efiPrintf("AUX Serial is not enabled, please enable & restart");
return;
}
scheduleMsg(&logger, "AUX Serial TX %s", hwPortname(CONFIG(auxSerialTxPin)));
scheduleMsg(&logger, "AUX Serial RX %s", hwPortname(CONFIG(auxSerialRxPin)));
efiPrintf("AUX Serial TX %s", hwPortname(CONFIG(auxSerialTxPin)));
efiPrintf("AUX Serial RX %s", hwPortname(CONFIG(auxSerialRxPin)));
}
void enableAuxSerial(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
@ -46,7 +45,7 @@ void enableAuxSerial(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
uartCfg.speed = engineConfiguration->auxSerialSpeed;
sdStart(AUX_SERIAL_DEVICE, &uartCfg);
scheduleMsg(&logger, "AUX Serial started");
efiPrintf("AUX Serial started");
}
void stopAuxSerialPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -29,8 +29,6 @@ EXTERN_ENGINE;
#include "main_trigger_callback.h"
#endif /* EFI_ENGINE_CONTROL */
static LoggingWithStorage logger("io_pins");
bool efiReadPin(brain_pin_e pin) {
if (!isBrainPinValid(pin))
return false;

View File

@ -92,8 +92,6 @@ static MMCConfig mmccfg = { NULL, &mmc_ls_spicfg, &mmc_hs_spicfg };
*/
static NO_CACHE FATFS MMC_FS;
static LoggingWithStorage logger("mmcCard");
static int fatFsErrors = 0;
static void mmcUnMount(void);
@ -109,7 +107,7 @@ static void printError(const char *str, FRESULT f_error) {
return;
}
scheduleMsg(&logger, "FATfs Error \"%s\" %d", str, f_error);
efiPrintf("FATfs Error \"%s\" %d", str, f_error);
}
static FIL FDLogFile NO_CACHE;
@ -121,20 +119,20 @@ static int logFileIndex = MIN_FILE_INDEX;
static char logName[_MAX_FILLER + 20];
static void printMmcPinout(void) {
scheduleMsg(&logger, "MMC CS %s", hwPortname(CONFIG(sdCardCsPin)));
efiPrintf("MMC CS %s", hwPortname(CONFIG(sdCardCsPin)));
// todo: we need to figure out the right SPI pinout, not just SPI2
// scheduleMsg(&logger, "MMC SCK %s:%d", portname(EFI_SPI2_SCK_PORT), EFI_SPI2_SCK_PIN);
// scheduleMsg(&logger, "MMC MISO %s:%d", portname(EFI_SPI2_MISO_PORT), EFI_SPI2_MISO_PIN);
// scheduleMsg(&logger, "MMC MOSI %s:%d", portname(EFI_SPI2_MOSI_PORT), EFI_SPI2_MOSI_PIN);
// efiPrintf("MMC SCK %s:%d", portname(EFI_SPI2_SCK_PORT), EFI_SPI2_SCK_PIN);
// efiPrintf("MMC MISO %s:%d", portname(EFI_SPI2_MISO_PORT), EFI_SPI2_MISO_PIN);
// efiPrintf("MMC MOSI %s:%d", portname(EFI_SPI2_MOSI_PORT), EFI_SPI2_MOSI_PIN);
}
static void sdStatistics(void) {
printMmcPinout();
scheduleMsg(&logger, "SD enabled=%s status=%s", boolToString(CONFIG(isSdCardEnabled)),
efiPrintf("SD enabled=%s status=%s", boolToString(CONFIG(isSdCardEnabled)),
sdStatus);
printSpiConfig(&logger, "SD", mmcSpiDevice);
printSpiConfig(nullptr, "SD", mmcSpiDevice);
if (isSdCardAlive()) {
scheduleMsg(&logger, "filename=%s size=%d", logName, totalLoggedBytes);
efiPrintf("filename=%s size=%d", logName, totalLoggedBytes);
}
}
@ -146,11 +144,11 @@ static void incLogFileName(void) {
UINT result = 0;
if (err != FR_OK && err != FR_EXIST) {
logFileIndex = MIN_FILE_INDEX;
scheduleMsg(&logger, "%s: not found or error: %d", LOG_INDEX_FILENAME, err);
efiPrintf("%s: not found or error: %d", LOG_INDEX_FILENAME, err);
} else {
f_read(&FDCurrFile, (void*)data, sizeof(data), &result);
scheduleMsg(&logger, "Got content [%s] size %d", data, result);
efiPrintf("Got content [%s] size %d", data, result);
f_close(&FDCurrFile);
if (result < 5) {
data[result] = 0;
@ -169,7 +167,7 @@ static void incLogFileName(void) {
itoa10(data, logFileIndex);
f_write(&FDCurrFile, (void*)data, strlen(data), &result);
f_close(&FDCurrFile);
scheduleMsg(&logger, "Done %d", logFileIndex);
efiPrintf("Done %d", logFileIndex);
}
static void prepareLogFileName(void) {
@ -223,7 +221,7 @@ static void createLogFile(void) {
static void removeFile(const char *pathx) {
if (!isSdCardAlive()) {
scheduleMsg(&logger, "Error: No File system is mounted");
efiPrintf("Error: No File system is mounted");
return;
}
@ -249,7 +247,7 @@ int mystrncasecmp(const char *s1, const char *s2, size_t n) {
static void listDirectory(const char *path) {
if (!isSdCardAlive()) {
scheduleMsg(&logger, "Error: No File system is mounted");
efiPrintf("Error: No File system is mounted");
return;
}
@ -257,11 +255,11 @@ static void listDirectory(const char *path) {
FRESULT res = f_opendir(&dir, path);
if (res != FR_OK) {
scheduleMsg(&logger, "Error opening directory %s", path);
efiPrintf("Error opening directory %s", path);
return;
}
scheduleMsg(&logger, LS_RESPONSE);
efiPrintf(LS_RESPONSE);
for (int count = 0;count < FILE_LIST_MAX_COUNT;) {
FILINFO fno;
@ -276,10 +274,10 @@ static void listDirectory(const char *path) {
if ((fno.fattrib & AM_DIR) || mystrncasecmp(RUSEFI_LOG_PREFIX, fno.fname, sizeof(RUSEFI_LOG_PREFIX) - 1)) {
continue;
}
scheduleMsg(&logger, "logfile%lu:%s", fno.fsize, fno.fname);
efiPrintf("logfile%lu:%s", fno.fsize, fno.fname);
count++;
// scheduleMsg(&logger, "%c%c%c%c%c %u/%02u/%02u %02u:%02u %9lu %-12s", (fno.fattrib & AM_DIR) ? 'D' : '-',
// efiPrintf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9lu %-12s", (fno.fattrib & AM_DIR) ? 'D' : '-',
// (fno.fattrib & AM_RDO) ? 'R' : '-', (fno.fattrib & AM_HID) ? 'H' : '-',
// (fno.fattrib & AM_SYS) ? 'S' : '-', (fno.fattrib & AM_ARC) ? 'A' : '-', (fno.fdate >> 9) + 1980,
// (fno.fdate >> 5) & 15, fno.fdate & 31, (fno.ftime >> 11), (fno.ftime >> 5) & 63, fno.fsize,
@ -292,7 +290,7 @@ static void listDirectory(const char *path) {
*/
static void mmcUnMount(void) {
if (!isSdCardAlive()) {
scheduleMsg(&logger, "Error: No File system is mounted. \"mountsd\" first");
efiPrintf("Error: No File system is mounted. \"mountsd\" first");
return;
}
f_close(&FDLogFile); // close file
@ -310,7 +308,7 @@ static void mmcUnMount(void) {
f_mount(NULL, 0, 0); // FATFS: Unregister work area prior to discard it
memset(&FDLogFile, 0, sizeof(FIL)); // clear FDLogFile
setSdCardReady(false); // status = false
scheduleMsg(&logger, "MMC/SD card removed");
efiPrintf("MMC/SD card removed");
}
#if HAL_USE_USB_MSD
@ -425,7 +423,7 @@ static bool mountMmc() {
incLogFileName();
createLogFile();
fileCreatedCounter++;
scheduleMsg(&logger, "MMC/SD mounted!");
efiPrintf("MMC/SD mounted!");
return true;
} else {
sdStatus = SD_STATE_MOUNT_FAILED;

View File

@ -66,8 +66,6 @@ static FILE *uploading;
static FIL uploading NO_CACHE;
#endif // EFI_FILE_LOGGING
extern LoggingWithStorage sharedLogger;
#define TRANSFER_SIZE 2048
static uint8_t buffer[TRANSFER_SIZE + 2];
@ -101,13 +99,13 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
const uint16_t *data16 = reinterpret_cast<uint16_t*>(input);
if (input[0] == 0 && input[1] == TS_SD_PROTOCOL_RTC) {
scheduleMsg(&sharedLogger, "TS_SD: RTC read command");
efiPrintf("TS_SD: RTC read command");
memset(buffer, 0, 9);
tsChannel->sendResponse(TS_CRC, buffer, 9);
} else if (input[0] == 0 && input[1] == TS_SD_PROTOCOL_FETCH_INFO) {
uint16_t length = SWAP_UINT16(data16[2]);
scheduleMsg(&sharedLogger, "TS_SD: fetch buffer command, length=%d",
efiPrintf("TS_SD: fetch buffer command, length=%d",
length);
if (length == 16) {
@ -167,7 +165,7 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
DIR dir;
FRESULT res = f_opendir(&dir, ROOT_DIR);
if (res != FR_OK) {
scheduleMsg(&sharedLogger, "Error opening directory");
efiPrintf("Error opening directory");
} else {
int index = 0;
while (true) {
@ -210,7 +208,7 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
}
} else if (input[0] == 0 && input[1] == TS_SD_PROTOCOL_FETCH_DATA) {
uint16_t blockNumber = SWAP_UINT16(data16[1]);
scheduleMsg(&sharedLogger, "TS_SD: fetch data command blockNumber=%d",
efiPrintf("TS_SD: fetch data command blockNumber=%d",
blockNumber);
// int offset = blockNumber * TRANSFER_SIZE;
@ -230,7 +228,7 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
tsChannel->sendResponse(TS_CRC, buffer, 2 + got);
} else {
scheduleMsg(&sharedLogger, "TS_SD: unexpected r");
efiPrintf("TS_SD: unexpected r");
}
}
@ -243,13 +241,13 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
if (input[0] == 0 && input[1] == TS_SD_PROTOCOL_FETCH_INFO) {
int code = data16[2];
scheduleMsg(&sharedLogger, "TS_SD: w, code=%d", code);
efiPrintf("TS_SD: w, code=%d", code);
if (input[5] == TS_SD_PROTOCOL_DO) {
scheduleMsg(&sharedLogger, "TS_SD_PROTOCOL_DO");
efiPrintf("TS_SD_PROTOCOL_DO");
sendOkResponse(tsChannel, TS_CRC);
} else if (input[5] == TS_SD_PROTOCOL_READ_DIR) {
scheduleMsg(&sharedLogger, "TS_SD_PROTOCOL_READ_DIR");
efiPrintf("TS_SD_PROTOCOL_READ_DIR");
sendOkResponse(tsChannel, TS_CRC);
} else if (input[5] == TS_SD_PROTOCOL_REMOVE_FILE) {
#if EFI_SIMULATOR
@ -279,7 +277,7 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
DIR dir;
FRESULT res = f_opendir(&dir, ROOT_DIR);
if (res != FR_OK) {
scheduleMsg(&sharedLogger, "Error opening directory");
efiPrintf("Error opening directory");
} else {
while (true) {
FILINFO fno;
@ -291,7 +289,7 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
if (isLogFile(fileName)) {
int dotIndex = indexOf(fileName, DOT);
if (0 == strncmp(input + 6, &fileName[dotIndex - 4], 4)) {
scheduleMsg(&sharedLogger, "Removing %s", fileName);
efiPrintf("Removing %s", fileName);
f_unlink(fileName);
break;
}
@ -337,7 +335,7 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
FRESULT res = f_opendir(&dir, ROOT_DIR);
if (res != FR_OK) {
scheduleMsg(&sharedLogger, "Error opening directory");
efiPrintf("Error opening directory");
} else {
memset(&uploading, 0, sizeof(FIL)); // clear the memory
while (true) {
@ -364,7 +362,7 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
}
} else {
scheduleMsg(&sharedLogger, "TS_SD: unexpected w");
efiPrintf("TS_SD: unexpected w");
}
}

View File

@ -26,8 +26,6 @@
#include "rtc_helper.h"
#include "engine.h"
static LoggingWithStorage logging("uart gps");
static SerialConfig GPSserialConfig = { GPS_SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
static THD_WORKING_AREA(gpsThreadStack, UTILITY_THREAD_STACK_SIZE);
@ -46,13 +44,13 @@ float getCurrentSpeed(void) {
EXTERN_ENGINE;
static void printGpsInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
scheduleMsg(&logging, "GPS RX %s", hwPortname(CONFIG(gps_rx_pin)));
scheduleMsg(&logging, "GPS TX %s", hwPortname(CONFIG(gps_tx_pin)));
efiPrintf("GPS RX %s", hwPortname(CONFIG(gps_rx_pin)));
efiPrintf("GPS TX %s", hwPortname(CONFIG(gps_tx_pin)));
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f", gpsMesagesCount, uartErrors, getCurrentSpeed());
efiPrintf("m=%d,e=%d: vehicle speed = %.2f", gpsMesagesCount, uartErrors, getCurrentSpeed());
float sec = currentTimeMillis() / 1000.0;
scheduleMsg(&logging, "communication speed: %.2f", gpsMesagesCount / sec);
efiPrintf("communication speed: %.2f", gpsMesagesCount / sec);
print("GPS latitude = %.2f\r\n", GPSdata.latitude);
print("GPS longitude = %.2f\r\n", GPSdata.longitude);

View File

@ -33,8 +33,6 @@ bool isBrainPinValid(brain_pin_e brainPin)
#include "smart_gpio.h"
#include "hardware.h"
static LoggingWithStorage logger("pin repos");
EXTERN_CONFIG;
static PinRepository pinRepository;
@ -77,14 +75,14 @@ void tle8888_dump_regs(void)
// since responses are always in the NEXT transmission we will have this one first
tle8888_read_reg(0, NULL);
scheduleMsg(&logger, "register: data");
efiPrintf("register: data");
for (int request = 0; request <= 0x7e + 1; request++) {
uint16_t tmp;
tle8888_read_reg(request < (0x7e + 1) ? request : 0x7e, &tmp);
uint8_t reg = getRegisterFromResponse(tmp);
uint8_t data = getDataFromResponse(tmp);
scheduleMsg(&logger, "%02x: %02x", reg, data);
efiPrintf("%02x: %02x", reg, data);
}
}
#endif
@ -99,7 +97,7 @@ static void reportPins(void) {
int pin = getBrainPinIndex(brainPin);
ioportid_t port = getBrainPinPort(brainPin);
scheduleMsg(&logger, "pin %s%d: %s", portname(port), pin, pin_user);
efiPrintf("pin %s%d: %s", portname(port), pin, pin_user);
}
}
@ -132,20 +130,20 @@ static void reportPins(void) {
/* here show all pins, unused too */
if (pin_name != NULL) {
// this probably uses a lot of output buffer!
scheduleMsg(&logger, "ext %s: %s diagnostic: %s",
efiPrintf("ext %s: %s diagnostic: %s",
pin_name, pin_user ? pin_user : "free", pin_error);
} else {
const char *chip_name = gpiochips_getChipName(brainPin);
/* if chip exist */
if (chip_name != NULL) {
scheduleMsg(&logger, "ext %s.%d: %s diagnostic: %s",
efiPrintf("ext %s.%d: %s diagnostic: %s",
chip_name, gpiochips_getPinOffset(brainPin), pin_user ? pin_user : "free", pin_error);
}
}
}
#endif
scheduleMsg(&logger, "Total pins count: %d", pinRepository.totalPinsUsed);
efiPrintf("Total pins count: %d", pinRepository.totalPinsUsed);
}
void printSpiConfig(Logging *logging, const char *msg, spi_device_e device) {
@ -228,7 +226,7 @@ bool brain_pin_is_ext(brain_pin_e brainPin)
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg) {
#if ! EFI_BOOTLOADER
scheduleMsg(&logger, "%s on %s", msg, hwPortname(brainPin));
efiPrintf("%s on %s", msg, hwPortname(brainPin));
#endif
int index = brainPin_to_index(brainPin);

View File

@ -14,7 +14,6 @@
#include "rtc_helper.h"
#if EFI_RTC
static LoggingWithStorage logger("RTC");
static RTCDateTime timespec;
extern bool rtcWorks;
@ -139,9 +138,9 @@ void printDateTime(void) {
unix_time = GetTimeUnixSec();
if (unix_time == -1) {
scheduleMsg(&logger, "incorrect time in RTC cell");
efiPrintf("incorrect time in RTC cell");
} else {
scheduleMsg(&logger, "%D - unix time", unix_time);
efiPrintf("%D - unix time", unix_time);
date_get_tm(&timp);
scheduleMsg(nullptr, "Current RTC localtime is: %04u-%02u-%02u %02u:%02u:%02u w=%d", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour,
@ -158,13 +157,13 @@ void setDateTime(const char *strDate) {
return;
}
}
scheduleMsg(&logger, "date_set Date parameter %s is wrong", strDate);
efiPrintf("date_set Date parameter %s is wrong", strDate);
}
#endif /* EFI_RTC */
void initRtc(void) {
#if EFI_RTC
GetTimeUnixSec(); // this would test RTC, see 'rtcWorks' variable, see #311
scheduleMsg(&logger, "initRtc()");
efiPrintf("initRtc()");
#endif /* EFI_RTC */
}