mirror of https://github.com/FOME-Tech/fome-fw.git
proper fix for flex temp sensing
This commit is contained in:
parent
47d727fd9c
commit
e4258d6b86
|
@ -44,6 +44,7 @@ or
|
||||||
- Improve performance with Lua CAN reception of a high volume of frames
|
- Improve performance with Lua CAN reception of a high volume of frames
|
||||||
- Displayed units in TunerStudio change when switching between volume vs. mass injector flow modes #42
|
- Displayed units in TunerStudio change when switching between volume vs. mass injector flow modes #42
|
||||||
- Make Toyota "3 Tooth Cam" decoder more robust #382
|
- Make Toyota "3 Tooth Cam" decoder more robust #382
|
||||||
|
- Flex sensor-derived fuel temperature indication works properly
|
||||||
|
|
||||||
## December 2023 Release
|
## December 2023 Release
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,8 @@ static Biquad flexTempFilter;
|
||||||
static Timer flexFreq, flexPulse;
|
static Timer flexFreq, flexPulse;
|
||||||
|
|
||||||
static void flexCallback(efitick_t nowNt, bool value) {
|
static void flexCallback(efitick_t nowNt, bool value) {
|
||||||
if (!value) {
|
if (value) {
|
||||||
float frequency = 1 / flexFreq.getElapsedSecondsAndReset(nowNt);
|
// End pulse timing on rising edge
|
||||||
flexSensor.postRawValue(frequency, nowNt);
|
|
||||||
|
|
||||||
// Start timing pulse width on rising edge
|
|
||||||
flexPulse.reset(nowNt);
|
|
||||||
} else {
|
|
||||||
// End pulse timing on falling edge
|
|
||||||
float pulseWidthUs = flexPulse.getElapsedUs(nowNt);
|
float pulseWidthUs = flexPulse.getElapsedUs(nowNt);
|
||||||
|
|
||||||
if (pulseWidthUs < 900) {
|
if (pulseWidthUs < 900) {
|
||||||
|
@ -36,6 +30,12 @@ static void flexCallback(efitick_t nowNt, bool value) {
|
||||||
tempC = flexTempFilter.filter(tempC);
|
tempC = flexTempFilter.filter(tempC);
|
||||||
flexFuelTemp.setValidValue(tempC, nowNt);
|
flexFuelTemp.setValidValue(tempC, nowNt);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
float frequency = 1 / flexFreq.getElapsedSecondsAndReset(nowNt);
|
||||||
|
flexSensor.postRawValue(frequency, nowNt);
|
||||||
|
|
||||||
|
// Start timing pulse width on falling edge
|
||||||
|
flexPulse.reset(nowNt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue