rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
tcu.cpp
Go to the documentation of this file.
1/**
2 * @file tcu.cpp
3 * @brief Base classes for gear selection and transmission control
4 *
5 * @date Aug 31, 2020
6 * @author David Holdeman, (c) 2020
7 */
8
9#include "pch.h"
10
11#include "tcu.h"
12
13#if EFI_TCU
16
20
25
29
31#if EFI_TUNER_STUDIO
33 auto rpm = Sensor::get(SensorType::Rpm);
34 if (iss.Valid && rpm.Valid) {
35 tcRatio = rpm.Value / iss.Value;
36 }
38#endif
39}
40
41// call to mark the start of the shift
47
51 // If gear detection is set up and the gear we are trying to shift into has been detected
52 if (detected.Valid && m_shiftTime && m_shiftTimeGear == detected.Value) {
53 m_shiftTime = false;
54 return m_shiftTimer.getElapsedSeconds();
55 // If ISS isn't configured, we want to use a fixed value.
56 } else if (!iss.Valid && m_shiftTime && m_shiftTimer.hasElapsedMs(config->tcu_shiftTime)) {
57 m_shiftTime = false;
58 // convert ms to seconds for gauge
59 return config->tcu_shiftTime * 0.001;
60 } else {
61 // a return value of 0 means the shift is not completed yet
62 return 0;
63 }
64}
65#endif // EFI_TCU
virtual SensorResult get() const =0
virtual gear_e getCurrentGear() const
Definition tcu.cpp:26
void measureShiftTime(gear_e)
Definition tcu.cpp:42
virtual void update(gear_e)
Definition tcu.cpp:17
virtual gear_e setCurrentGear(gear_e)
Definition tcu.cpp:21
virtual void init()
Definition tcu.cpp:14
static constexpr persistent_config_s * config
gear_e
scaled_channel< uint16_t, 100, 1 > tcRatio
Base classes for gear selection and transmission control.