2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file electronic_throttle.h
|
|
|
|
*
|
|
|
|
* @date Dec 7, 2013
|
2019-10-18 16:39:06 -07:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
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
|
|
|
|
2019-04-24 20:46:49 -07:00
|
|
|
// https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
|
|
|
|
#define DEFAULT_ETB_LOOP_FREQUENCY 200
|
|
|
|
#define DEFAULT_ETB_PWM_FREQUENCY 300
|
|
|
|
|
2017-05-27 20:01:41 -07:00
|
|
|
#include "engine.h"
|
2019-09-22 14:58:27 -07:00
|
|
|
#include "periodic_task.h"
|
|
|
|
|
|
|
|
class EtbController : public PeriodicTimerController {
|
|
|
|
public:
|
|
|
|
DECLARE_ENGINE_PTR;
|
|
|
|
|
|
|
|
int getPeriodMs() override;
|
|
|
|
void PeriodicTask() override;
|
|
|
|
};
|
|
|
|
|
2019-09-21 21:16:46 -07:00
|
|
|
void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
|
|
|
void setBoschVNH2SP30Curve(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
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-30 18:56:56 -07:00
|
|
|
bool isETBRestartNeeded(void);
|
2017-03-19 18:44:52 -07:00
|
|
|
void stopETBPins(void);
|
2019-09-21 21:36:13 -07:00
|
|
|
void startETBPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2017-05-27 20:01:41 -07:00
|
|
|
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
|
2019-03-10 09:58:27 -07:00
|
|
|
void unregisterEtbPins();
|