From 2b692470bf80840a7d0206891b54acc0f50d8448 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 2 Jan 2024 22:38:26 -0500 Subject: [PATCH] only: Detected gear is not current gear? fix #5850 --- firmware/config/boards/atlas/board.mk | 1 + firmware/console/binary/live_data.cpp | 3 +-- firmware/controllers/tcu/gear_controller.h | 2 +- firmware/controllers/tcu/tc_4l6x.cpp | 10 +++++----- firmware/controllers/tcu/tcu.h | 2 +- firmware/controllers/tcu/tcu_controller.txt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/firmware/config/boards/atlas/board.mk b/firmware/config/boards/atlas/board.mk index c674011203..eb9d2a83be 100644 --- a/firmware/config/boards/atlas/board.mk +++ b/firmware/config/boards/atlas/board.mk @@ -14,6 +14,7 @@ DDEFS += -DHW_ATLAS=1 # Atlas needs networking library LWIP = yes ALLOW_SHADOW = yes +DDEFS += -DEFI_TCU=TRUE DDEFS += -DEFI_ETHERNET=TRUE DDEFS += -DSTATIC_BOARD_ID=STATIC_BOARD_ID_ATLAS diff --git a/firmware/console/binary/live_data.cpp b/firmware/console/binary/live_data.cpp index 604796d851..4a463e54ff 100644 --- a/firmware/console/binary/live_data.cpp +++ b/firmware/console/binary/live_data.cpp @@ -24,8 +24,7 @@ const knock_controller_s* getLiveData(size_t) { template<> const tcu_controller_s* getLiveData(size_t) { #if EFI_TCU - fix me here - return &engine-> + return engine->gearController->transmissionController; #else return nullptr; #endif // EFI_TCU diff --git a/firmware/controllers/tcu/gear_controller.h b/firmware/controllers/tcu/gear_controller.h index 89e12081cd..7417f9ff8d 100644 --- a/firmware/controllers/tcu/gear_controller.h +++ b/firmware/controllers/tcu/gear_controller.h @@ -16,10 +16,10 @@ public: virtual GearControllerMode getMode() const { return GearControllerMode::ButtonShift; } + TransmissionControllerBase *transmissionController; protected: virtual gear_e setDesiredGear(gear_e); void initTransmissionController(); - TransmissionControllerBase *transmissionController; uint8_t* getRangeStateArray(int); private: gear_e desiredGear = NEUTRAL; diff --git a/firmware/controllers/tcu/tc_4l6x.cpp b/firmware/controllers/tcu/tc_4l6x.cpp index 4f94fb157d..960b92dd5f 100644 --- a/firmware/controllers/tcu/tc_4l6x.cpp +++ b/firmware/controllers/tcu/tc_4l6x.cpp @@ -4,9 +4,9 @@ #if EFI_TCU Gm4l6xTransmissionController gm4l6xTransmissionController; -static SimplePwm tccPwm("TCC Control"); -static SimplePwm pcPwm("Pressure Control"); -static SimplePwm shift32Pwm("3-2 Shift Control"); +static SimplePwm tccPwm("TCC Control"); +static SimplePwm pcPwm("Pressure Control"); +static SimplePwm shift32Pwm("3-2 Shift Control"); void Gm4l6xTransmissionController::init() { for (size_t i = 0; i < efi::size(engineConfiguration->tcu_solenoid); i++) { @@ -56,7 +56,7 @@ void Gm4l6xTransmissionController::update(gear_e gear) { float time = isShiftCompleted(); if (time != 0) { - engine->outputChannels.lastShiftTime = time; + lastShiftTime = time; isShifting = false; } } @@ -157,7 +157,7 @@ void Gm4l6xTransmissionController::set32State(gear_e gear) { int pct = interpolate2d(vss.Value, config->tcu_32SpeedBins, config->tcu_32Vals); shift32Pwm.setSimplePwmDutyCycle(pct*0.01); } else { - shift32Pwm.setSimplePwmDutyCycle(0); + shift32Pwm.setSimplePwmDutyCycle(0); } } diff --git a/firmware/controllers/tcu/tcu.h b/firmware/controllers/tcu/tcu.h index 2475fc98fd..04310e1111 100644 --- a/firmware/controllers/tcu/tcu.h +++ b/firmware/controllers/tcu/tcu.h @@ -15,7 +15,7 @@ #include #if EFI_TCU -class TransmissionControllerBase, public tcu_controller_s { +class TransmissionControllerBase: public tcu_controller_s { private: Timer m_shiftTimer; bool m_shiftTime; diff --git a/firmware/controllers/tcu/tcu_controller.txt b/firmware/controllers/tcu/tcu_controller.txt index 85c23336b4..ecc411d778 100644 --- a/firmware/controllers/tcu/tcu_controller.txt +++ b/firmware/controllers/tcu/tcu_controller.txt @@ -2,5 +2,5 @@ struct_no_prefix tcu_controller_s int8_t tcuCurrentGear;@@GAUGE_NAME_CURRENT_GEAR@@;"gear", 1, 0, -1, 10, 0 uint16_t autoscale tcRatio;@@GAUGE_NAME_TC_RATIO@@;"value",{1/@@PACK_MULT_PERCENT@@}, 0, 0, 0, 0 float lastShiftTime -! uint8_t tcu_currentRange;"TCU: Current Range";"", 1, 0, 0, 0, 0 + uint8_t tcu_currentRange;"TCU: Current Range";"", 1, 0, 0, 0, 0 end_struct