Logging remove 3 (#2568)

* ts logger

* sensors

* wideband too

* missed one

* init

* motors, pid, etc

* vvt

* more

* idle

* missed one

* dynoview

* launch

* can

* console IO

* s

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-04-20 11:09:41 -07:00 committed by GitHub
parent 221f2a0f27
commit bd1c84fa62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 77 additions and 132 deletions

View File

@ -62,9 +62,6 @@ void onDataArrived(void) {
CommandHandler console_line_callback;
static Logging *logger;
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) {
logger = sharedLogger;
void startConsole(CommandHandler console_line_callback_p) {
console_line_callback = console_line_callback_p;
}

View File

@ -18,9 +18,7 @@ extern "C"
typedef void (*CommandHandler)(char *);
#include "efifeatures.h"
#include "datalogging.h"
void consoleOutputBuffer(const uint8_t *buf, int size);
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p);
void startConsole(CommandHandler console_line_callback_p);
void onDataArrived(void);

View File

@ -170,10 +170,10 @@ static void cmd_threads(void) {
#endif
}
void initializeConsole(Logging *sharedLogger) {
initConsoleLogic(sharedLogger);
void initializeConsole() {
initConsoleLogic();
startConsole(sharedLogger, &handleConsoleLine);
startConsole(&handleConsoleLine);
sayHello();
addConsoleAction("test", [](){ /* do nothing */});

View File

@ -7,7 +7,6 @@
*/
#pragma once
#include "datalogging.h"
void initializeConsole(Logging *sharedLogger);
void initializeConsole();
void startUsbConsole();

View File

@ -28,8 +28,6 @@ StepperMotor iacMotor;
EXTERN_ENGINE;
static Logging* logger;
/**
* When the IAC position value change is insignificant (lower than this threshold), leave the poor valve alone
* todo: why do we have this logic? is this ever useful?
@ -109,9 +107,7 @@ bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return iacMotor.isBusy();
}
void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIG(useStepperIdle)) {
StepperHw* hw;
@ -141,7 +137,7 @@ void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
hw = &iacStepperHw;
}
iacMotor.initialize(hw, CONFIG(idleStepperTotalSteps), logger);
iacMotor.initialize(hw, CONFIG(idleStepperTotalSteps));
// This greatly improves PID accuracy for steppers with a small number of steps
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;

View File

@ -11,7 +11,6 @@
#include "engine.h"
class Logging;
void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool isIdleHardwareRestartNeeded();
bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -46,8 +46,6 @@
#include "stepper.h"
#endif
static Logging *logger;
EXTERN_ENGINE;
// todo: move all static vars to engine->engineState.idle?
@ -127,42 +125,42 @@ static iacPidMultiplier_t iacPidMultMap("iacPidMultiplier");
#if ! EFI_UNIT_TEST
void idleDebug(const char *msg, percent_t value) {
scheduleMsg(logger, "idle debug: %s%.2f", msg, value);
efiPrintf("idle debug: %s%.2f", msg, value);
}
static void showIdleInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
const char * idleModeStr = getIdle_mode_e(engineConfiguration->idleMode);
scheduleMsg(logger, "useStepperIdle=%s useHbridges=%s",
efiPrintf("useStepperIdle=%s useHbridges=%s",
boolToString(CONFIG(useStepperIdle)), boolToString(CONFIG(useHbridges)));
scheduleMsg(logger, "idleMode=%s position=%.2f",
efiPrintf("idleMode=%s position=%.2f",
idleModeStr, getIdlePosition());
if (CONFIG(useStepperIdle)) {
if (CONFIG(useHbridges)) {
scheduleMsg(logger, "Coil A:");
scheduleMsg(logger, " pin1=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin1)));
scheduleMsg(logger, " pin2=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin2)));
efiPrintf("Coil A:");
efiPrintf(" pin1=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin1)));
efiPrintf(" pin2=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin2)));
showDcMotorInfo(2);
scheduleMsg(logger, "Coil B:");
scheduleMsg(logger, " pin1=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin1)));
scheduleMsg(logger, " pin2=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin2)));
efiPrintf("Coil B:");
efiPrintf(" pin1=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin1)));
efiPrintf(" pin2=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin2)));
showDcMotorInfo(3);
} else {
scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
efiPrintf("directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
engineConfiguration->idleStepperReactionTime);
scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
efiPrintf("stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
engineConfiguration->idleStepperTotalSteps);
scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
efiPrintf("enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
engineConfiguration->stepperEnablePinMode);
}
} else {
if (!CONFIG(isDoubleSolenoidIdle)) {
scheduleMsg(logger, "idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,
efiPrintf("idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,
hwPortname(CONFIG(idle).solenoidPin));
} else {
scheduleMsg(logger, "idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,
efiPrintf("idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,
hwPortname(CONFIG(idle).solenoidPin));
scheduleMsg(logger, " and %s", hwPortname(CONFIG(secondSolenoidPin)));
efiPrintf(" and %s", hwPortname(CONFIG(secondSolenoidPin)));
}
}
@ -183,7 +181,7 @@ percent_t getIdlePosition() {
void setManualIdleValvePosition(int positionPercent) {
if (positionPercent < 1 || positionPercent > 99)
return;
scheduleMsg(logger, "setting idle valve position %d", positionPercent);
efiPrintf("setting idle valve position %d", positionPercent);
#if ! EFI_UNIT_TEST
showIdleInfo();
#endif /* EFI_UNIT_TEST */
@ -612,7 +610,7 @@ void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfigura
void setTargetIdleRpm(int value) {
setTargetRpmCurve(value PASS_ENGINE_PARAMETER_SUFFIX);
scheduleMsg(logger, "target idle RPM %d", value);
efiPrintf("target idle RPM %d", value);
showIdleInfo();
}
@ -644,14 +642,13 @@ void setIdleDFactor(float value) {
*/
void startIdleBench(void) {
timeToStopIdleTest = getTimeNowUs() + MS2US(3000); // 3 seconds
scheduleMsg(logger, "idle valve bench test");
efiPrintf("idle valve bench test");
showIdleInfo();
}
#endif /* EFI_UNIT_TEST */
void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
void startIdleThread(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
INJECT_ENGINE_REFERENCE(&idleControllerInstance);
idleControllerInstance.init(&CONFIG(idleTimingPid));
INJECT_ENGINE_REFERENCE(&industrialWithOverrideIdlePid);
@ -663,7 +660,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if ! EFI_UNIT_TEST
// todo: we still have to explicitly init all hardware on start in addition to handling configuration change via
// 'applyNewHardwareSettings' todo: maybe unify these two use-cases?
initIdleHardware(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
initIdleHardware(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_UNIT_TEST */
DISPLAY_STATE(Engine)
@ -707,9 +704,6 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
DISPLAY_TEXT(Manual_idle_control);
/* DISPLAY_ENDIF */
//scheduleMsg(logger, "initial idle %d", idlePositionController.value);
#if ! EFI_UNIT_TEST
// this is neutral/no gear switch input. on Miata it's wired both to clutch pedal and neutral in gearbox
// this switch is not used yet

View File

@ -28,8 +28,6 @@ struct IIdleController {
virtual float getOpenLoop(Phase phase, float clt, SensorResult tps) const = 0;
};
class Logging;
class IdleController : public IIdleController {
public:
DECLARE_ENGINE_PTR;
@ -76,7 +74,7 @@ bool isIdling();
void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX);
void setManualIdleValvePosition(int positionPercent);
void startIdleThread(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void startIdleThread(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void startIdleBench(void);
void setIdleOffset(float value);

View File

@ -25,8 +25,6 @@ EXTERN_ENGINE;
static fsio8_Map3D_u8t vvtTable1("vvt#1");
static fsio8_Map3D_u8t vvtTable2("vvt#2");
static Logging *logger;
void VvtController::init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap) {
this->index = index;
m_bank = bankIndex;
@ -71,7 +69,7 @@ expected<percent_t> VvtController::getClosedLoop(angle_t setpoint, angle_t obser
float retVal = m_pid.getOutput(setpoint, observation);
if (engineConfiguration->isVerboseAuxPid1) {
scheduleMsg(logger, "aux duty: %.2f/value=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", retVal, observation,
efiPrintf("aux duty: %.2f/value=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", retVal, observation,
m_pid.getP(), m_pid.getI(), m_pid.getD(), m_pid.getIntegration());
}
@ -130,16 +128,13 @@ void stopVvtControlPins() {
}
}
void initAuxPid(Logging *sharedLogger) {
void initAuxPid() {
vvtTable1.init(config->vvtTable1, config->vvtTable1LoadBins,
config->vvtTable1RpmBins);
vvtTable2.init(config->vvtTable2, config->vvtTable2LoadBins,
config->vvtTable2RpmBins);
logger = sharedLogger;
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
INJECT_ENGINE_REFERENCE(&instances[i]);

View File

@ -13,10 +13,9 @@
#include "pwm_generator_logic.h"
#include "pid.h"
class Logging;
class ValueProvider3D;
void initAuxPid(Logging *sharedLogger);
void initAuxPid();
void startVvtControlPins();
void stopVvtControlPins();

View File

@ -12,8 +12,6 @@
#include "dynoview.h"
#include "vehicle_speed.h"
static Logging *logger;
#if EFI_TUNER_STUDIO
#include "tunerstudio_outputs.h"
extern TunerStudioOutputChannels tsOutputChannels;
@ -173,8 +171,4 @@ void updateDynoViewCan(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
dynoInstance.update(CAN);
}
void initDynoView(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
}
#endif /* EFI_DYNO_VIEW */

View File

@ -9,8 +9,6 @@
#include "engine_ptr.h"
class Logging;
void initDynoView(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void updateDynoView(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void updateDynoViewCan(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getDynoviewAcceleration(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -25,7 +25,6 @@
#include "advance_map.h"
static bool isInit = false;
static Logging *logger;
LaunchControlBase launchInstance;
@ -205,8 +204,7 @@ void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_EN
}
}
void initLaunchControl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
void initLaunchControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
INJECT_ENGINE_REFERENCE(&launchInstance);
isInit = true;

View File

@ -10,8 +10,7 @@
#include "engine_ptr.h"
#include "timer.h"
class Logging;
void initLaunchControl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void initLaunchControl(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
void updateLaunchConditions(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -16,12 +16,11 @@
#define CAN_TIMEOUT MS2NT(100)
class Logging;
class CanListener;
class CanSensorBase;
#if EFI_CAN_SUPPORT
void processCanRxMessage(const CANRxFrame& msg, Logging* logger, efitick_t nowNt);
void processCanRxMessage(const CANRxFrame& msg, efitick_t nowNt);
#endif // EFI_CAN_SUPPORT
void registerCanListener(CanListener& listener);

View File

@ -63,7 +63,7 @@ bool acceptCanRx(int sid DECLARE_ENGINE_PARAMETER_SUFFIX) {
/**
* this build-in CAN sniffer is very basic but that's our CAN sniffer
*/
static void printPacket(const CANRxFrame &rx, Logging *logger) {
static void printPacket(const CANRxFrame &rx) {
bool accept = acceptCanRx(CAN_SID(rx));
if (!accept) {
return;
@ -72,7 +72,7 @@ static void printPacket(const CANRxFrame &rx, Logging *logger) {
// only print info if we're in can debug mode
// internet people use both hex and decimal to discuss packed IDs, for usability it's better to print both right here
scheduleMsg(logger, "CAN_rx %x %d %x, %x %x %x %x %x %x %x %x", CAN_SID(rx),
efiPrintf("CAN_rx %x %d %x, %x %x %x %x %x %x %x %x", CAN_SID(rx),
CAN_SID(rx), rx.DLC, rx.data8[0], rx.data8[1], rx.data8[2], rx.data8[3],
rx.data8[4], rx.data8[5], rx.data8[6], rx.data8[7]);
@ -100,10 +100,9 @@ void registerCanSensor(CanSensorBase& sensor) {
sensor.Register();
}
void processCanRxMessage(const CANRxFrame &frame, Logging *logger,
efitick_t nowNt) {
void processCanRxMessage(const CANRxFrame &frame, efitick_t nowNt) {
if (CONFIG(debugMode) == DBG_CAN) {
printPacket(frame, logger);
printPacket(frame);
}
serviceCanSubscribers(frame, nowNt);

View File

@ -568,7 +568,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
initNewSensors();
#endif /* EFI_UNIT_TEST */
initSensors(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
initSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
initAccelEnrichment(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
@ -579,7 +579,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
initGpPwm(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_IDLE_CONTROL
startIdleThread(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
startIdleThread(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_IDLE_CONTROL */
initButtonShift(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -602,11 +602,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
#endif /* EFI_BOOST_CONTROL */
#if EFI_LAUNCH_CONTROL
initLaunchControl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
#endif
#if EFI_DYNO_VIEW
initDynoView(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
initLaunchControl(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif
#if EFI_SHAFT_POSITION_INPUT
@ -677,7 +673,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
#endif /* EFI_ALTERNATOR_CONTROL */
#if EFI_AUX_PID
initAuxPid(sharedLogger);
initAuxPid();
#endif /* EFI_AUX_PID */
#if EFI_MALFUNCTION_INDICATOR

View File

@ -15,8 +15,8 @@ EXTERN_ENGINE;
ButtonDebounce acDebounce("ac_switch");
void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
initMapDecoder(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
void initSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
initMapDecoder(PASS_ENGINE_PARAMETER_SIGNATURE);
acDebounce.init(15, CONFIG(acSwitch), CONFIG(acSwitchMode));
}

View File

@ -21,7 +21,7 @@
#define LOW_VBATT 7
void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void initSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool hasAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE);

View File

@ -24,8 +24,6 @@
EXTERN_ENGINE;
static Logging *logger;
static FastInterpolation customMap;
static efitick_t prevWidthTimeNt = 0;
@ -240,14 +238,14 @@ extern int mapMinBufferLength;
static void printMAPInfo(void) {
#if EFI_ANALOG_SENSORS
scheduleMsg(logger, "instant value=%.2fkPa", getRawMap());
efiPrintf("instant value=%.2fkPa", getRawMap());
if (engineConfiguration->hasFrequencyReportingMapSensor) {
scheduleMsg(logger, "instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIG(frequencyReportingMapInputPin)));
efiPrintf("instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIG(frequencyReportingMapInputPin)));
} else {
#if EFI_MAP_AVERAGING
scheduleMsg(logger, "map type=%d/%s MAP=%.2fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
efiPrintf("map type=%d/%s MAP=%.2fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
getMap(),
mapMinBufferLength);
@ -256,10 +254,10 @@ static void printMAPInfo(void) {
adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel;
static char pinNameBuffer[16];
scheduleMsg(logger, "MAP %.2fv @%s", getVoltage("mapinfo", mapAdc PASS_ENGINE_PARAMETER_SUFFIX),
efiPrintf("MAP %.2fv @%s", getVoltage("mapinfo", mapAdc PASS_ENGINE_PARAMETER_SUFFIX),
getPinNameByAdcChannel("map", mapAdc, pinNameBuffer));
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
scheduleMsg(logger, "at %.2fv=%.2f at %.2fv=%.2f",
efiPrintf("at %.2fv=%.2f at %.2fv=%.2f",
engineConfiguration->mapLowValueVoltage,
engineConfiguration->map.sensor.lowValue,
engineConfiguration->mapHighValueVoltage,
@ -268,9 +266,9 @@ static void printMAPInfo(void) {
}
if (Sensor::hasSensor(SensorType::BarometricPressure)) {
scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, Sensor::get(SensorType::BarometricPressure).value_or(-1));
efiPrintf("baro type=%d value=%.2f", engineConfiguration->baroSensor.type, Sensor::get(SensorType::BarometricPressure).value_or(-1));
if (engineConfiguration->baroSensor.type == MT_CUSTOM) {
scheduleMsg(logger, "min=%.2f@%.2f max=%.2f@%.2f",
efiPrintf("min=%.2f@%.2f max=%.2f@%.2f",
engineConfiguration->baroSensor.lowValue,
engineConfiguration->mapLowValueVoltage,
engineConfiguration->baroSensor.highValue,
@ -282,8 +280,7 @@ static void printMAPInfo(void) {
#endif /* EFI_PROD_CODE */
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
//engine->configurationListeners.registerCallback(applyConfiguration);
@ -308,13 +305,13 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIG(useFixedBaroCorrFromMap)) {
// Read initial MAP sensor value and store it for Baro correction.
storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE);
scheduleMsg(logger, "Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure);
efiPrintf("Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure);
// validate if it's within a reasonable range (the engine should not be spinning etc.)
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure PASS_ENGINE_PARAMETER_SUFFIX);
if (!cisnan(storedInitialBaroPressure)) {
scheduleMsg(logger, "Using this fixed MAP pressure to override the baro correction!");
efiPrintf("Using this fixed MAP pressure to override the baro correction!");
} else {
scheduleMsg(logger, "The baro pressure is invalid. The fixed baro correction will be disabled!");
efiPrintf("The baro pressure is invalid. The fixed baro correction will be disabled!");
}
}
@ -325,7 +322,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#else /* EFI_ANALOG_SENSORS */
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
#endif /* EFI_ANALOG_SENSORS */

View File

@ -8,10 +8,9 @@
#include "engine_ptr.h"
class Logging;
struct air_pressure_sensor_config_s;
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE);
/**
* @return Raw MAP sensor value right now

View File

@ -32,7 +32,6 @@ static int canReadCounter = 0;
int canWriteOk = 0;
int canWriteNotOk = 0;
static bool isCanEnabled = false;
static LoggingWithStorage logger("CAN driver");
// Values below calculated with http://www.bittiming.can-wiki.info/
// Pick ST micro bxCAN
@ -155,7 +154,7 @@ public:
// Process the message
canReadCounter++;
processCanRxMessage(m_buffer, &logger, getTimeNowNt());
processCanRxMessage(m_buffer, getTimeNowNt());
}
}
@ -168,17 +167,17 @@ static CanWrite canWrite;
static void canInfo(void) {
if (!isCanEnabled) {
scheduleMsg(&logger, "CAN is not enabled, please enable & restart");
efiPrintf("CAN is not enabled, please enable & restart");
return;
}
scheduleMsg(&logger, "CAN TX %s", hwPortname(CONFIG_OVERRIDE(canTxPin)));
scheduleMsg(&logger, "CAN RX %s", hwPortname(CONFIG_OVERRIDE(canRxPin)));
scheduleMsg(&logger, "type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
efiPrintf("CAN TX %s", hwPortname(CONFIG_OVERRIDE(canTxPin)));
efiPrintf("CAN RX %s", hwPortname(CONFIG_OVERRIDE(canRxPin)));
efiPrintf("type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
engineConfiguration->canSleepPeriodMs);
scheduleMsg(&logger, "CAN rx_cnt=%d/tx_ok=%d/tx_not_ok=%d", canReadCounter, canWriteOk, canWriteNotOk);
efiPrintf("CAN rx_cnt=%d/tx_ok=%d/tx_not_ok=%d", canReadCounter, canWriteOk, canWriteNotOk);
}
void setCanType(int type) {

View File

@ -429,7 +429,7 @@ void applyNewHardwareSettings(void) {
#if EFI_IDLE_CONTROL
if (isIdleHardwareRestartNeeded()) {
initIdleHardware(sharedLogger);
initIdleHardware();
}
#endif

View File

@ -20,8 +20,6 @@
EXTERN_ENGINE;
static Logging *logger;
void StepperMotor::saveStepperPos(int pos) {
// use backup-power RTC registers to store the data
#if EFI_PROD_CODE
@ -74,10 +72,10 @@ void StepperMotor::setInitialPosition(void) {
bool forceStepperParking = !isRunning && tpsPos > STEPPER_PARKING_TPS;
if (CONFIG(stepperForceParkingEveryRestart))
forceStepperParking = true;
scheduleMsg(logger, "Stepper: savedStepperPos=%d forceStepperParking=%d (tps=%.2f)", m_currentPosition, (forceStepperParking ? 1 : 0), tpsPos);
efiPrintf("Stepper: savedStepperPos=%d forceStepperParking=%d (tps=%.2f)", m_currentPosition, (forceStepperParking ? 1 : 0), tpsPos);
if (m_currentPosition < 0 || forceStepperParking) {
scheduleMsg(logger, "Stepper: starting parking...");
efiPrintf("Stepper: starting parking...");
// reset saved value
saveStepperPos(-1);
@ -101,7 +99,7 @@ void StepperMotor::setInitialPosition(void) {
// set & save zero stepper position after the parking completion
m_currentPosition = 0;
saveStepperPos(m_currentPosition);
scheduleMsg(logger, "Stepper: parking finished!");
efiPrintf("Stepper: parking finished!");
} else {
// The initial target position should correspond to the saved stepper position.
// Idle thread starts later and sets a new target position.
@ -208,13 +206,11 @@ bool StepDirectionStepper::step(bool positive) {
return pulse();
}
void StepperMotor::initialize(StepperHw *hardware, int totalSteps, Logging *sharedLogger) {
void StepperMotor::initialize(StepperHw *hardware, int totalSteps) {
m_totalSteps = maxI(3, totalSteps);
m_hw = hardware;
logger = sharedLogger;
Start();
}

View File

@ -59,7 +59,7 @@ class StepperMotor final : private ThreadController<UTILITY_THREAD_STACK_SIZE> {
public:
StepperMotor();
void initialize(StepperHw *hardware, int totalSteps, Logging *sharedLogger);
void initialize(StepperHw *hardware, int totalSteps);
void setTargetPosition(int targetPosition);
int getTargetPosition() const;

View File

@ -215,7 +215,7 @@ void runRusEfi(void) {
/**
* Next we should initialize serial port console, it's important to know what's going on
*/
initializeConsole(&sharedLogger);
initializeConsole();
#if EFI_TUNER_STUDIO
startTunerStudioConnectivity();

View File

@ -469,8 +469,7 @@ int tokenLength(const char *msgp) {
return result;
}
void initConsoleLogic(Logging *sharedLogger) {
logging = sharedLogger;
void initConsoleLogic() {
// resetConsoleActions();
addConsoleAction("help", helpCommand);
addConsoleActionI("echo", echo);

View File

@ -8,7 +8,6 @@
#pragma once
#include "datalogging.h"
#include "rusefi_types.h"
typedef enum {
@ -50,7 +49,7 @@ extern "C"
char *validateSecureLine(char *line);
void resetConsoleActions(void);
void helpCommand(void);
void initConsoleLogic(Logging *sharedLogger);
void initConsoleLogic();
void handleConsoleLine(char *line);
int findEndOfToken(const char *line);
char *unquote(char *line);

View File

@ -105,7 +105,7 @@ void rusEfiFunctionalTest(void) {
engine->setConfig();
initializeConsole(&sharedLogger);
initializeConsole();
initStatusLoop();
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -128,9 +128,7 @@ TEST(LaunchControl, CompleteRun) {
bool spark, fuel;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
LoggingWithStorage logger("test");
initLaunchControl(&logger,PASS_ENGINE_PARAMETER_SIGNATURE);
initLaunchControl(PASS_ENGINE_PARAMETER_SIGNATURE);
//load default config
setDefaultLaunchParameters(PASS_CONFIG_PARAMETER_SIGNATURE);