aux pid is now VVT

This commit is contained in:
rusefi 2021-02-10 12:41:38 -05:00
parent 00de91dd29
commit 6f065274e4
7 changed files with 25 additions and 10 deletions

View File

@ -74,6 +74,7 @@ static const float vvt18fsioLoadBins[FSIO_TABLE_8] =
{30.0, 40.0, 50.0, 60.0, 70.0, 75.0, 82.0, 85.0} {30.0, 40.0, 50.0, 60.0, 70.0, 75.0, 82.0, 85.0}
; ;
// todo: convert to uint8 since destination table is now uint8
float const fsio_table_vvt_target[FSIO_TABLE_8][FSIO_TABLE_8] = { float const fsio_table_vvt_target[FSIO_TABLE_8][FSIO_TABLE_8] = {
/* Generated by TS2C on Mon Feb 13 19:11:32 EST 2017*/ /* Generated by TS2C on Mon Feb 13 19:11:32 EST 2017*/
{/* 0 30.000 *//* 0 700.0*/1.000, /* 1 1000.0*/3.000, /* 2 2000.0*/10.000, /* 3 3000.0*/20.000, /* 4 3500.0*/27.000, /* 5 4500.0*/28.000, /* 6 5500.0*/11.000, /* 7 6500.0*/5.000, }, {/* 0 30.000 *//* 0 700.0*/1.000, /* 1 1000.0*/3.000, /* 2 2000.0*/10.000, /* 3 3000.0*/20.000, /* 4 3500.0*/27.000, /* 5 4500.0*/28.000, /* 6 5500.0*/11.000, /* 7 6500.0*/5.000, },
@ -257,12 +258,12 @@ void setMazdaMiataNbInjectorLag(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
} }
void setMazdaNB2VVTSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setMazdaNB2VVTSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
memcpy(config->fsioTable1RpmBins, vvt18fsioRpmBins, sizeof(vvt18fsioRpmBins)); memcpy(config->vvtTable1RpmBins, vvt18fsioRpmBins, sizeof(vvt18fsioRpmBins));
memcpy(config->fsioTable1LoadBins, vvt18fsioLoadBins, sizeof(vvt18fsioLoadBins)); memcpy(config->vvtTable1LoadBins, vvt18fsioLoadBins, sizeof(vvt18fsioLoadBins));
// todo: there should be a better way? // todo: there should be a better way?
for (int loadIndex = 0; loadIndex < FSIO_TABLE_8; loadIndex++) { for (int loadIndex = 0; loadIndex < FSIO_TABLE_8; loadIndex++) {
for (int rpmIndex = 0; rpmIndex < FSIO_TABLE_8; rpmIndex++) { for (int rpmIndex = 0; rpmIndex < FSIO_TABLE_8; rpmIndex++) {
config->fsioTable1[loadIndex][rpmIndex] = fsio_table_vvt_target[loadIndex][rpmIndex]; config->vvtTable1[loadIndex][rpmIndex] = fsio_table_vvt_target[loadIndex][rpmIndex];
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* @file aux_pid.cpp * @file vvt_pid.cpp
* *
* This class is a copy-paste of alternator_controller.cpp TODO: do something about it? extract more common logic? * This class is a copy-paste of alternator_controller.cpp TODO: do something about it? extract more common logic?
* *
@ -7,9 +7,9 @@
* @author Andrey Belomutskiy, (c) 2012-2020 * @author Andrey Belomutskiy, (c) 2012-2020
*/ */
#include "aux_pid.h"
#include "local_version_holder.h" #include "local_version_holder.h"
#include "allsensors.h" #include "allsensors.h"
#include "vvt_pid.h"
#if EFI_AUX_PID #if EFI_AUX_PID
#include "pwm_generator_logic.h" #include "pwm_generator_logic.h"
@ -27,7 +27,9 @@
EXTERN_ENGINE; EXTERN_ENGINE;
extern fsio8_Map3D_f32t fsioTable1; static fsio8_Map3D_u8t vvtTable1("vvt#1");
static fsio8_Map3D_u8t vvtTable2("vvt#2");
// todo: this is to some extent a copy-paste of alternator_controller. maybe same loop // todo: this is to some extent a copy-paste of alternator_controller. maybe same loop
// for all PIDs? // for all PIDs?
@ -57,7 +59,8 @@ public:
void init(int index) { void init(int index) {
this->index = index; this->index = index;
auxPid.initPidClass(&persistentState.persistentConfiguration.engineConfiguration.auxPid[index]); auxPid.initPidClass(&persistentState.persistentConfiguration.engineConfiguration.auxPid[index]);
table = getFSIOTable(index); int camIndex = index % CAMS_PER_BANK;
table = camIndex == 0 ? &vvtTable1 : &vvtTable2;
} }
int getPeriodMs() override { int getPeriodMs() override {
@ -139,6 +142,13 @@ void stopAuxPins() {
} }
void initAuxPid(Logging *sharedLogger) { void initAuxPid(Logging *sharedLogger) {
vvtTable1.init(config->vvtTable1, config->vvtTable1LoadBins,
config->vvtTable1RpmBins);
vvtTable2.init(config->vvtTable2, config->vvtTable2LoadBins,
config->vvtTable2RpmBins);
logger = sharedLogger; logger = sharedLogger;
for (int i = 0;i < AUX_PID_COUNT;i++) { for (int i = 0;i < AUX_PID_COUNT;i++) {

View File

@ -812,6 +812,10 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setLinearCurve(config->tpsTpsAccelFromRpmBins, 0, 100, 10); setLinearCurve(config->tpsTpsAccelFromRpmBins, 0, 100, 10);
setLinearCurve(config->tpsTpsAccelToRpmBins, 0, 100, 10); setLinearCurve(config->tpsTpsAccelToRpmBins, 0, 100, 10);
setLinearCurve(config->vvtTable1LoadBins, 20, 120, 10);
setRpmTableBin(config->vvtTable1RpmBins, FSIO_TABLE_8);
setLinearCurve(config->vvtTable2LoadBins, 20, 120, 10);
setRpmTableBin(config->vvtTable2RpmBins, FSIO_TABLE_8);
setLinearCurve(config->fsioTable1LoadBins, 20, 120, 10); setLinearCurve(config->fsioTable1LoadBins, 20, 120, 10);
setRpmTableBin(config->fsioTable1RpmBins, FSIO_TABLE_8); setRpmTableBin(config->fsioTable1RpmBins, FSIO_TABLE_8);
setLinearCurve(config->fsioTable2LoadBins, 20, 120, 10); setLinearCurve(config->fsioTable2LoadBins, 20, 120, 10);

View File

@ -18,7 +18,7 @@ CONTROLLERS_SRC_CPP = \
$(CONTROLLERS_DIR)/actuators/idle_hardware.cpp \ $(CONTROLLERS_DIR)/actuators/idle_hardware.cpp \
$(CONTROLLERS_DIR)/actuators/idle_thread.cpp \ $(CONTROLLERS_DIR)/actuators/idle_thread.cpp \
$(CONTROLLERS_DIR)/actuators/pwm_tester.cpp \ $(CONTROLLERS_DIR)/actuators/pwm_tester.cpp \
$(CONTROLLERS_DIR)/actuators/algo/aux_pid.cpp \ $(CONTROLLERS_DIR)/actuators/algo/vvt_pid.cpp \
$(CONTROLLERS_DIR)/actuators/gppwm/gppwm_channel.cpp \ $(CONTROLLERS_DIR)/actuators/gppwm/gppwm_channel.cpp \
$(CONTROLLERS_DIR)/actuators/gppwm/gppwm.cpp \ $(CONTROLLERS_DIR)/actuators/gppwm/gppwm.cpp \
$(CONTROLLERS_DIR)/gauges/tachometer.cpp \ $(CONTROLLERS_DIR)/gauges/tachometer.cpp \

View File

@ -47,10 +47,10 @@
#include "alternator_controller.h" #include "alternator_controller.h"
#include "fuel_math.h" #include "fuel_math.h"
#include "settings.h" #include "settings.h"
#include "aux_pid.h"
#include "spark_logic.h" #include "spark_logic.h"
#include "aux_valves.h" #include "aux_valves.h"
#include "accelerometer.h" #include "accelerometer.h"
#include "actuators/vvt_pid.h"
#include "perf_trace.h" #include "perf_trace.h"
#include "boost_control.h" #include "boost_control.h"
#include "launch_control.h" #include "launch_control.h"

View File

@ -48,7 +48,7 @@
#include "trigger_central.h" #include "trigger_central.h"
#include "svnversion.h" #include "svnversion.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "aux_pid.h" #include "vvt_pid.h"
#include "perf_trace.h" #include "perf_trace.h"
#include "trigger_emulator_algo.h" #include "trigger_emulator_algo.h"
#include "boost_control.h" #include "boost_control.h"