rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
controllers
tcu
gc_auto.cpp
Go to the documentation of this file.
1
#include "
pch.h
"
2
3
#include "
gc_auto.h
"
4
5
#if EFI_TCU
6
AutomaticGearController
automaticGearController
;
7
8
AutomaticGearController::AutomaticGearController
() {
9
}
10
11
void
AutomaticGearController::update
() {
12
auto
tps =
Sensor::get
(
SensorType::DriverThrottleIntent
);
13
auto
vss =
Sensor::get
(
SensorType::VehicleSpeed
);
14
15
if
(
getDesiredGear
() ==
NEUTRAL
) {
16
setDesiredGear
(
GEAR_1
);
17
}
18
19
if
(tps.Valid && vss.Valid) {
20
switch
(
getDesiredGear
()) {
21
case
GEAR_1
:
22
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed12,
GEAR_2
);
23
break
;
24
case
GEAR_2
:
25
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed21,
GEAR_1
,
true
);
26
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed23,
GEAR_3
);
27
break
;
28
case
GEAR_3
:
29
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed32,
GEAR_2
,
true
);
30
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed34,
GEAR_4
);
31
break
;
32
case
GEAR_4
:
33
shift
(vss.Value, tps.Value, &
config
->tcu_shiftSpeed43,
GEAR_3
,
true
);
34
break
;
35
default :
36
break
;
37
}
38
}
39
40
GearControllerBase::update
();
41
}
42
43
void
AutomaticGearController::shift
(
float
speed,
float
throttle, uint8_t (*curve)[TCU_TABLE_WIDTH],
gear_e
gear) {
44
shift
(speed, throttle, curve, gear,
false
);
45
}
46
47
void
AutomaticGearController::shift
(
float
speed,
float
throttle, uint8_t (*curve)[TCU_TABLE_WIDTH],
gear_e
gear,
bool
down) {
48
int
curveSpeed = interpolate2d(throttle,
config
->tcu_shiftTpsBins, *curve);
49
50
if
((down && speed < curveSpeed) || (!down && speed > curveSpeed)) {
51
setDesiredGear
(gear);
52
}
53
}
54
55
AutomaticGearController
*
getAutomaticGearController
() {
56
return
&
automaticGearController
;
57
}
58
#endif
// EFI_TCU
AutomaticGearController
Definition
gc_auto.h:6
AutomaticGearController::update
void update()
Definition
gc_auto.cpp:11
AutomaticGearController::AutomaticGearController
AutomaticGearController()
Definition
gc_auto.cpp:8
AutomaticGearController::shift
void shift(float speed, float throttle, uint8_t(*curve)[TCU_TABLE_WIDTH], gear_e gear)
Definition
gc_auto.cpp:43
GearControllerBase::update
virtual void update()
Definition
gear_controller.cpp:28
GearControllerBase::getDesiredGear
virtual gear_e getDesiredGear() const
Definition
gear_controller.cpp:47
GearControllerBase::setDesiredGear
virtual gear_e setDesiredGear(gear_e)
Definition
gear_controller.cpp:51
Sensor::get
virtual SensorResult get() const =0
config
static constexpr persistent_config_s * config
Definition
engine_configuration.h:82
getAutomaticGearController
AutomaticGearController * getAutomaticGearController()
Definition
gc_auto.cpp:55
automaticGearController
AutomaticGearController automaticGearController
Definition
gc_auto.cpp:6
gc_auto.h
pch.h
gear_e
gear_e
Definition
rusefi_enums.h:494
GEAR_2
@ GEAR_2
Definition
rusefi_enums.h:498
GEAR_1
@ GEAR_1
Definition
rusefi_enums.h:497
GEAR_4
@ GEAR_4
Definition
rusefi_enums.h:500
NEUTRAL
@ NEUTRAL
Definition
rusefi_enums.h:496
GEAR_3
@ GEAR_3
Definition
rusefi_enums.h:499
SensorType::VehicleSpeed
@ VehicleSpeed
SensorType::DriverThrottleIntent
@ DriverThrottleIntent
Generated on Sat Dec 13 2025 01:49:58 for rusEFI by
1.9.8