steps towards ignition live data
This commit is contained in:
parent
74f4dbd11e
commit
3c7eb93fe1
|
@ -13,10 +13,11 @@ angle_t getAdvance(int rpm, float engineLoad);
|
|||
angle_t getCylinderIgnitionTrim(size_t cylinderNumber, int rpm, float ignitionLoad);
|
||||
float getTopAdvanceForBore(chamber_style_e style, int octane, double compression, double bore);
|
||||
float getInitialAdvance(int rpm, float map, float advanceMax);
|
||||
void buildTimingMap(float advanceMax);
|
||||
|
||||
angle_t getAdvanceCorrections(int rpm);
|
||||
size_t getMultiSparkCount(int rpm);
|
||||
|
||||
class IgnitionState : public ignition_state_s {
|
||||
//public:
|
||||
public:
|
||||
floatms_t getSparkDwell(int rpm);
|
||||
};
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "alternator_controller.h"
|
||||
#include "dfco.h"
|
||||
#include "gear_detector.h"
|
||||
#include "advance_map.h"
|
||||
|
||||
#ifndef EFI_UNIT_TEST
|
||||
#error EFI_UNIT_TEST must be defined!
|
||||
|
@ -212,6 +213,8 @@ public:
|
|||
BoostController boostController;
|
||||
#endif // EFI_BOOST_CONTROL
|
||||
|
||||
IgnitionState ignitionState;
|
||||
|
||||
efitick_t mostRecentSparkEvent;
|
||||
efitick_t mostRecentTimeBetweenSparkEvents;
|
||||
efitick_t mostRecentIgnitionEvent;
|
||||
|
|
|
@ -101,7 +101,7 @@ void EngineState::periodicFastCallback() {
|
|||
recalculateAuxValveTiming();
|
||||
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
sparkDwell = getSparkDwell(rpm);
|
||||
sparkDwell = engine->ignitionState.getSparkDwell(rpm);
|
||||
dwellAngle = cisnan(rpm) ? NAN : sparkDwell / getOneDegreeTimeMs(rpm);
|
||||
|
||||
// todo: move this into slow callback, no reason for IAT corr to be here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
struct_no_prefix ignition_state_s
|
||||
|
||||
float baseDwell
|
||||
float voltageCorrection
|
||||
float dwellVoltageCorrection
|
||||
|
||||
! ignition_state
|
||||
end_struct
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 15:46:00 EDT 2022
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 16:33:12 EDT 2022
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -12,9 +12,9 @@ struct ignition_state_s {
|
|||
/**
|
||||
* offset 4
|
||||
*/
|
||||
float voltageCorrection = (float)0;
|
||||
float dwellVoltageCorrection = (float)0;
|
||||
/** total size 8*/
|
||||
};
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 15:46:00 EDT 2022
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 16:33:12 EDT 2022
|
||||
|
|
|
@ -73,7 +73,7 @@ void setSingleCoilDwell() {
|
|||
/**
|
||||
* @return Spark dwell time, in milliseconds. 0 if tables are not ready.
|
||||
*/
|
||||
floatms_t getSparkDwell(int rpm) {
|
||||
floatms_t IgnitionState::getSparkDwell(int rpm) {
|
||||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
float dwellMs;
|
||||
if (engine->rpmCalculator.isCranking()) {
|
||||
|
@ -81,19 +81,19 @@ floatms_t getSparkDwell(int rpm) {
|
|||
} else {
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(rpm), "invalid rpm", NAN);
|
||||
|
||||
auto base = interpolate2d(rpm, engineConfiguration->sparkDwellRpmBins, engineConfiguration->sparkDwellValues);
|
||||
auto voltageMult = 0.02f *
|
||||
baseDwell = interpolate2d(rpm, engineConfiguration->sparkDwellRpmBins, engineConfiguration->sparkDwellValues);
|
||||
dwellVoltageCorrection = 0.02f *
|
||||
interpolate2d(
|
||||
10 * Sensor::getOrZero(SensorType::BatteryVoltage),
|
||||
engineConfiguration->dwellVoltageCorrVoltBins,
|
||||
engineConfiguration->dwellVoltageCorrValues);
|
||||
|
||||
// for compat (table full of zeroes)
|
||||
if (voltageMult < 0.1f) {
|
||||
voltageMult = 1;
|
||||
if (dwellVoltageCorrection < 0.1f) {
|
||||
dwellVoltageCorrection = 1;
|
||||
}
|
||||
|
||||
dwellMs = base * voltageMult;
|
||||
dwellMs = baseDwell * dwellVoltageCorrection;
|
||||
}
|
||||
|
||||
if (cisnan(dwellMs) || dwellMs <= 0) {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 15:35:05 EDT 2022
|
||||
// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo\ignition_state.txt Wed Apr 13 16:33:12 EDT 2022
|
||||
|
||||
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
||||
public class IgnitionState {
|
||||
public static final Field BASEDWELL = Field.create("BASEDWELL", 0, FieldType.FLOAT);
|
||||
public static final Field VOLTAGECORRECTION = Field.create("VOLTAGECORRECTION", 4, FieldType.FLOAT);
|
||||
public static final Field DWELLVOLTAGECORRECTION = Field.create("DWELLVOLTAGECORRECTION", 4, FieldType.FLOAT);
|
||||
public static final Field[] VALUES = {
|
||||
BASEDWELL,
|
||||
VOLTAGECORRECTION,
|
||||
DWELLVOLTAGECORRECTION,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ TEST(trigger, test1995FordInline6TriggerDecoder) {
|
|||
ASSERT_NEAR(7.9579, ecl->elements[5].dwellPosition.angleOffsetFromTriggerEvent, EPS4D) << "angle offset#2";
|
||||
|
||||
|
||||
ASSERT_FLOAT_EQ(0.5, getSparkDwell(2000)) << "running dwell";
|
||||
ASSERT_FLOAT_EQ(0.5, engine->ignitionState.getSparkDwell(2000)) << "running dwell";
|
||||
}
|
||||
|
||||
TEST(misc, testGetCoilDutyCycleIssue977) {
|
||||
|
@ -199,7 +199,7 @@ TEST(misc, testGetCoilDutyCycleIssue977) {
|
|||
|
||||
int rpm = 2000;
|
||||
engine->rpmCalculator.setRpmValue(rpm);
|
||||
ASSERT_EQ( 4, getSparkDwell(rpm)) << "running dwell";
|
||||
ASSERT_EQ( 4, engine->ignitionState.getSparkDwell(rpm)) << "running dwell";
|
||||
|
||||
ASSERT_NEAR( 26.66666, getCoilDutyCycle(rpm), 0.0001);
|
||||
}
|
||||
|
@ -217,10 +217,10 @@ TEST(misc, testFordAspire) {
|
|||
|
||||
int rpm = 2000;
|
||||
engine->rpmCalculator.setRpmValue(rpm);
|
||||
ASSERT_EQ( 4, getSparkDwell(rpm)) << "running dwell";
|
||||
ASSERT_EQ( 4, engine->ignitionState.getSparkDwell(rpm)) << "running dwell";
|
||||
|
||||
engine->rpmCalculator.setRpmValue(6000);
|
||||
assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000));
|
||||
assertEqualsM("higher rpm dwell", 3.25, engine->ignitionState.getSparkDwell(6000));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue