NA6 progress

This commit is contained in:
rusefi 2020-07-29 22:48:41 -04:00
parent 009e5b0c66
commit 196337a8de
5 changed files with 20 additions and 12 deletions

View File

@ -112,7 +112,7 @@ static void miataNAcommonEngineSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setCommonNTCSensor(&engineConfiguration->iat, 2700);
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
copyTimingTable(mapBased16IgnitionTable, config->ignitionTable);
MEMCPY(config->ignitionTable, mapBased16IgnitionTable);
#endif
engineConfiguration->idle.solenoidFrequency = 160;
@ -134,10 +134,10 @@ void miataNAcommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->isFasterEngineSpinUpEnabled = true;
memcpy(config->veRpmBins, ve16RpmBins, sizeof(ve16RpmBins));
memcpy(config->veLoadBins, ve16LoadBins, sizeof(ve16LoadBins));
MEMCPY(config->veRpmBins, ve16RpmBins);
MEMCPY(config->veLoadBins, ve16LoadBins);
#if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT
copyFuelTable(mapBased16VeTable, config->veTable);
MEMCPY(config->veTable, mapBased16VeTable);
#endif
setWholeFuelMap(6 PASS_CONFIG_PARAMETER_SUFFIX);
@ -194,7 +194,7 @@ static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tpsMax = 656; // convert 12to10 bit (ADC/4)
engineConfiguration->injectionMode = IM_BATCH;
copyFuelTable(miataNA6_maf_fuel_table, config->fuelTable);
MEMCPY(config->fuelTable, miataNA6_maf_fuel_table);
}
/**
@ -386,10 +386,10 @@ void setMiataNA6_MAP_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->useFSIO12ForIdleOffset = true;
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_OFFSET), "ac_on_switch 0 cfg_acIdleExtraOffset if" PASS_ENGINE_PARAMETER_SUFFIX);
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_OFFSET), "ac_on_switch 0 cfg_acIdleExtraOffset if" PASS_CONFIG_PARAMETER_SUFFIX);
engineConfiguration->useFSIO13ForIdleMinValue = true;
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch 0 cfg_acIdleExtraMin if" PASS_ENGINE_PARAMETER_SUFFIX);
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch 0 cfg_acIdleExtraMin if" PASS_CONFIG_PARAMETER_SUFFIX);
engineConfiguration->useIdleTimingPidControl = true;

View File

@ -53,6 +53,8 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration);
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration);
#define MEMCPY(dest, src) {memcpy(dest, src, sizeof(src));}
void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination);
void copyFuelTable(fuel_table_t const source, fuel_table_t destination);
void copyTimingTable(ignition_table_t const source, ignition_table_t destination);

View File

@ -614,7 +614,7 @@ static void setFsioSetting(float humanIndexF, float value) {
#endif
}
void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX) {
void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_CONFIG_PARAMETER_SUFFIX) {
int index = atoi(indexStr) - 1;
if (index < 0 || index >= FSIO_COMMAND_COUNT) {
scheduleMsg(logger, "invalid FSIO index: %d", index);
@ -628,6 +628,11 @@ void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGI
scheduleMsg(logger, "setting user out #%d to [%s]", index + 1, l);
strcpy(config->fsioFormulas[index], l);
}
void applyFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX) {
setFsioExpression(indexStr, quotedLine PASS_CONFIG_PARAMETER_SUFFIX);
// this would apply the changes
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
showFsioInfo();
@ -718,7 +723,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#endif /* EFI_PROD_CODE */
#if EFI_PROD_CODE || EFI_SIMULATOR
addConsoleActionSS("set_rpn_expression", setFsioExpression);
addConsoleActionSS("set_rpn_expression", applyFsioExpression);
addConsoleActionFF("set_fsio_setting", setFsioSetting);
addConsoleAction("fsioinfo", showFsioInfo);
addConsoleActionS("rpn_eval", (VoidCharPtr) rpnEval);

View File

@ -40,7 +40,8 @@ void setFsioExt(int index, brain_pin_e pin, const char * exp, int pwmFrequency D
void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX);
void setFsioExpression(const char *indexStr, const char *quotedLine DECLARE_CONFIG_PARAMETER_SUFFIX);
void applyFsioExpression(const char *indexStr, const char *quotedLine DECLARE_ENGINE_PARAMETER_SUFFIX);
float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX);
void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -33,10 +33,10 @@ TEST(idle, fsioPidParameters) {
engineConfiguration->acIdleExtraMin = 30;
engineConfiguration->useFSIO12ForIdleOffset = true;
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_OFFSET), "ac_on_switch 0 cfg_acIdleExtraOffset if" PASS_ENGINE_PARAMETER_SUFFIX);
applyFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_OFFSET), "ac_on_switch 0 cfg_acIdleExtraOffset if" PASS_ENGINE_PARAMETER_SUFFIX);
engineConfiguration->useFSIO13ForIdleMinValue = true;
setFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch 0 cfg_acIdleExtraMin if" PASS_ENGINE_PARAMETER_SUFFIX);
applyFsioExpression(QUOTE(MAGIC_OFFSET_FOR_IDLE_MIN_VALUE), "ac_on_switch 0 cfg_acIdleExtraMin if" PASS_ENGINE_PARAMETER_SUFFIX);
ASSERT_EQ(1, hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE));
setMockVoltage(engineConfiguration->acSwitchAdc, 0 PASS_ENGINE_PARAMETER_SUFFIX);