| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "pch.h" | |||
| 2 | ||||
| 3 | #include "gc_auto.h" | |||
| 4 | ||||
| 5 | #if EFI_TCU | |||
| 6 | AutomaticGearController automaticGearController; | |||
| 7 | ||||
| 8 | 2 | AutomaticGearController::AutomaticGearController() { | ||
| 9 | 2 | } | ||
| 10 | ||||
| 11 | 1 | void AutomaticGearController::update() { | ||
| 12 | 1 | auto tps = Sensor::get(SensorType::DriverThrottleIntent); | ||
| 13 | 1 | auto vss = Sensor::get(SensorType::VehicleSpeed); | ||
| 14 | ||||
| 15 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1/2✓ Decision 'true' taken 1 time.
✗ Decision 'false' not taken.
|
1 | if (getDesiredGear() == NEUTRAL) { |
| 16 | 1 | setDesiredGear(GEAR_1); | ||
| 17 | } | |||
| 18 | ||||
| 19 |
2/4✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1/2✓ Decision 'true' taken 1 time.
✗ Decision 'false' not taken.
|
1 | if (tps.Valid && vss.Valid) { |
| 20 |
1/5✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1 | switch (getDesiredGear()) { | |
| 21 |
1/1✓ Decision 'true' taken 1 time.
|
1 | case GEAR_1 : | |
| 22 | 1 | shift(vss.Value, tps.Value, &config->tcu_shiftSpeed12, GEAR_2); | ||
| 23 | 1 | 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 | 1 | GearControllerBase::update(); | ||
| 41 | 1 | } | ||
| 42 | ||||
| 43 | 1 | void AutomaticGearController::shift(float speed, float throttle, uint8_t (*curve)[TCU_TABLE_WIDTH], gear_e gear) { | ||
| 44 | 1 | shift(speed, throttle, curve, gear, false); | ||
| 45 | 1 | } | ||
| 46 | ||||
| 47 | 1 | void AutomaticGearController::shift(float speed, float throttle, uint8_t (*curve)[TCU_TABLE_WIDTH], gear_e gear, bool down) { | ||
| 48 | 1 | int curveSpeed = interpolate2d(throttle, config->tcu_shiftTpsBins, *curve); | ||
| 49 | ||||
| 50 |
3/8✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
1/2✓ Decision 'true' taken 1 time.
✗ Decision 'false' not taken.
|
1 | if ((down && speed < curveSpeed) || (!down && speed > curveSpeed)) { |
| 51 | 1 | setDesiredGear(gear); | ||
| 52 | } | |||
| 53 | 1 | } | ||
| 54 | ||||
| 55 | ✗ | AutomaticGearController* getAutomaticGearController() { | ||
| 56 | ✗ | return &automaticGearController; | ||
| 57 | } | |||
| 58 | #endif // EFI_TCU | |||
| 59 |