diff --git a/firmware/console/binary/output_channels.txt b/firmware/console/binary/output_channels.txt index 9a3201f1fd..1ad6cdc96e 100644 --- a/firmware/console/binary/output_channels.txt +++ b/firmware/console/binary/output_channels.txt @@ -14,11 +14,8 @@ bit checkEngine; bit needBurn; bit sd_msd -bit clutchUpState;@@INDICATOR_NAME_CLUTCH_UP@@ -bit clutchDownState;@@INDICATOR_NAME_CLUTCH_DOWN@@ bit isFan2On bit alternatorOnOff; -bit brakePedalState;@@INDICATOR_NAME_BRAKE_DOWN@@ bit toothLogReady; bit unused3123 bit isTpsError; @@ -296,12 +293,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0 int16_t autoscale auxLinear1;@@GAUGE_NAME_AUX_LINEAR_1@@;"", 0.01, 0, 0, 0, 0 int16_t autoscale auxLinear2;@@GAUGE_NAME_AUX_LINEAR_2@@;"", 0.01, 0, 0, 0, 0 - bit launchSpeedCondition - bit launchRpmCondition - bit launchTpsCondition - bit launchActivateSwitchCondition - bit launchIsLaunchCondition; - bit launchCombinedConditions bit dfcoActive bit tpsAccelActive @@ -313,9 +304,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0 int8_t autoscale boostControllerClosedLoopPart;@@GAUGE_NAME_BOOST_CLOSED_LOOP@@;"%", 0.5, 0, -50, 50, 1 uint8_t detectedGear;@@GAUGE_NAME_DETECTED_GEAR@@;"", 1, 0, 0, @@GEARS_COUNT@@, 0 - int16_t autoscale unusedAimingCltCorrection;;"deg",{1/@@PACK_MULT_PERCENT@@}, 0, -20, 20, 2 - int16_t autoscale unusedAtimingIatCorrection;;"deg",{1/@@PACK_MULT_PERCENT@@}, 0, -20, 20, 2 - int16_t autoscale unusedAtimingPidCorrection;;"deg",{1/@@PACK_MULT_PERCENT@@}, 0, -20, 20, 2 uint16_t autoscale instantMAPValue;Instant MAP;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 655, 2 uint16_t mostRecentTimeBetweenSparkEvents;;"", 1, 0, -10000, 10000, 3 @@ -344,8 +332,6 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0 float injectorFlowPressureRatio;;"", 1, 0, -10000, 10000, 3 float injectorFlowPressureDelta;;"kPa", 1, 0, -10000, 10000, 1 - float etbIntegralError;;"", 1, 0, -10000, 10000, 3 - float etbCurrentTarget;;"%", 1, 0, -10000, 10000, 3 pid_status_s alternatorStatus pid_status_s idleStatus pid_status_s etbStatus diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 712f0e2fe7..c2f656b0e5 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -303,8 +303,7 @@ expected EtbController::getSetpointEtb() { float sanitizedPedal = clampF(0, pedalPosition.value_or(0), 100); float rpm = Sensor::getOrZero(SensorType::Rpm); - float targetFromTable = m_pedalMap->getValue(rpm, sanitizedPedal); - engine->engineState.targetFromTable = targetFromTable; + etbCurrentTarget = m_pedalMap->getValue(rpm, sanitizedPedal); percent_t etbIdlePosition = clampF( 0, @@ -317,7 +316,7 @@ expected EtbController::getSetpointEtb() { // [0, 100] -> [idle, 100] // 0% target from table -> idle position as target // 100% target from table -> 100% target position - idlePosition = interpolateClamped(0, etbIdleAddition, 100, 100, targetFromTable); + idlePosition = interpolateClamped(0, etbIdleAddition, 100, 100, etbCurrentTarget); percent_t targetPosition = idlePosition + luaAdjustment; @@ -504,16 +503,10 @@ expected EtbController::getClosedLoop(percent_t target, percent_t obs return getClosedLoopAutotune(target, observation); } else { // Check that we're not over the error limit - float errorIntegral = m_errorAccumulator.accumulate(target - observation); - -#if EFI_TUNER_STUDIO - if (m_function == ETB_Throttle1) { - engine->outputChannels.etbIntegralError = errorIntegral; - } -#endif // EFI_TUNER_STUDIO + etbIntegralError = m_errorAccumulator.accumulate(target - observation); // Allow up to 10 percent-seconds of error - if (errorIntegral > 10.0f) { + if (etbIntegralError > 10.0f) { // TODO: figure out how to handle uncalibrated ETB //engine->limpManager.etbProblem(); } @@ -573,7 +566,6 @@ void EtbController::update() { } } - engine->outputChannels.etbCurrentTarget = engine->engineState.targetFromTable; m_pid.iTermMin = engineConfiguration->etb_iTermMin; m_pid.iTermMax = engineConfiguration->etb_iTermMax; diff --git a/firmware/controllers/actuators/electronic_throttle.txt b/firmware/controllers/actuators/electronic_throttle.txt index 8ba8f1118b..1cb80e5530 100644 --- a/firmware/controllers/actuators/electronic_throttle.txt +++ b/firmware/controllers/actuators/electronic_throttle.txt @@ -4,6 +4,9 @@ float idlePosition float trim float luaAdjustment + percent_t etbFeedForward + float etbIntegralError;;"", 1, 0, -10000, 10000, 3 + float etbCurrentTarget;;"%", 1, 0, -10000, 10000, 3 end_struct \ No newline at end of file diff --git a/firmware/controllers/algo/engine_state.txt b/firmware/controllers/algo/engine_state.txt index 2f5d85818f..752f3458dc 100644 --- a/firmware/controllers/algo/engine_state.txt +++ b/firmware/controllers/algo/engine_state.txt @@ -74,10 +74,6 @@ running_fuel_s running custom percent_t 4 scalar, F32, @OFFSET@, "", 1, 0, 0, 100, 2 - ! todo: move these to ETB state, not engine - percent_t etbFeedForward - percent_t targetFromTable - ! spark-related floatms_t sparkDwell;ignition dwell duration in ms\nSee also dwellAngle angle_t dwellAngle;ignition dwell duration as crankshaft angle\nNAN if engine is stopped\nSee also sparkDwell @@ -88,6 +84,9 @@ running_fuel_s running int16_t hellenBoardId;How does this board self identifies;"id", 1, 0, 0, 3000, 0 bit clutchDownState + bit clutchUpState;@@INDICATOR_NAME_CLUTCH_UP@@ + bit clutchDownState;@@INDICATOR_NAME_CLUTCH_DOWN@@ + bit brakePedalState;@@INDICATOR_NAME_BRAKE_DOWN@@ ! engine_state2_s end_struct