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"
|
2019-09-22 14:58:27 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void initElectronicThrottle();
|
|
|
|
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);
|
|
|
|
void setHitachiEtbCalibration();
|
2019-12-13 10:52:34 -08:00
|
|
|
|
2021-10-10 14:10:04 -07:00
|
|
|
// these two sensors use same plug but have different calibrations and even rotate in different directions
|
2021-11-16 01:15:29 -08:00
|
|
|
void set18919_AM810_pedal_position_sensor();
|
|
|
|
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();
|
2017-01-06 14:01:28 -08:00
|
|
|
void setEtbPFactor(float value);
|
|
|
|
void setEtbIFactor(float value);
|
2018-09-24 20:57:03 -07:00
|
|
|
void setEtbDFactor(float value);
|
2018-11-26 19:17:16 -08:00
|
|
|
void setEtbOffset(int value);
|
2019-07-12 04:48:28 -07:00
|
|
|
void setThrottleDutyCycle(percent_t level);
|
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
|
|
|
|
|
|
|
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.
|
2020-12-08 03:24:20 -08:00
|
|
|
virtual bool init(etb_function_e function, DcMotor *motor, pid_s *pidParameters, const ValueProvider3D* pedalMap, bool initializeThrottles = true) = 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;
|
|
|
|
|
|
|
|
virtual const pid_state_s* getPidState() const = 0;
|
|
|
|
};
|