Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/** |
2 |
|
|
|
* @file electronic_throttle.h |
3 |
|
|
|
* |
4 |
|
|
|
* @date Dec 7, 2013 |
5 |
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020 |
6 |
|
|
|
*/ |
7 |
|
|
|
|
8 |
|
|
|
#pragma once |
9 |
|
|
|
|
10 |
|
|
|
#include "closed_loop_controller.h" |
11 |
|
|
|
#include "rusefi_types.h" |
12 |
|
|
|
#include "engine_configuration.h" |
13 |
|
|
|
|
14 |
|
|
|
void initElectronicThrottle(); |
15 |
|
|
|
void doInitElectronicThrottle(bool isStartupInit); |
16 |
|
|
|
|
17 |
|
|
|
void setEtbIdlePosition(percent_t pos); |
18 |
|
|
|
void setEtbWastegatePosition(percent_t pos); |
19 |
|
|
|
void setEtbLuaAdjustment(percent_t adjustment); |
20 |
|
|
|
void setEwgLuaAdjustment(percent_t pos); |
21 |
|
|
|
void setHitachiEtbCalibration(); |
22 |
|
|
|
|
23 |
|
|
|
void blinkEtbErrorCodes(bool blinkPhase); |
24 |
|
|
|
|
25 |
|
|
|
// same plug as 18919 AM810 but have different calibrations |
26 |
|
|
|
void setToyota89281_33010_pedal_position_sensor(); |
27 |
|
|
|
|
28 |
|
|
|
void setBoschVAGETB(); |
29 |
|
|
|
|
30 |
|
|
|
void setDefaultEtbBiasCurve(); |
31 |
|
|
|
void setDefaultEtbParameters(); |
32 |
|
|
|
void setBoschVNH2SP30Curve(); |
33 |
|
|
|
|
34 |
|
|
|
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration); |
35 |
|
|
|
void unregisterEtbPins(); |
36 |
|
|
|
void setProteusHitachiEtbDefaults(); |
37 |
|
|
|
|
38 |
|
|
|
void etbAutocal(dc_function_e function, bool reportToTs = true); |
39 |
|
|
|
EtbStatus etbGetState(size_t throttleIndex); |
40 |
|
|
|
|
41 |
|
|
|
float getSanitizedPedal(); |
42 |
|
|
|
|
43 |
|
|
|
enum class EtbState : uint8_t { |
44 |
|
|
|
Uninitialized, // 0 |
45 |
|
|
|
Autotune, // 1 |
46 |
|
|
|
NoMotor, // 2 |
47 |
|
|
|
NotEbt, // 3 |
48 |
|
|
|
LimpProhibited, // 4 |
49 |
|
|
|
Paused, // 5 |
50 |
|
|
|
NoOutput, // 6 |
51 |
|
|
|
Active, // 7 |
52 |
|
|
|
NoPedal, // 8 |
53 |
|
|
|
FailFast, // 9 |
54 |
|
|
|
InInit, // 10 |
55 |
|
|
|
SuccessfulInit, // 11 |
56 |
|
|
|
}; |
57 |
|
|
|
|
58 |
|
|
|
class DcMotor; |
59 |
|
|
|
struct pid_s; |
60 |
|
|
|
class ValueProvider3D; |
61 |
|
|
|
struct pid_state_s; |
62 |
|
|
|
|
63 |
|
|
|
class IEtbController : public ClosedLoopController<percent_t, percent_t> { |
64 |
|
|
|
public: |
65 |
|
|
|
// Initialize the throttle. |
66 |
|
|
|
// returns true if the throttle was initialized, false otherwise. |
67 |
|
|
|
virtual bool init(dc_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalMap) = 0; |
68 |
|
|
|
virtual void reset(const char *reason) = 0; |
69 |
|
|
|
virtual void setIdlePosition(percent_t pos) = 0; |
70 |
|
|
|
virtual void setWastegatePosition(percent_t pos) = 0; |
71 |
|
|
|
virtual void update() = 0; |
72 |
|
|
✗ |
virtual void autoCalibrateTps(bool reportToTs = true) { (void)reportToTs; } |
73 |
|
|
|
virtual bool isEtbMode() const = 0; |
74 |
|
|
|
|
75 |
|
|
|
virtual const pid_state_s& getPidState() const = 0; |
76 |
|
|
|
virtual float getCurrentTarget() const = 0; |
77 |
|
|
|
virtual void setLuaAdjustment(percent_t adjustment) = 0; |
78 |
|
|
|
}; |
79 |
|
|
|
|