ETB online settings
This commit is contained in:
parent
3ac921fe1c
commit
7c7cd41471
|
@ -162,6 +162,11 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
||||||
onConfigurationChangeAlternatorCallback(&activeConfiguration);
|
onConfigurationChangeAlternatorCallback(&activeConfiguration);
|
||||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||||
|
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
||||||
|
onConfigurationChangeElectronicThrottleCallback(&activeConfiguration);
|
||||||
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
|
|
||||||
|
|
||||||
rememberCurrentConfiguration();
|
rememberCurrentConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
|
static bool shouldResetPid = false;
|
||||||
|
|
||||||
#define ETB_FREQ 400
|
#define ETB_FREQ 400
|
||||||
|
|
||||||
|
@ -72,20 +73,26 @@ static SimplePwm etbPwmDown CCM_OPTIONAL;
|
||||||
static OutputPin outputDirectionOpen CCM_OPTIONAL;
|
static OutputPin outputDirectionOpen CCM_OPTIONAL;
|
||||||
static OutputPin outputDirectionClose CCM_OPTIONAL;
|
static OutputPin outputDirectionClose CCM_OPTIONAL;
|
||||||
|
|
||||||
static pid_s etbS;
|
EXTERN_ENGINE;
|
||||||
static Pid pid(&etbS, 0, 100);
|
|
||||||
|
static Pid pid(&engineConfiguration->etb, 0, 100);
|
||||||
|
|
||||||
static float prevTps;
|
static float prevTps;
|
||||||
|
|
||||||
static float currentEtbDuty;
|
static float currentEtbDuty;
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
|
||||||
|
|
||||||
static bool wasEtbBraking = false;
|
static bool wasEtbBraking = false;
|
||||||
|
|
||||||
static msg_t etbThread(void *arg) {
|
static msg_t etbThread(void *arg) {
|
||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (shouldResetPid) {
|
||||||
|
pid.reset();
|
||||||
|
// alternatorPidResetCounter++;
|
||||||
|
shouldResetPid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
percent_t pedal = getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE);
|
percent_t pedal = getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
percent_t tps = getTPS();
|
percent_t tps = getTPS();
|
||||||
|
|
||||||
|
@ -176,6 +183,11 @@ void stopETBPins(void) {
|
||||||
unmarkPin(activeConfiguration.bc.etbDirectionPin2);
|
unmarkPin(activeConfiguration.bc.etbDirectionPin2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration) {
|
||||||
|
shouldResetPid = !pid.isSame(&engineConfiguration->etb);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void startETBPins(void) {
|
void startETBPins(void) {
|
||||||
// this line used for PWM
|
// this line used for PWM
|
||||||
startSimplePwmExt(&etbPwmUp, "etb1",
|
startSimplePwmExt(&etbPwmUp, "etb1",
|
||||||
|
|
|
@ -8,11 +8,13 @@
|
||||||
#ifndef ELECTRONIC_THROTTLE_H_
|
#ifndef ELECTRONIC_THROTTLE_H_
|
||||||
#define ELECTRONIC_THROTTLE_H_
|
#define ELECTRONIC_THROTTLE_H_
|
||||||
|
|
||||||
|
#include "engine.h"
|
||||||
void initElectronicThrottle(void);
|
void initElectronicThrottle(void);
|
||||||
void setDefaultEtbParameters(void);
|
void setDefaultEtbParameters(void);
|
||||||
void setEtbPFactor(float value);
|
void setEtbPFactor(float value);
|
||||||
void setEtbIFactor(float value);
|
void setEtbIFactor(float value);
|
||||||
void stopETBPins(void);
|
void stopETBPins(void);
|
||||||
void startETBPins(void);
|
void startETBPins(void);
|
||||||
|
void onConfigurationChangeElectronicThrottleCallback(engine_configuration_s *previousConfiguration);
|
||||||
|
|
||||||
#endif /* ELECTRONIC_THROTTLE_H_ */
|
#endif /* ELECTRONIC_THROTTLE_H_ */
|
||||||
|
|
|
@ -251,5 +251,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20170527;
|
return 20170528;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue