2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file electronic_throttle.h
|
|
|
|
*
|
|
|
|
* @date Dec 7, 2013
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2019-10-18 16:39:06 -07:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2020-04-19 14:18:47 -07:00
|
|
|
#include "closed_loop_controller.h"
|
2020-12-06 22:27:27 -08:00
|
|
|
#include "rusefi_types.h"
|
2022-09-05 01:00:24 -07:00
|
|
|
#include "engine_configuration.h"
|
2019-09-22 14:58:27 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void initElectronicThrottle();
|
2022-10-26 14:33:10 -07:00
|
|
|
void doInitElectronicThrottle();
|
2020-10-18 18:57:04 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setEtbIdlePosition(percent_t pos);
|
|
|
|
void setEtbWastegatePosition(percent_t pos);
|
2022-07-09 19:46:28 -07:00
|
|
|
void setEtbLuaAdjustment(percent_t adjustment);
|
2021-11-16 01:15:29 -08:00
|
|
|
void setHitachiEtbCalibration();
|
2019-12-13 10:52:34 -08:00
|
|
|
|
2024-10-31 18:48:01 -07:00
|
|
|
void blinkEtbErrorCodes(bool blinkPhase);
|
|
|
|
|
2024-07-03 00:54:50 -07:00
|
|
|
// same plug as 18919 AM810 but have different calibrations
|
2021-11-16 01:15:29 -08:00
|
|
|
void setToyota89281_33010_pedal_position_sensor();
|
2021-10-10 14:10:04 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setBoschVAGETB();
|
2021-10-10 14:10:04 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void setDefaultEtbBiasCurve();
|
|
|
|
void setDefaultEtbParameters();
|
|
|
|
void setBoschVNH2SP30Curve();
|
2024-11-08 15:04:12 -08:00
|
|
|
|
2017-05-27 20:01:41 -07:00
|
|
|
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
|
2019-03-10 09:58:27 -07:00
|
|
|
void unregisterEtbPins();
|
2021-11-16 01:15:29 -08:00
|
|
|
void setProteusHitachiEtbDefaults();
|
2020-04-28 16:31:41 -07:00
|
|
|
|
|
|
|
void etbAutocal(size_t throttleIndex);
|
2020-12-06 22:27:27 -08:00
|
|
|
|
2024-05-08 05:23:14 -07:00
|
|
|
float getSanitizedPedal();
|
|
|
|
|
2024-11-08 15:24:56 -08:00
|
|
|
enum class EtbState : uint8_t {
|
|
|
|
Uninitialized, // 0
|
|
|
|
Autotune, // 1
|
|
|
|
NoMotor, // 2
|
|
|
|
NotEbt, // 3
|
|
|
|
LimpProhibited, // 4
|
|
|
|
Paused, // 5
|
|
|
|
NoOutput, // 6
|
|
|
|
Active, // 7
|
|
|
|
NoPedal, // 8
|
2024-11-08 15:53:40 -08:00
|
|
|
FailFast, // 9
|
2024-11-13 08:57:57 -08:00
|
|
|
InInit, // 10
|
2024-11-08 15:53:40 -08:00
|
|
|
SuccessfulInit, // 11
|
2024-11-08 15:24:56 -08:00
|
|
|
};
|
|
|
|
|
2020-12-06 22:27:27 -08:00
|
|
|
class DcMotor;
|
|
|
|
struct pid_s;
|
|
|
|
class ValueProvider3D;
|
|
|
|
struct pid_state_s;
|
|
|
|
|
2021-11-16 13:52:11 -08:00
|
|
|
class IEtbController : public ClosedLoopController<percent_t, percent_t> {
|
2020-12-06 22:27:27 -08:00
|
|
|
public:
|
|
|
|
// Initialize the throttle.
|
|
|
|
// returns true if the throttle was initialized, false otherwise.
|
2024-11-11 17:44:11 -08:00
|
|
|
virtual bool init(dc_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalMap) = 0;
|
2020-12-06 22:27:27 -08:00
|
|
|
virtual void reset() = 0;
|
|
|
|
virtual void setIdlePosition(percent_t pos) = 0;
|
|
|
|
virtual void setWastegatePosition(percent_t pos) = 0;
|
|
|
|
virtual void update() = 0;
|
|
|
|
virtual void autoCalibrateTps() = 0;
|
2024-05-04 09:08:16 -07:00
|
|
|
virtual bool isEtbMode() const = 0;
|
2020-12-06 22:27:27 -08:00
|
|
|
|
2023-01-10 12:31:04 -08:00
|
|
|
virtual const pid_state_s& getPidState() const = 0;
|
2024-06-17 18:46:56 -07:00
|
|
|
virtual float getCurrentTarget() const = 0;
|
2022-07-09 19:46:28 -07:00
|
|
|
virtual void setLuaAdjustment(percent_t adjustment) = 0;
|
2020-12-06 22:27:27 -08:00
|
|
|
};
|