From c023056d2d2806b605b8d77842614c8c992dff2d Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 16 Apr 2022 16:49:59 -0400 Subject: [PATCH] very random progress --- firmware/controllers/actuators/idle_thread.cpp | 2 ++ firmware/controllers/actuators/vvt.cpp | 3 ++- firmware/controllers/can/can_verbose.cpp | 2 ++ firmware/controllers/sensors/sensor_info_printing.cpp | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index 49c16af135..b56b854c69 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -33,6 +33,7 @@ int IdleController::getTargetRpm(float clt) { } IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction) { +#if EFI_SHAFT_POSITION_INPUT if (!engine->rpmCalculator.isRunning()) { return Phase::Cranking; } @@ -67,6 +68,7 @@ IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, Se if (looksLikeCrankToIdle) { return Phase::CrankToIdleTaper; } +#endif // EFI_SHAFT_POSITION_INPUT // No other conditions met, we are idling! return Phase::Idling; diff --git a/firmware/controllers/actuators/vvt.cpp b/firmware/controllers/actuators/vvt.cpp index 54ffdedd1c..95be6a7d7d 100644 --- a/firmware/controllers/actuators/vvt.cpp +++ b/firmware/controllers/actuators/vvt.cpp @@ -93,7 +93,7 @@ expected VvtController::getClosedLoop(angle_t target, angle_t observa void VvtController::setOutput(expected outputValue) { float rpm = Sensor::getOrZero(SensorType::Rpm); - +#if EFI_SHAFT_POSITION_INPUT bool enabled = rpm > engineConfiguration->cranking.rpm /* todo: make this configurable? */ && engine->rpmCalculator.getSecondsSinceEngineStart(getTimeNowNt()) > engineConfiguration->vvtActivationDelayMs / MS_PER_SECOND ; @@ -106,6 +106,7 @@ void VvtController::setOutput(expected outputValue) { // we need to avoid accumulating iTerm while engine is not running m_pid.reset(); } +#endif // EFI_SHAFT_POSITION_INPUT } #if EFI_AUX_PID diff --git a/firmware/controllers/can/can_verbose.cpp b/firmware/controllers/can/can_verbose.cpp index 1a548507df..0c786c0072 100644 --- a/firmware/controllers/can/can_verbose.cpp +++ b/firmware/controllers/can/can_verbose.cpp @@ -112,7 +112,9 @@ struct Sensors2 { static void populateFrame(Sensors2& msg) { msg.afr = Sensor::getOrZero(SensorType::Lambda1) * STOICH_RATIO; msg.oilPressure = Sensor::get(SensorType::OilPressure).value_or(-1); +#if EFI_SHAFT_POSITION_INPUT msg.vvtPos = engine->triggerCentral.getVVTPosition(0, 0); +#endif // EFI_SHAFT_POSITION_INPUT msg.vbatt = Sensor::getOrZero(SensorType::BatteryVoltage); } diff --git a/firmware/controllers/sensors/sensor_info_printing.cpp b/firmware/controllers/sensors/sensor_info_printing.cpp index 0baac735de..dae93dc40c 100644 --- a/firmware/controllers/sensors/sensor_info_printing.cpp +++ b/firmware/controllers/sensors/sensor_info_printing.cpp @@ -46,6 +46,7 @@ void FallbackSensor::showInfo(const char* sensorName) const { } void RpmCalculator::showInfo(const char* /*sensorName*/) const { +#if EFI_SHAFT_POSITION_INPUT efiPrintf("RPM sensor: stopped: %d spinning up: %d cranking: %d running: %d rpm: %f", isStopped(), isSpinningUp(), @@ -53,6 +54,7 @@ void RpmCalculator::showInfo(const char* /*sensorName*/) const { isRunning(), get().value_or(0) ); +#endif // EFI_SHAFT_POSITION_INPUT } void Lps25Sensor::showInfo(const char* sensorName) const {