diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 5a8c53465a..9d3b8dea72 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -29,6 +29,9 @@ #include "engine_math.h" #include "speed_density.h" #include "advance_map.h" +#if EFI_PROD_CODE +#include "alternatorController.h" +#endif #include "custom_engine.h" #include "acura_rsx.h" @@ -167,8 +170,10 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) { boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->acRelayPinMode = OM_DEFAULT; - boardConfiguration->alternatorControlPin = GPIO_UNASSIGNED; - boardConfiguration->alternatorControlPinMode = OM_DEFAULT; +#if EFI_PROD_CODE + setDefaultAlternatorParameters(); +#endif + boardConfiguration->mainRelayPin = GPIO_UNASSIGNED; boardConfiguration->mainRelayPinMode = OM_DEFAULT; boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; @@ -391,10 +396,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->HD44780width = 20; engineConfiguration->HD44780height = 4; - engineConfiguration->alternatorOffset = 0; - engineConfiguration->alternatorControlPFactor = 30; - boardConfiguration->alternatorDT = 100; - engineConfiguration->vRefAdcChannel = EFI_ADC_NONE; engineConfiguration->vbattAdcChannel = EFI_ADC_NONE; engineConfiguration->clt.adcChannel = EFI_ADC_6; diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index d27722b9db..810ad3a8cb 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated by config_definition.jar on Sat May 23 20:41:38 EDT 2015 +// this section was generated by config_definition.jar on Sun May 24 09:49:35 EDT 2015 // begin #include "rusefi_types.h" typedef struct { @@ -495,6 +495,9 @@ typedef struct { /** offset 384 bit 9 */ bool_t useStepperIdle : 1; + /** + offset 384 bit 10 */ + bool_t enabledStep1Limiter : 1; /** * offset 388 */ @@ -562,9 +565,10 @@ typedef struct { */ brain_pin_e hip9011IntHoldPin; /** + * Turn off alternator output above specified TPS * offset 656 */ - int unused1280; + float alternatorOffAboveTps; /** * offset 660 */ @@ -738,7 +742,11 @@ typedef struct { /** * offset 320 */ - float unused[2]; + int step1rpm; + /** + * offset 324 + */ + int step1timing; /** * offset 328 */ @@ -1337,4 +1345,4 @@ typedef struct { } persistent_config_s; // end -// this section was generated by config_definition.jar on Sat May 23 20:41:38 EDT 2015 +// this section was generated by config_definition.jar on Sun May 24 09:49:35 EDT 2015 diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 82d12a610d..6bec50f7e0 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -106,8 +106,10 @@ #define iat_bias_resistor_offset 312 #define iat_bias_resistor_offset_hex 138 #define iat_adcChannel_offset 316 -#define unused_offset 320 -#define unused_offset_hex 140 +#define step1rpm_offset 320 +#define step1rpm_offset_hex 140 +#define step1timing_offset 324 +#define step1timing_offset_hex 144 #define hip9011PrescalerAndSDO_offset 328 #define hip9011PrescalerAndSDO_offset_hex 148 #define knockBandCustom_offset 332 @@ -329,6 +331,7 @@ #define isVerboseAlternator_offset 1008 #define useSerialPort_offset 1008 #define useStepperIdle_offset 1008 +#define enabledStep1Limiter_offset 1008 #define logicAnalyzerPins1_offset 1012 #define logicAnalyzerPins2_offset 1016 #define logicAnalyzerPins3_offset 1020 @@ -434,8 +437,8 @@ #define fsioFrequency16_offset 1270 #define hip9011CsPin_offset 1272 #define hip9011IntHoldPin_offset 1276 -#define unused1280_offset 1280 -#define unused1280_offset_hex 500 +#define alternatorOffAboveTps_offset 1280 +#define alternatorOffAboveTps_offset_hex 500 #define fsio_setting1_offset 1284 #define fsio_setting1_offset_hex 504 #define fsio_setting2_offset 1288 diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index 4498d09a97..bfee2708e4 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -79,6 +79,17 @@ static void applyAlternatorPinState(PwmConfig *state, int stateIndex) { output->setValue(value); } +void setDefaultAlternatorParameters(void) { + boardConfiguration->alternatorOffAboveTps = 120; + + boardConfiguration->alternatorControlPin = GPIO_UNASSIGNED; + boardConfiguration->alternatorControlPinMode = OM_DEFAULT; + + engineConfiguration->alternatorOffset = 0; + engineConfiguration->alternatorControlPFactor = 30; + boardConfiguration->alternatorDT = 100; +} + void initAlternatorCtrl(Logging *sharedLogger) { logger = sharedLogger; addConsoleAction("altinfo", showAltInfo); diff --git a/firmware/controllers/alternatorController.h b/firmware/controllers/alternatorController.h index 0ebcc612d3..f2ddffd4f3 100644 --- a/firmware/controllers/alternatorController.h +++ b/firmware/controllers/alternatorController.h @@ -14,5 +14,6 @@ void initAlternatorCtrl(Logging *sharedLogger); void setAltPFactor(float p); void showAltInfo(void); +void setDefaultAlternatorParameters(void); #endif /* ALTERNATORCONTROLLER_H_ */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 84d2718bd0..bc95d647a6 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -159,7 +159,8 @@ MAP_sensor_config_s map;@see hasMapSensor\n@see isMapAveragingEnabled ThermistorConf clt;todo: merge with channel settings, use full-scale Thermistor here! ThermistorConf iat; - float[2] unused; + int step1rpm; + int step1timing; int hip9011PrescalerAndSDO;;"integer", 1, 0.0, 0.0, 32, 0 float knockBandCustom;;"kHz", 1, 0.0, 0.0, 10.0, 2 @@ -388,6 +389,7 @@ bit is_enabled_spi_2 bit useSerialPort bit useStepperIdle + bit enabledStep1Limiter; brain_input_pin_e[LOGIC_ANALYZER_CHANNEL_COUNT iterate] logicAnalyzerPins; uint8_t[LOGIC_ANALYZER_CHANNEL_COUNT] logicAnalyzerMode;default or inverted input @@ -417,7 +419,7 @@ custom fsio_pwm_freq_t 2 scalar, U16, @OFFSET@, "Hz", 1, 0, brain_pin_e hip9011CsPin; brain_pin_e hip9011IntHoldPin; - int unused1280; + float alternatorOffAboveTps;Turn off alternator output above specified TPS;"%", 1, 0, 0, 200, 2 custom fsio_setting_t 4 scalar, F32, @OFFSET@, "Val", 1, 0, 0, 18000, 0 fsio_setting_t[LE_COMMAND_COUNT iterate] fsio_setting; diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index f15146da2d..4f6fea00d6 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -40,7 +40,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated by ConfigDefinition.jar on Sat May 23 20:41:42 EDT 2015 +; this section was generated by ConfigDefinition.jar on Sun May 24 09:49:39 EDT 2015 pageSize = 15288 page = 1 @@ -85,7 +85,8 @@ page = 1 iat_resistance_3 = scalar, F32, 308, "Ohm", 1, 0, 0, 200000, 1 iat_bias_resistor = scalar, F32, 312, "Ohm", 1, 0, 0, 200000, 1 iat_adcChannel = bits, U32, 316, [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5" -;skipping unused offset 320 +;skipping step1rpm offset 320 +;skipping step1timing offset 324 hip9011PrescalerAndSDO = scalar, S32, 328, "integer", 1, 0.0, 0.0, 32, 0 knockBandCustom = scalar, F32, 332, "kHz", 1, 0.0, 0.0, 10.0, 2 sparkDwellBins = array, F32, 336, [8], "RPM", 1, 0.0, 0.0, 18000, 2 @@ -239,6 +240,7 @@ page = 1 isVerboseAlternator = bits, U32, 1008, [7:7], "false", "true" useSerialPort = bits, U32, 1008, [8:8], "false", "true" useStepperIdle = bits, U32, 1008, [9:9], "false", "true" + enabledStep1Limiter = bits, U32, 1008, [10:10], "false", "true" logicAnalyzerPins1 = bits, U32, 1012, [0:6], "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" logicAnalyzerPins2 = bits, U32, 1016, [0:6], "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" logicAnalyzerPins3 = bits, U32, 1020, [0:6], "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" @@ -314,7 +316,7 @@ page = 1 fsioFrequency16 = scalar, U16, 1270, "Hz", 1, 0, 0, 3000, 0 hip9011CsPin = bits, U32, 1272, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" hip9011IntHoldPin = bits, U32, 1276, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" -;skipping unused1280 offset 1280 + alternatorOffAboveTps = scalar, F32, 1280, "%", 1, 0, 0, 200, 2 fsio_setting1 = scalar, F32, 1284, "Val", 1, 0, 0, 18000, 0 fsio_setting2 = scalar, F32, 1288, "Val", 1, 0, 0, 18000, 0 fsio_setting3 = scalar, F32, 1292, "Val", 1, 0, 0, 18000, 0 @@ -923,6 +925,7 @@ fileVersion = { 20150522 } subMenu = fuelPump, "Fuel Pump Settings" subMenu = malfunction, "MIL Settings" subMenu = hipFunction, "hip9011 Settings" + subMenu = spiFunction, "SPI Settings" menu = "Tuning" subMenu = generalSettings, "General" subMenu = std_separator @@ -1174,6 +1177,17 @@ fileVersion = { 20150522 } field = "prescaler & SDO", hip9011PrescalerAndSDO field = "Band Freq override", knockBandCustom field = "!Always on SPI2" + + dialog = spiFunction, "SPI settings" + field = "SPI1 MOSI", spi1mosiPin + field = "SPI1 MISO", spi1misoPin + field = "SPI1 SCK", spi1sckPin + field = "SPI2 MOSI", spi2mosiPin + field = "SPI2 MISO", spi2misoPin + field = "SPI2 SCK", spi2sckPin + field = "SPI3 MOSI", spi3mosiPin + field = "SPI3 MISO", spi3misoPin + field = "SPI3 SCK", spi3sckPin ; Engine->Battery & Alternator dialog = battery, "Battery Settings", yAxis