mirror of https://github.com/rusefi/rusefi.git
lambda monitor live data
This commit is contained in:
parent
32c363e007
commit
4219925282
|
@ -180,6 +180,11 @@ const throttle_model_s* getLiveData(size_t) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const lambda_monitor_s* getLiveData(size_t) {
|
||||||
|
return &engine->lambdaMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
static const FragmentEntry fragments[] = {
|
static const FragmentEntry fragments[] = {
|
||||||
// This header is generated - do not edit by hand!
|
// This header is generated - do not edit by hand!
|
||||||
#include "live_data_fragments.h"
|
#include "live_data_fragments.h"
|
||||||
|
|
|
@ -13,23 +13,27 @@ float LambdaMonitor::getMaxAllowedLambda(float rpm, float load) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LambdaMonitorBase::isCut() const {
|
bool LambdaMonitorBase::isCut() const {
|
||||||
return m_isCut;
|
return lambdaMonitorCut;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LambdaMonitorBase::update(float rpm, float load) {
|
void LambdaMonitorBase::update(float rpm, float load) {
|
||||||
if (isCurrentlyGood(rpm, load)) {
|
bool isGood = isCurrentlyGood(rpm, load);
|
||||||
|
lambdaCurrentlyGood = isGood;
|
||||||
|
if (isGood) {
|
||||||
m_timeSinceGoodLambda.reset();
|
m_timeSinceGoodLambda.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lambdaTimeSinceGood = m_timeSinceGoodLambda.getElapsedSeconds();
|
||||||
|
|
||||||
if (m_timeSinceGoodLambda.hasElapsedSec(engineConfiguration->lambdaProtectionTimeout)) {
|
if (m_timeSinceGoodLambda.hasElapsedSec(engineConfiguration->lambdaProtectionTimeout)) {
|
||||||
// Things have been bad long enough, cut!
|
// Things have been bad long enough, cut!
|
||||||
m_isCut = true;
|
lambdaMonitorCut = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_isCut) {
|
if (lambdaMonitorCut) {
|
||||||
// If things are back to normal, cancel the cut and force a reset
|
// If things are back to normal, cancel the cut and force a reset
|
||||||
if (restoreConditionsMet(rpm, load)) {
|
if (restoreConditionsMet(rpm, load)) {
|
||||||
m_isCut = false;
|
lambdaMonitorCut = false;
|
||||||
m_timeSinceGoodLambda.reset();
|
m_timeSinceGoodLambda.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct LambdaMonitorBase {
|
#include "lambda_monitor_generated.h"
|
||||||
|
|
||||||
|
struct LambdaMonitorBase : public lambda_monitor_s {
|
||||||
void update(float rpm, float load);
|
void update(float rpm, float load);
|
||||||
bool isCut() const;
|
bool isCut() const;
|
||||||
|
|
||||||
|
@ -19,7 +21,6 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Timer m_timeSinceGoodLambda;
|
Timer m_timeSinceGoodLambda;
|
||||||
bool m_isCut = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LambdaMonitor : public LambdaMonitorBase {
|
class LambdaMonitor : public LambdaMonitorBase {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
struct_no_prefix lambda_monitor_s
|
||||||
|
bit lambdaCurrentlyGood
|
||||||
|
bit lambdaMonitorCut
|
||||||
|
uint16_t autoscale lambdaTimeSinceGood;;"sec", 0.01, 0, 0, 1, 2
|
||||||
|
end_struct
|
|
@ -176,3 +176,8 @@ Usages:
|
||||||
- name: vvt
|
- name: vvt
|
||||||
java: VvtState.java
|
java: VvtState.java
|
||||||
folder: controllers/actuators
|
folder: controllers/actuators
|
||||||
|
|
||||||
|
- name: lambda_monitor
|
||||||
|
java: LambdaMonitor.java
|
||||||
|
folder: controllers/math
|
||||||
|
constexpr: "___engine.lambdaMonitor"
|
||||||
|
|
Loading…
Reference in New Issue