mirror of https://github.com/rusefi/rusefi-1.git
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:
parent
221f2a0f27
commit
bd1c84fa62
|
@ -62,9 +62,6 @@ void onDataArrived(void) {
|
||||||
|
|
||||||
CommandHandler console_line_callback;
|
CommandHandler console_line_callback;
|
||||||
|
|
||||||
static Logging *logger;
|
void startConsole(CommandHandler console_line_callback_p) {
|
||||||
|
|
||||||
void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p) {
|
|
||||||
logger = sharedLogger;
|
|
||||||
console_line_callback = console_line_callback_p;
|
console_line_callback = console_line_callback_p;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ extern "C"
|
||||||
typedef void (*CommandHandler)(char *);
|
typedef void (*CommandHandler)(char *);
|
||||||
|
|
||||||
#include "efifeatures.h"
|
#include "efifeatures.h"
|
||||||
#include "datalogging.h"
|
|
||||||
|
|
||||||
|
|
||||||
void consoleOutputBuffer(const uint8_t *buf, int size);
|
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);
|
void onDataArrived(void);
|
||||||
|
|
|
@ -170,10 +170,10 @@ static void cmd_threads(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void initializeConsole(Logging *sharedLogger) {
|
void initializeConsole() {
|
||||||
initConsoleLogic(sharedLogger);
|
initConsoleLogic();
|
||||||
|
|
||||||
startConsole(sharedLogger, &handleConsoleLine);
|
startConsole(&handleConsoleLine);
|
||||||
|
|
||||||
sayHello();
|
sayHello();
|
||||||
addConsoleAction("test", [](){ /* do nothing */});
|
addConsoleAction("test", [](){ /* do nothing */});
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "datalogging.h"
|
|
||||||
|
|
||||||
void initializeConsole(Logging *sharedLogger);
|
void initializeConsole();
|
||||||
void startUsbConsole();
|
void startUsbConsole();
|
||||||
|
|
|
@ -28,8 +28,6 @@ StepperMotor iacMotor;
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static Logging* logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the IAC position value change is insignificant (lower than this threshold), leave the poor valve alone
|
* 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?
|
* todo: why do we have this logic? is this ever useful?
|
||||||
|
@ -109,9 +107,7 @@ bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return iacMotor.isBusy();
|
return iacMotor.isBusy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
logger = sharedLogger;
|
|
||||||
|
|
||||||
if (CONFIG(useStepperIdle)) {
|
if (CONFIG(useStepperIdle)) {
|
||||||
StepperHw* hw;
|
StepperHw* hw;
|
||||||
|
|
||||||
|
@ -141,7 +137,7 @@ void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
hw = &iacStepperHw;
|
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
|
// This greatly improves PID accuracy for steppers with a small number of steps
|
||||||
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;
|
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
class Logging;
|
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void initIdleHardware(Logging* sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
bool isIdleHardwareRestartNeeded();
|
bool isIdleHardwareRestartNeeded();
|
||||||
bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
bool isIdleMotorBusy(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
#include "stepper.h"
|
#include "stepper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
// todo: move all static vars to engine->engineState.idle?
|
// todo: move all static vars to engine->engineState.idle?
|
||||||
|
@ -127,42 +125,42 @@ static iacPidMultiplier_t iacPidMultMap("iacPidMultiplier");
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
|
|
||||||
void idleDebug(const char *msg, percent_t value) {
|
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) {
|
static void showIdleInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
const char * idleModeStr = getIdle_mode_e(engineConfiguration->idleMode);
|
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)));
|
boolToString(CONFIG(useStepperIdle)), boolToString(CONFIG(useHbridges)));
|
||||||
scheduleMsg(logger, "idleMode=%s position=%.2f",
|
efiPrintf("idleMode=%s position=%.2f",
|
||||||
idleModeStr, getIdlePosition());
|
idleModeStr, getIdlePosition());
|
||||||
|
|
||||||
if (CONFIG(useStepperIdle)) {
|
if (CONFIG(useStepperIdle)) {
|
||||||
if (CONFIG(useHbridges)) {
|
if (CONFIG(useHbridges)) {
|
||||||
scheduleMsg(logger, "Coil A:");
|
efiPrintf("Coil A:");
|
||||||
scheduleMsg(logger, " pin1=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin1)));
|
efiPrintf(" pin1=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin1)));
|
||||||
scheduleMsg(logger, " pin2=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin2)));
|
efiPrintf(" pin2=%s", hwPortname(CONFIG(stepperDcIo[0].directionPin2)));
|
||||||
showDcMotorInfo(2);
|
showDcMotorInfo(2);
|
||||||
scheduleMsg(logger, "Coil B:");
|
efiPrintf("Coil B:");
|
||||||
scheduleMsg(logger, " pin1=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin1)));
|
efiPrintf(" pin1=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin1)));
|
||||||
scheduleMsg(logger, " pin2=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin2)));
|
efiPrintf(" pin2=%s", hwPortname(CONFIG(stepperDcIo[1].directionPin2)));
|
||||||
showDcMotorInfo(3);
|
showDcMotorInfo(3);
|
||||||
} else {
|
} else {
|
||||||
scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
|
efiPrintf("directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
|
||||||
engineConfiguration->idleStepperReactionTime);
|
engineConfiguration->idleStepperReactionTime);
|
||||||
scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
|
efiPrintf("stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
|
||||||
engineConfiguration->idleStepperTotalSteps);
|
engineConfiguration->idleStepperTotalSteps);
|
||||||
scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
|
efiPrintf("enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
|
||||||
engineConfiguration->stepperEnablePinMode);
|
engineConfiguration->stepperEnablePinMode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!CONFIG(isDoubleSolenoidIdle)) {
|
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));
|
hwPortname(CONFIG(idle).solenoidPin));
|
||||||
} else {
|
} 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));
|
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) {
|
void setManualIdleValvePosition(int positionPercent) {
|
||||||
if (positionPercent < 1 || positionPercent > 99)
|
if (positionPercent < 1 || positionPercent > 99)
|
||||||
return;
|
return;
|
||||||
scheduleMsg(logger, "setting idle valve position %d", positionPercent);
|
efiPrintf("setting idle valve position %d", positionPercent);
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
@ -612,7 +610,7 @@ void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfigura
|
||||||
|
|
||||||
void setTargetIdleRpm(int value) {
|
void setTargetIdleRpm(int value) {
|
||||||
setTargetRpmCurve(value PASS_ENGINE_PARAMETER_SUFFIX);
|
setTargetRpmCurve(value PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
scheduleMsg(logger, "target idle RPM %d", value);
|
efiPrintf("target idle RPM %d", value);
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,14 +642,13 @@ void setIdleDFactor(float value) {
|
||||||
*/
|
*/
|
||||||
void startIdleBench(void) {
|
void startIdleBench(void) {
|
||||||
timeToStopIdleTest = getTimeNowUs() + MS2US(3000); // 3 seconds
|
timeToStopIdleTest = getTimeNowUs() + MS2US(3000); // 3 seconds
|
||||||
scheduleMsg(logger, "idle valve bench test");
|
efiPrintf("idle valve bench test");
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void startIdleThread(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
logger = sharedLogger;
|
|
||||||
INJECT_ENGINE_REFERENCE(&idleControllerInstance);
|
INJECT_ENGINE_REFERENCE(&idleControllerInstance);
|
||||||
idleControllerInstance.init(&CONFIG(idleTimingPid));
|
idleControllerInstance.init(&CONFIG(idleTimingPid));
|
||||||
INJECT_ENGINE_REFERENCE(&industrialWithOverrideIdlePid);
|
INJECT_ENGINE_REFERENCE(&industrialWithOverrideIdlePid);
|
||||||
|
@ -663,7 +660,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
// todo: we still have to explicitly init all hardware on start in addition to handling configuration change via
|
// 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?
|
// 'applyNewHardwareSettings' todo: maybe unify these two use-cases?
|
||||||
initIdleHardware(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initIdleHardware(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
DISPLAY_STATE(Engine)
|
DISPLAY_STATE(Engine)
|
||||||
|
@ -707,9 +704,6 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
DISPLAY_TEXT(Manual_idle_control);
|
DISPLAY_TEXT(Manual_idle_control);
|
||||||
/* DISPLAY_ENDIF */
|
/* DISPLAY_ENDIF */
|
||||||
|
|
||||||
|
|
||||||
//scheduleMsg(logger, "initial idle %d", idlePositionController.value);
|
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST
|
#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 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
|
// this switch is not used yet
|
||||||
|
|
|
@ -28,8 +28,6 @@ struct IIdleController {
|
||||||
virtual float getOpenLoop(Phase phase, float clt, SensorResult tps) const = 0;
|
virtual float getOpenLoop(Phase phase, float clt, SensorResult tps) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Logging;
|
|
||||||
|
|
||||||
class IdleController : public IIdleController {
|
class IdleController : public IIdleController {
|
||||||
public:
|
public:
|
||||||
DECLARE_ENGINE_PTR;
|
DECLARE_ENGINE_PTR;
|
||||||
|
@ -76,7 +74,7 @@ bool isIdling();
|
||||||
void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void applyIACposition(percent_t position DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void setManualIdleValvePosition(int positionPercent);
|
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 setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void startIdleBench(void);
|
void startIdleBench(void);
|
||||||
void setIdleOffset(float value);
|
void setIdleOffset(float value);
|
||||||
|
|
|
@ -25,8 +25,6 @@ EXTERN_ENGINE;
|
||||||
static fsio8_Map3D_u8t vvtTable1("vvt#1");
|
static fsio8_Map3D_u8t vvtTable1("vvt#1");
|
||||||
static fsio8_Map3D_u8t vvtTable2("vvt#2");
|
static fsio8_Map3D_u8t vvtTable2("vvt#2");
|
||||||
|
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
void VvtController::init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap) {
|
void VvtController::init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap) {
|
||||||
this->index = index;
|
this->index = index;
|
||||||
m_bank = bankIndex;
|
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);
|
float retVal = m_pid.getOutput(setpoint, observation);
|
||||||
|
|
||||||
if (engineConfiguration->isVerboseAuxPid1) {
|
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());
|
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,
|
vvtTable1.init(config->vvtTable1, config->vvtTable1LoadBins,
|
||||||
config->vvtTable1RpmBins);
|
config->vvtTable1RpmBins);
|
||||||
vvtTable2.init(config->vvtTable2, config->vvtTable2LoadBins,
|
vvtTable2.init(config->vvtTable2, config->vvtTable2LoadBins,
|
||||||
config->vvtTable2RpmBins);
|
config->vvtTable2RpmBins);
|
||||||
|
|
||||||
|
|
||||||
logger = sharedLogger;
|
|
||||||
|
|
||||||
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
|
||||||
INJECT_ENGINE_REFERENCE(&instances[i]);
|
INJECT_ENGINE_REFERENCE(&instances[i]);
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,9 @@
|
||||||
#include "pwm_generator_logic.h"
|
#include "pwm_generator_logic.h"
|
||||||
#include "pid.h"
|
#include "pid.h"
|
||||||
|
|
||||||
class Logging;
|
|
||||||
class ValueProvider3D;
|
class ValueProvider3D;
|
||||||
|
|
||||||
void initAuxPid(Logging *sharedLogger);
|
void initAuxPid();
|
||||||
void startVvtControlPins();
|
void startVvtControlPins();
|
||||||
void stopVvtControlPins();
|
void stopVvtControlPins();
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
#include "dynoview.h"
|
#include "dynoview.h"
|
||||||
#include "vehicle_speed.h"
|
#include "vehicle_speed.h"
|
||||||
|
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio_outputs.h"
|
#include "tunerstudio_outputs.h"
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
|
@ -173,8 +171,4 @@ void updateDynoViewCan(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
dynoInstance.update(CAN);
|
dynoInstance.update(CAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initDynoView(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|
||||||
logger = sharedLogger;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* EFI_DYNO_VIEW */
|
#endif /* EFI_DYNO_VIEW */
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#include "engine_ptr.h"
|
#include "engine_ptr.h"
|
||||||
|
|
||||||
class Logging;
|
|
||||||
void initDynoView(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
void updateDynoView(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void updateDynoView(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void updateDynoViewCan(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void updateDynoViewCan(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
float getDynoviewAcceleration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
float getDynoviewAcceleration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
|
||||||
static bool isInit = false;
|
static bool isInit = false;
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
LaunchControlBase launchInstance;
|
LaunchControlBase launchInstance;
|
||||||
|
|
||||||
|
@ -205,8 +204,7 @@ void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_EN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initLaunchControl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initLaunchControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
logger = sharedLogger;
|
|
||||||
INJECT_ENGINE_REFERENCE(&launchInstance);
|
INJECT_ENGINE_REFERENCE(&launchInstance);
|
||||||
|
|
||||||
isInit = true;
|
isInit = true;
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#include "engine_ptr.h"
|
#include "engine_ptr.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
class Logging;
|
void initLaunchControl(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void initLaunchControl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void updateLaunchConditions(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void updateLaunchConditions(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -16,12 +16,11 @@
|
||||||
|
|
||||||
#define CAN_TIMEOUT MS2NT(100)
|
#define CAN_TIMEOUT MS2NT(100)
|
||||||
|
|
||||||
class Logging;
|
|
||||||
class CanListener;
|
class CanListener;
|
||||||
class CanSensorBase;
|
class CanSensorBase;
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT
|
#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
|
#endif // EFI_CAN_SUPPORT
|
||||||
|
|
||||||
void registerCanListener(CanListener& listener);
|
void registerCanListener(CanListener& listener);
|
||||||
|
|
|
@ -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
|
* 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));
|
bool accept = acceptCanRx(CAN_SID(rx));
|
||||||
if (!accept) {
|
if (!accept) {
|
||||||
return;
|
return;
|
||||||
|
@ -72,7 +72,7 @@ static void printPacket(const CANRxFrame &rx, Logging *logger) {
|
||||||
// only print info if we're in can debug mode
|
// 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
|
// 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],
|
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]);
|
rx.data8[4], rx.data8[5], rx.data8[6], rx.data8[7]);
|
||||||
|
|
||||||
|
@ -100,10 +100,9 @@ void registerCanSensor(CanSensorBase& sensor) {
|
||||||
sensor.Register();
|
sensor.Register();
|
||||||
}
|
}
|
||||||
|
|
||||||
void processCanRxMessage(const CANRxFrame &frame, Logging *logger,
|
void processCanRxMessage(const CANRxFrame &frame, efitick_t nowNt) {
|
||||||
efitick_t nowNt) {
|
|
||||||
if (CONFIG(debugMode) == DBG_CAN) {
|
if (CONFIG(debugMode) == DBG_CAN) {
|
||||||
printPacket(frame, logger);
|
printPacket(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceCanSubscribers(frame, nowNt);
|
serviceCanSubscribers(frame, nowNt);
|
||||||
|
|
|
@ -568,7 +568,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
||||||
initNewSensors();
|
initNewSensors();
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
initSensors(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
initAccelEnrichment(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initAccelEnrichment(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
||||||
initGpPwm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initGpPwm(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL
|
#if EFI_IDLE_CONTROL
|
||||||
startIdleThread(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
startIdleThread(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
|
|
||||||
initButtonShift(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initButtonShift(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -602,11 +602,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
||||||
#endif /* EFI_BOOST_CONTROL */
|
#endif /* EFI_BOOST_CONTROL */
|
||||||
|
|
||||||
#if EFI_LAUNCH_CONTROL
|
#if EFI_LAUNCH_CONTROL
|
||||||
initLaunchControl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initLaunchControl(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EFI_DYNO_VIEW
|
|
||||||
initDynoView(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
@ -677,7 +673,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||||
|
|
||||||
#if EFI_AUX_PID
|
#if EFI_AUX_PID
|
||||||
initAuxPid(sharedLogger);
|
initAuxPid();
|
||||||
#endif /* EFI_AUX_PID */
|
#endif /* EFI_AUX_PID */
|
||||||
|
|
||||||
#if EFI_MALFUNCTION_INDICATOR
|
#if EFI_MALFUNCTION_INDICATOR
|
||||||
|
|
|
@ -15,8 +15,8 @@ EXTERN_ENGINE;
|
||||||
|
|
||||||
ButtonDebounce acDebounce("ac_switch");
|
ButtonDebounce acDebounce("ac_switch");
|
||||||
|
|
||||||
void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
initMapDecoder(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initMapDecoder(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
acDebounce.init(15, CONFIG(acSwitch), CONFIG(acSwitchMode));
|
acDebounce.init(15, CONFIG(acSwitch), CONFIG(acSwitchMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#define LOW_VBATT 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 hasAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
static FastInterpolation customMap;
|
static FastInterpolation customMap;
|
||||||
static efitick_t prevWidthTimeNt = 0;
|
static efitick_t prevWidthTimeNt = 0;
|
||||||
|
|
||||||
|
@ -240,14 +238,14 @@ extern int mapMinBufferLength;
|
||||||
|
|
||||||
static void printMAPInfo(void) {
|
static void printMAPInfo(void) {
|
||||||
#if EFI_ANALOG_SENSORS
|
#if EFI_ANALOG_SENSORS
|
||||||
scheduleMsg(logger, "instant value=%.2fkPa", getRawMap());
|
efiPrintf("instant value=%.2fkPa", getRawMap());
|
||||||
|
|
||||||
|
|
||||||
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
||||||
scheduleMsg(logger, "instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIG(frequencyReportingMapInputPin)));
|
efiPrintf("instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIG(frequencyReportingMapInputPin)));
|
||||||
} else {
|
} else {
|
||||||
#if EFI_MAP_AVERAGING
|
#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),
|
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
|
||||||
getMap(),
|
getMap(),
|
||||||
mapMinBufferLength);
|
mapMinBufferLength);
|
||||||
|
@ -256,10 +254,10 @@ static void printMAPInfo(void) {
|
||||||
adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel;
|
adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel;
|
||||||
static char pinNameBuffer[16];
|
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));
|
getPinNameByAdcChannel("map", mapAdc, pinNameBuffer));
|
||||||
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
|
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->mapLowValueVoltage,
|
||||||
engineConfiguration->map.sensor.lowValue,
|
engineConfiguration->map.sensor.lowValue,
|
||||||
engineConfiguration->mapHighValueVoltage,
|
engineConfiguration->mapHighValueVoltage,
|
||||||
|
@ -268,9 +266,9 @@ static void printMAPInfo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sensor::hasSensor(SensorType::BarometricPressure)) {
|
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) {
|
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->baroSensor.lowValue,
|
||||||
engineConfiguration->mapLowValueVoltage,
|
engineConfiguration->mapLowValueVoltage,
|
||||||
engineConfiguration->baroSensor.highValue,
|
engineConfiguration->baroSensor.highValue,
|
||||||
|
@ -282,8 +280,7 @@ static void printMAPInfo(void) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
|
|
||||||
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
logger = sharedLogger;
|
|
||||||
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
//engine->configurationListeners.registerCallback(applyConfiguration);
|
//engine->configurationListeners.registerCallback(applyConfiguration);
|
||||||
|
|
||||||
|
@ -308,13 +305,13 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
if (CONFIG(useFixedBaroCorrFromMap)) {
|
if (CONFIG(useFixedBaroCorrFromMap)) {
|
||||||
// Read initial MAP sensor value and store it for Baro correction.
|
// Read initial MAP sensor value and store it for Baro correction.
|
||||||
storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE);
|
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.)
|
// validate if it's within a reasonable range (the engine should not be spinning etc.)
|
||||||
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure PASS_ENGINE_PARAMETER_SUFFIX);
|
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
if (!cisnan(storedInitialBaroPressure)) {
|
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 {
|
} 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 */
|
#else /* EFI_ANALOG_SENSORS */
|
||||||
|
|
||||||
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_ANALOG_SENSORS */
|
#endif /* EFI_ANALOG_SENSORS */
|
||||||
|
|
|
@ -8,10 +8,9 @@
|
||||||
|
|
||||||
#include "engine_ptr.h"
|
#include "engine_ptr.h"
|
||||||
|
|
||||||
class Logging;
|
|
||||||
struct air_pressure_sensor_config_s;
|
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
|
* @return Raw MAP sensor value right now
|
||||||
|
|
|
@ -32,7 +32,6 @@ static int canReadCounter = 0;
|
||||||
int canWriteOk = 0;
|
int canWriteOk = 0;
|
||||||
int canWriteNotOk = 0;
|
int canWriteNotOk = 0;
|
||||||
static bool isCanEnabled = false;
|
static bool isCanEnabled = false;
|
||||||
static LoggingWithStorage logger("CAN driver");
|
|
||||||
|
|
||||||
// Values below calculated with http://www.bittiming.can-wiki.info/
|
// Values below calculated with http://www.bittiming.can-wiki.info/
|
||||||
// Pick ST micro bxCAN
|
// Pick ST micro bxCAN
|
||||||
|
@ -155,7 +154,7 @@ public:
|
||||||
// Process the message
|
// Process the message
|
||||||
canReadCounter++;
|
canReadCounter++;
|
||||||
|
|
||||||
processCanRxMessage(m_buffer, &logger, getTimeNowNt());
|
processCanRxMessage(m_buffer, getTimeNowNt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,17 +167,17 @@ static CanWrite canWrite;
|
||||||
|
|
||||||
static void canInfo(void) {
|
static void canInfo(void) {
|
||||||
if (!isCanEnabled) {
|
if (!isCanEnabled) {
|
||||||
scheduleMsg(&logger, "CAN is not enabled, please enable & restart");
|
efiPrintf("CAN is not enabled, please enable & restart");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleMsg(&logger, "CAN TX %s", hwPortname(CONFIG_OVERRIDE(canTxPin)));
|
efiPrintf("CAN TX %s", hwPortname(CONFIG_OVERRIDE(canTxPin)));
|
||||||
scheduleMsg(&logger, "CAN RX %s", hwPortname(CONFIG_OVERRIDE(canRxPin)));
|
efiPrintf("CAN RX %s", hwPortname(CONFIG_OVERRIDE(canRxPin)));
|
||||||
scheduleMsg(&logger, "type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
|
efiPrintf("type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
|
||||||
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
|
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
|
||||||
engineConfiguration->canSleepPeriodMs);
|
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) {
|
void setCanType(int type) {
|
||||||
|
|
|
@ -429,7 +429,7 @@ void applyNewHardwareSettings(void) {
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL
|
#if EFI_IDLE_CONTROL
|
||||||
if (isIdleHardwareRestartNeeded()) {
|
if (isIdleHardwareRestartNeeded()) {
|
||||||
initIdleHardware(sharedLogger);
|
initIdleHardware();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static Logging *logger;
|
|
||||||
|
|
||||||
void StepperMotor::saveStepperPos(int pos) {
|
void StepperMotor::saveStepperPos(int pos) {
|
||||||
// use backup-power RTC registers to store the data
|
// use backup-power RTC registers to store the data
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
@ -74,10 +72,10 @@ void StepperMotor::setInitialPosition(void) {
|
||||||
bool forceStepperParking = !isRunning && tpsPos > STEPPER_PARKING_TPS;
|
bool forceStepperParking = !isRunning && tpsPos > STEPPER_PARKING_TPS;
|
||||||
if (CONFIG(stepperForceParkingEveryRestart))
|
if (CONFIG(stepperForceParkingEveryRestart))
|
||||||
forceStepperParking = true;
|
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) {
|
if (m_currentPosition < 0 || forceStepperParking) {
|
||||||
scheduleMsg(logger, "Stepper: starting parking...");
|
efiPrintf("Stepper: starting parking...");
|
||||||
// reset saved value
|
// reset saved value
|
||||||
saveStepperPos(-1);
|
saveStepperPos(-1);
|
||||||
|
|
||||||
|
@ -101,7 +99,7 @@ void StepperMotor::setInitialPosition(void) {
|
||||||
// set & save zero stepper position after the parking completion
|
// set & save zero stepper position after the parking completion
|
||||||
m_currentPosition = 0;
|
m_currentPosition = 0;
|
||||||
saveStepperPos(m_currentPosition);
|
saveStepperPos(m_currentPosition);
|
||||||
scheduleMsg(logger, "Stepper: parking finished!");
|
efiPrintf("Stepper: parking finished!");
|
||||||
} else {
|
} else {
|
||||||
// The initial target position should correspond to the saved stepper position.
|
// The initial target position should correspond to the saved stepper position.
|
||||||
// Idle thread starts later and sets a new target position.
|
// Idle thread starts later and sets a new target position.
|
||||||
|
@ -208,13 +206,11 @@ bool StepDirectionStepper::step(bool positive) {
|
||||||
return pulse();
|
return pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StepperMotor::initialize(StepperHw *hardware, int totalSteps, Logging *sharedLogger) {
|
void StepperMotor::initialize(StepperHw *hardware, int totalSteps) {
|
||||||
m_totalSteps = maxI(3, totalSteps);
|
m_totalSteps = maxI(3, totalSteps);
|
||||||
|
|
||||||
m_hw = hardware;
|
m_hw = hardware;
|
||||||
|
|
||||||
logger = sharedLogger;
|
|
||||||
|
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class StepperMotor final : private ThreadController<UTILITY_THREAD_STACK_SIZE> {
|
||||||
public:
|
public:
|
||||||
StepperMotor();
|
StepperMotor();
|
||||||
|
|
||||||
void initialize(StepperHw *hardware, int totalSteps, Logging *sharedLogger);
|
void initialize(StepperHw *hardware, int totalSteps);
|
||||||
|
|
||||||
void setTargetPosition(int targetPosition);
|
void setTargetPosition(int targetPosition);
|
||||||
int getTargetPosition() const;
|
int getTargetPosition() const;
|
||||||
|
|
|
@ -215,7 +215,7 @@ void runRusEfi(void) {
|
||||||
/**
|
/**
|
||||||
* Next we should initialize serial port console, it's important to know what's going on
|
* Next we should initialize serial port console, it's important to know what's going on
|
||||||
*/
|
*/
|
||||||
initializeConsole(&sharedLogger);
|
initializeConsole();
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
startTunerStudioConnectivity();
|
startTunerStudioConnectivity();
|
||||||
|
|
|
@ -469,8 +469,7 @@ int tokenLength(const char *msgp) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initConsoleLogic(Logging *sharedLogger) {
|
void initConsoleLogic() {
|
||||||
logging = sharedLogger;
|
|
||||||
// resetConsoleActions();
|
// resetConsoleActions();
|
||||||
addConsoleAction("help", helpCommand);
|
addConsoleAction("help", helpCommand);
|
||||||
addConsoleActionI("echo", echo);
|
addConsoleActionI("echo", echo);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "datalogging.h"
|
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -50,7 +49,7 @@ extern "C"
|
||||||
char *validateSecureLine(char *line);
|
char *validateSecureLine(char *line);
|
||||||
void resetConsoleActions(void);
|
void resetConsoleActions(void);
|
||||||
void helpCommand(void);
|
void helpCommand(void);
|
||||||
void initConsoleLogic(Logging *sharedLogger);
|
void initConsoleLogic();
|
||||||
void handleConsoleLine(char *line);
|
void handleConsoleLine(char *line);
|
||||||
int findEndOfToken(const char *line);
|
int findEndOfToken(const char *line);
|
||||||
char *unquote(char *line);
|
char *unquote(char *line);
|
||||||
|
|
|
@ -105,7 +105,7 @@ void rusEfiFunctionalTest(void) {
|
||||||
|
|
||||||
engine->setConfig();
|
engine->setConfig();
|
||||||
|
|
||||||
initializeConsole(&sharedLogger);
|
initializeConsole();
|
||||||
|
|
||||||
initStatusLoop();
|
initStatusLoop();
|
||||||
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -128,9 +128,7 @@ TEST(LaunchControl, CompleteRun) {
|
||||||
bool spark, fuel;
|
bool spark, fuel;
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
|
|
||||||
LoggingWithStorage logger("test");
|
initLaunchControl(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
initLaunchControl(&logger,PASS_ENGINE_PARAMETER_SIGNATURE);
|
|
||||||
|
|
||||||
//load default config
|
//load default config
|
||||||
setDefaultLaunchParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
|
setDefaultLaunchParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
Loading…
Reference in New Issue