diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index 08521b0da1..40e862e249 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -284,9 +284,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 2 bit dfcoActive bit tpsAccelActive - uint8_t autoscale boostControllerOutput;@@GAUGE_NAME_BOOST_OUTPUT@@;"%", 0.5, 0, 0, 100, 1 - uint8_t autoscale boostControllerOpenLoopPart;@@GAUGE_NAME_BOOST_OPEN_LOOP@@;"%", 0.5, 0, 0, 100, 1 - uint16_t autoscale fallbackMap;;"kPa", 0.1, 0, 0, 1000, 1 uint16_t autoscale instantMAPValue;Instant MAP;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 655, 2 diff --git a/firmware/controllers/actuators/boost_control.cpp b/firmware/controllers/actuators/boost_control.cpp index 2905e3623f..76913ff1dc 100644 --- a/firmware/controllers/actuators/boost_control.cpp +++ b/firmware/controllers/actuators/boost_control.cpp @@ -58,8 +58,8 @@ expected BoostController::getSetpoint() { float rpm = Sensor::getOrZero(SensorType::Rpm); - auto tps = Sensor::get(SensorType::DriverThrottleIntent); - isTpsInvalid = !tps.Valid; + auto driverIntent = Sensor::get(SensorType::DriverThrottleIntent); + isTpsInvalid = !driverIntent.Valid; if (isTpsInvalid) { return unexpected; @@ -67,7 +67,7 @@ expected BoostController::getSetpoint() { efiAssert(OBD_PCM_Processor_Fault, m_closedLoopTargetMap != nullptr, "boost closed loop target", unexpected); - return m_closedLoopTargetMap->getValue(rpm, tps.Value) * luaTargetMult + luaTargetAdd; + return m_closedLoopTargetMap->getValue(rpm, driverIntent.Value) * luaTargetMult + luaTargetAdd; } expected BoostController::getOpenLoop(float target) { @@ -87,11 +87,6 @@ expected BoostController::getOpenLoop(float target) { openLoopPart = luaOpenLoopAdd + m_openLoopMap->getValue(rpm, tps.Value); -#if EFI_TUNER_STUDIO - // todo: why do we still copy this data point? - engine->outputChannels.boostControllerOpenLoopPart = openLoopPart; -#endif - return openLoopPart; } @@ -136,18 +131,14 @@ expected BoostController::getClosedLoop(float target, float manifoldP } void BoostController::setOutput(expected output) { - percent_t percent = output.value_or(engineConfiguration->boostControlSafeDutyCycle); + boostOutput = output.value_or(engineConfiguration->boostControlSafeDutyCycle); if (!engineConfiguration->isBoostControlEnabled) { // If not enabled, force 0% output - percent = 0; + boostOutput = 0; } -#if EFI_TUNER_STUDIO - engine->outputChannels.boostControllerOutput = percent; -#endif /* EFI_TUNER_STUDIO */ - - float duty = PERCENT_TO_DUTY(percent); + float duty = PERCENT_TO_DUTY(boostOutput); if (m_pwm) { m_pwm->setSimplePwmDutyCycle(duty); @@ -155,16 +146,16 @@ void BoostController::setOutput(expected output) { // inject wastegate position into DC controllers, pretty weird workflow to be honest // todo: should it be DC controller pulling? - setEtbWastegatePosition(percent); + setEtbWastegatePosition(boostOutput); } void BoostController::update() { m_pid.iTermMin = -50; m_pid.iTermMax = 50; - bool rpmTooLow = Sensor::getOrZero(SensorType::Rpm) < engineConfiguration->boostControlMinRpm; - bool tpsTooLow = Sensor::getOrZero(SensorType::Tps1) < engineConfiguration->boostControlMinTps; - bool mapTooLow = Sensor::getOrZero(SensorType::Map) < engineConfiguration->boostControlMinMap; + rpmTooLow = Sensor::getOrZero(SensorType::Rpm) < engineConfiguration->boostControlMinRpm; + tpsTooLow = Sensor::getOrZero(SensorType::Tps1) < engineConfiguration->boostControlMinTps; + mapTooLow = Sensor::getOrZero(SensorType::Map) < engineConfiguration->boostControlMinMap; if (rpmTooLow || tpsTooLow || mapTooLow) { // Passing unexpected will use the safe duty cycle configured by the user diff --git a/firmware/controllers/actuators/boost_control.txt b/firmware/controllers/actuators/boost_control.txt index 3989336314..a394046170 100644 --- a/firmware/controllers/actuators/boost_control.txt +++ b/firmware/controllers/actuators/boost_control.txt @@ -6,9 +6,12 @@ bit isBelowClosedLoopThreshold; bit isNotClosedLoop; bit isZeroRpm bit hasInitBoost +bit rpmTooLow +bit tpsTooLow +bit mapTooLow int16_t autoscale luaTargetAdd;"Boost: Lua Target Add";"v", 0.5,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@ -int16_t autoscale boostOutput;"Boost: Output";"v", 0.5,0, -100,100, 1, @@GAUGE_CATEGORY_BOOST_CONTROL@@ +int16_t autoscale boostOutput;"Boost: Output";"percent", 0.01,0, -100,100, 2, @@GAUGE_CATEGORY_BOOST_CONTROL@@ float luaTargetMult float openLoopPart;