mirror of https://github.com/rusefi/rusefi-1.git
Whatever we call it, how ever we implement it - we need live data / remote view into rusEFI actual state #3353
This commit is contained in:
parent
6f3a453dc9
commit
ff864ec0bf
|
@ -8,52 +8,49 @@ static Deadband<200> maxRpmDeadband;
|
||||||
static Deadband<5> maxCltDeadband;
|
static Deadband<5> maxCltDeadband;
|
||||||
static Deadband<5> maxTpsDeadband;
|
static Deadband<5> maxTpsDeadband;
|
||||||
|
|
||||||
static bool getAcState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool AcState::getAcState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
auto rpm = Sensor::getOrZero(SensorType::Rpm);
|
auto rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||||
|
|
||||||
// Engine too slow, disable
|
engineTooSlow = rpm < 500;
|
||||||
if (rpm < 500) {
|
|
||||||
|
if (engineTooSlow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Engine too fast, disable
|
|
||||||
auto maxRpm = CONFIG(maxAcRpm);
|
auto maxRpm = CONFIG(maxAcRpm);
|
||||||
if (maxRpm != 0) {
|
engineTooFast = maxRpm != 0 && maxRpmDeadband.gt(rpm, maxRpm);
|
||||||
if (maxRpmDeadband.gt(rpm, maxRpm)) {
|
if (engineTooFast) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto clt = Sensor::get(SensorType::Clt);
|
auto clt = Sensor::get(SensorType::Clt);
|
||||||
|
|
||||||
|
noClt = !clt;
|
||||||
// No AC with failed CLT
|
// No AC with failed CLT
|
||||||
if (!clt) {
|
if (noClt) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Engine too hot, disable
|
// Engine too hot, disable
|
||||||
auto maxClt = CONFIG(maxAcClt);
|
auto maxClt = CONFIG(maxAcClt);
|
||||||
if (maxClt != 0) {
|
engineTooHot = (maxClt != 0) && maxCltDeadband.gt(maxClt, clt.Value);
|
||||||
if (maxCltDeadband.gt(maxClt, clt.Value)) {
|
if (engineTooHot) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TPS too high, disable
|
// TPS too high, disable
|
||||||
auto maxTps = CONFIG(maxAcTps);
|
auto maxTps = CONFIG(maxAcTps);
|
||||||
if (maxTps != 0) {
|
tpsTooHigh = maxTps != 0 && maxTpsDeadband.gt(maxTps, Sensor::getOrZero(SensorType::Tps1));
|
||||||
auto tps = Sensor::getOrZero(SensorType::Tps1);
|
if (tpsTooHigh) {
|
||||||
|
|
||||||
if (maxTpsDeadband.gt(maxTps, tps)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acButtonState = ENGINE(acSwitchState);
|
||||||
// All conditions allow AC, simply pass thru switch
|
// All conditions allow AC, simply pass thru switch
|
||||||
return ENGINE(acSwitchState);
|
return acButtonState;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateAc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool AcState::updateAc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
bool isEnabled = getAcState(PASS_ENGINE_PARAMETER_SIGNATURE);
|
bool isEnabled = getAcState(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
enginePins.acRelay.setValue(isEnabled);
|
enginePins.acRelay.setValue(isEnabled);
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "engine_ptr.h"
|
#include "engine_ptr.h"
|
||||||
|
#include "ac_control_generated.h"
|
||||||
|
|
||||||
// Returns true if AC is currently active
|
class AcState final : public ac_control_s {
|
||||||
bool updateAc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
public:
|
||||||
|
// Returns true if AC is currently active
|
||||||
|
bool updateAc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool getAcState(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
};
|
||||||
|
|
|
@ -225,7 +225,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
runHardcodedFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
runHardcodedFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_FSIO */
|
#endif /* EFI_FSIO */
|
||||||
|
|
||||||
bool acActive = updateAc(PASS_ENGINE_PARAMETER_SIGNATURE);
|
bool acActive = acState.updateAc(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
updateFans(acActive PASS_ENGINE_PARAMETER_SUFFIX);
|
updateFans(acActive PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
updateGppwm();
|
updateGppwm();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "gear_controller.h"
|
#include "gear_controller.h"
|
||||||
#include "limp_manager.h"
|
#include "limp_manager.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
|
#include "ac_control.h"
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||||
// PROD real firmware uses this implementation
|
// PROD real firmware uses this implementation
|
||||||
|
@ -88,6 +89,7 @@ public:
|
||||||
DECLARE_ENGINE_PTR;
|
DECLARE_ENGINE_PTR;
|
||||||
|
|
||||||
Engine();
|
Engine();
|
||||||
|
AcState acState;
|
||||||
bool enableOverdwellProtection = true;
|
bool enableOverdwellProtection = true;
|
||||||
bool isPwmEnabled = true;
|
bool isPwmEnabled = true;
|
||||||
int triggerActivitySecond = 0;
|
int triggerActivitySecond = 0;
|
||||||
|
|
|
@ -1762,6 +1762,7 @@ end_struct
|
||||||
#define LDS_ALTERNATOR_PID_STATE_INDEX 9
|
#define LDS_ALTERNATOR_PID_STATE_INDEX 9
|
||||||
#define LDS_CJ125_PID_STATE_INDEX 10
|
#define LDS_CJ125_PID_STATE_INDEX 10
|
||||||
#define LDS_TRIGGER_STATE_STATE_INDEX 11
|
#define LDS_TRIGGER_STATE_STATE_INDEX 11
|
||||||
|
#define LDS_AC_STATE 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue