auto-sync

This commit is contained in:
rusEfi 2016-07-17 03:01:48 -04:00
parent 94625d16f7
commit b0ec0ac927
9 changed files with 110 additions and 35 deletions

View File

@ -223,6 +223,9 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
setDefaultIdleParameters();
#endif
boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED;
boardConfiguration->cj125CsPin = GPIO_UNASSIGNED;
boardConfiguration->hip9011CsPin = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPinMode = OM_DEFAULT;
@ -694,6 +697,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
strcpy(config->timingAdditive, "0");
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2;
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
engineConfiguration->isAlternatorControlEnabled = true;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 01:44:37 EDT 2016
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 02:23:45 EDT 2016
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -450,7 +450,7 @@ typedef struct {
/**
* offset 256
*/
int unused3;
brain_pin_e cj125CsPin;
/**
* offset 260
*/
@ -1679,7 +1679,15 @@ typedef struct {
/**
* offset 2480
*/
int unused[142];
spi_device_e cj125SpiDevice;
/**
* offset 2484
*/
pin_output_mode_e cj125CsPinMode;
/**
* offset 2488
*/
int unused[140];
/** total size 3048*/
} engine_configuration_s;
@ -1894,4 +1902,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 01:44:37 EDT 2016
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 02:23:45 EDT 2016

View File

@ -369,8 +369,8 @@
#define electronicThrottlePin1Mode_offset 872
#define electronicThrottlePin1Mode_offset_hex 368
#define wboHeaterPin_offset 876
#define unused3_offset 880
#define unused3_offset_hex 370
#define cj125CsPin_offset 880
#define cj125CsPin_offset_hex 370
#define fuelLevelEmptyTankVoltage_offset 884
#define fuelLevelEmptyTankVoltage_offset_hex 374
#define fuelLevelFullTankVoltage_offset 888
@ -859,7 +859,9 @@
#define auxPidFrequency4_offset 2470
#define alternatorPwmFrequency_offset 2472
#define storageMode_offset 2476
#define unused_offset 2480
#define cj125SpiDevice_offset 2480
#define cj125CsPinMode_offset 2484
#define unused_offset 2488
#define le_formulas1_offset 3048
#define le_formulas2_offset 3248
#define le_formulas3_offset 3448

View File

@ -86,7 +86,7 @@ static Logging *logger;
// SPI_CR1_CPHA Clock Phase
// todo: nicer method which would mention SPI speed explicitly?
static SPIConfig spicfg = { NULL,
static SPIConfig hipSpiCfg = { NULL,
/* HW dependent part.*/
NULL, 0,
SPI_CR1_MSTR |
@ -109,7 +109,8 @@ static void checkResponse(void) {
spiUnselect(driver); \
checkResponse();
spi_device_e spiDevice = SPI_DEVICE_2;
// todo: make this configurable
spi_device_e hipSpiDevice = SPI_DEVICE_2;
static SPIDriver *driver;
@ -140,7 +141,7 @@ static void showHipInfo(void) {
engine->knockCount, engineConfiguration->maxKnockSubDeg);
scheduleMsg(logger, "spi=%s IntHold@%s response count=%d incorrect response=%d",
getSpi_device_e(spiDevice),
getSpi_device_e(hipSpiDevice),
hwPortname(boardConfiguration->hip9011IntHoldPin),
correctResponse, invalidResponse);
scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount);
@ -151,9 +152,9 @@ static void showHipInfo(void) {
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, pinNameBuffer),
hipValueMax,
spiCount, boardConfiguration->useTpicAdvancedMode);
scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(spiDevice)));
scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(spiDevice)));
scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(spiDevice)));
scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(hipSpiDevice)));
scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(hipSpiDevice)));
scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(hipSpiDevice)));
scheduleMsg(logger, "start %f end %f", engineConfiguration->knockDetectionWindowStart,
engineConfiguration->knockDetectionWindowEnd);
@ -376,8 +377,8 @@ static void hipStartupCode(void) {
* asynchronous mode
*/
spiStop(driver);
spicfg.end_cb = endOfSpiExchange;
spiStart(driver, &spicfg);
hipSpiCfg.end_cb = endOfSpiExchange;
spiStart(driver, &hipSpiCfg);
state = READY_TO_INTEGRATE;
}
@ -405,7 +406,6 @@ static msg_t hipThread(void *arg) {
}
void initHip9011(Logging *sharedLogger) {
driver = getSpiDevice(spiDevice);
logger = sharedLogger;
addConsoleAction("hipinfo", showHipInfo);
if (!boardConfiguration->isHip9011Enabled)
@ -417,11 +417,10 @@ void initHip9011(Logging *sharedLogger) {
prepareHip9011RpmLookup(currentAngleWindowWidth);
// todo: configurable
// driver = getSpiDevice(boardConfiguration->hip9011SpiDevice);
driver = getSpiDevice(engineConfiguration->hip9011SpiDevice);
spicfg.ssport = getHwPort(boardConfiguration->hip9011CsPin);
spicfg.sspad = getHwPin(boardConfiguration->hip9011CsPin);
hipSpiCfg.ssport = getHwPort(boardConfiguration->hip9011CsPin);
hipSpiCfg.sspad = getHwPin(boardConfiguration->hip9011CsPin);
outputPinRegisterExt2("hip int/hold", &intHold, boardConfiguration->hip9011IntHoldPin,
&boardConfiguration->hip9011IntHoldPinMode);
@ -429,7 +428,7 @@ void initHip9011(Logging *sharedLogger) {
&boardConfiguration->hip9011CsPinMode);
scheduleMsg(logger, "Starting HIP9011/TPIC8101 driver");
spiStart(driver, &spicfg);
spiStart(driver, &hipSpiCfg);
currentBandIndex = getBandIndex();

View File

@ -1,5 +1,5 @@
/*
* hardware.h
* @file hardware.h
*
* @date May 27, 2013
* @author Andrey Belomutskiy, (c) 2012-2016

View File

@ -8,7 +8,31 @@
*
*/
#include "engine.h"
#include "CJ125.h"
#include "pwm_generator.h"
#include "pid.h"
#include "pin_repository.h"
#include "hardware.h"
EXTERN_ENGINE;
static SimplePwm wboHeaderControl;
static OutputPin wboHeaderPin;
static OutputPin cj125Cs;
// todo: make this configurable
spi_device_e cj125SpiDevice = SPI_DEVICE_2;
static SPIDriver *driver;
static SPIConfig cj125spicfg = { NULL,
/* HW dependent part.*/
NULL, 0,
SPI_CR1_MSTR |
//SPI_CR1_BR_1 // 5MHz
SPI_CR1_CPHA | SPI_CR1_BR_0 | SPI_CR1_BR_1 | SPI_CR1_BR_2 };
/**********************************************************************************
INIT_REG1 - CJ125 Initialization Register 1
@ -39,6 +63,26 @@
void initCJ125(void) {
// still a lot to be done here :)
if (!boardConfiguration->isCJ125Enabled)
return;
cj125spicfg.ssport = getHwPort(boardConfiguration->cj125CsPin);
cj125spicfg.sspad = getHwPin(boardConfiguration->cj125CsPin);
driver = getSpiDevice(engineConfiguration->cj125SpiDevice);
outputPinRegisterExt2("cj125 CS", &cj125Cs, boardConfiguration->cj125CsPin,
&engineConfiguration->cj125CsPinMode);
if (boardConfiguration->wboHeaterPin != GPIO_UNASSIGNED) {
// todo: use custom pin state method, turn pin off while not running
startSimplePwmExt(&wboHeaderControl, "heater control", boardConfiguration->wboHeaterPin,
&wboHeaderPin,
300, 0.1, applyPinState);
}
}

View File

@ -419,7 +419,7 @@ custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:1], "Off", "Slow", "Fas
pin_output_mode_e electronicThrottlePin1Mode;
brain_pin_e wboHeaterPin;
int unused3;
brain_pin_e cj125CsPin;
float fuelLevelEmptyTankVoltage;;"V", 1, 0, 0,10, 2
float fuelLevelFullTankVoltage;;"V", 1, 0, 0,10, 2
ego_sensor_e afr_type;AFR, WBO, EGO - whatever you like to call it;
@ -713,7 +713,9 @@ float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0.0, 300,
fsio_pwm_freq_t[AUX_PID_COUNT iterate] auxPidFrequency;
int alternatorPwmFrequency;;"Hz", 1, 0, 0, 3000.0, 0
mass_storage_e storageMode;
int[142] unused;
spi_device_e cj125SpiDevice;
pin_output_mode_e cj125CsPinMode;
int[140] unused;
end_struct

View File

@ -42,7 +42,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 01:44:37 EDT 2016
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 02:00:17 EDT 2016
pageSize = 16376
page = 1
@ -244,7 +244,7 @@ page = 1
etbControlPin2 = bits, U32, 868, [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"
electronicThrottlePin1Mode = bits, U32, 872, [0:1], "default", "default inverted", "open collector", "open collector inverted"
wboHeaterPin = bits, U32, 876, [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 unused3 offset 880
cj125CsPin = bits, U32, 880, [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"
fuelLevelEmptyTankVoltage = scalar, F32, 884, "V", 1, 0, 0,10, 2
fuelLevelFullTankVoltage = scalar, F32, 888, "V", 1, 0, 0,10, 2
afr_type = bits, S32, 892, [0:2], "BPSX", "Innovate", "14Point7", "Narrow", "PLX"
@ -594,7 +594,9 @@ page = 1
auxPidFrequency4 = scalar, U16, 2470, "Hz", 1, 0, 0, 3000, 0
alternatorPwmFrequency = scalar, S32, 2472, "Hz", 1, 0, 0, 3000.0, 0
storageMode = bits, U32, 2476, [0:1], "Auto", "Always", "Never"
;skipping unused offset 2480
cj125SpiDevice = bits,U32, 2480, [0:1], "Off", "SPI1", "SPI2", "SPI3"
cj125CsPinMode = bits, U32, 2484, [0:1], "default", "default inverted", "open collector", "open collector inverted"
;skipping unused offset 2488
le_formulas1 = array, U08, 3048, [200],"char", 1, 0, 0.0, 3.0, 2
le_formulas2 = array, U08, 3248, [200],"char", 1, 0, 0.0, 3.0, 2
le_formulas3 = array, U08, 3448, [200],"char", 1, 0, 0.0, 3.0, 2
@ -1275,7 +1277,8 @@ fileVersion = { 20160702 }
subMenu = mainRealay, "Main Relay Settings"
subMenu = fuelPump, "Fuel Pump Settings"
subMenu = malfunction, "MIL Settings"
subMenu = hipFunction, "hip9011 Settings"
subMenu = hipFunction, "hip9011 Settings (knock decoder)"
subMenu = cj125Function, "CJ125 Settings (wbo decoder)"
subMenu = spiFunction, "SPI Settings"
menu = "Tuning"
subMenu = generalSettings, "General"
@ -1640,18 +1643,27 @@ cmd_test_idle_valve = "w\x00\x17\x00\x01"
field = "Check Engine Pin", malfunctionIndicatorPin
; Engine->hip9011 Settings
dialog = hipFunction, "HIP9011 Settings"
dialog = hipFunction, "HIP9011 Settings (knock decoder)"
field = "Enabled", isHip9011Enabled
field = "Threshold", knockVThreshold
field = "!ECU reboot needed to apply these settings"
field = "IntHold pin (hip9011 input)", hip9011IntHoldPin
field = "ChipSelect pin", hip9011CsPin
field = "ChipSelect mode", hip9011CsPinMode
field = "hip Output/stm input", hipOutputChannel
field = "prescaler & SDO", hip9011PrescalerAndSDO
field = "Band Freq override", knockBandCustom
field = "!Always on SPI2"
field = "SPI device", hip9011SpiDevice
panel = knockThresholdCurve
; Engine->cj125 Settings
dialog = cj125Function, "CJ125 Settings (wbo decoder)"
field = "Enabled", isCJ125Enabled
field = "!ECU reboot needed to apply these settings"
field = "ChipSelect pin", cj125CsPin
field = "ChipSelect mode", cj125CsPinMode
field = "SPI device", cj125SpiDevice
dialog = spiFunction, "SPI settings"
field = "!ECU reboot needed to apply these settings"
field = "SPI1 MOSI", spi1mosiPin

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 01:44:37 EDT 2016
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Jul 17 02:23:45 EDT 2016
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int FSIO_ADC_COUNT = 4;
@ -373,8 +373,8 @@ public class Fields {
public static final int electronicThrottlePin1Mode_offset = 872;
public static final int electronicThrottlePin1Mode_offset_hex = 368;
public static final int wboHeaterPin_offset = 876;
public static final int unused3_offset = 880;
public static final int unused3_offset_hex = 370;
public static final int cj125CsPin_offset = 880;
public static final int cj125CsPin_offset_hex = 370;
public static final int fuelLevelEmptyTankVoltage_offset = 884;
public static final int fuelLevelEmptyTankVoltage_offset_hex = 374;
public static final int fuelLevelFullTankVoltage_offset = 888;
@ -863,7 +863,9 @@ public class Fields {
public static final int auxPidFrequency4_offset = 2470;
public static final int alternatorPwmFrequency_offset = 2472;
public static final int storageMode_offset = 2476;
public static final int unused_offset = 2480;
public static final int cj125SpiDevice_offset = 2480;
public static final int cj125CsPinMode_offset = 2484;
public static final int unused_offset = 2488;
public static final int le_formulas1_offset = 3048;
public static final int le_formulas2_offset = 3248;
public static final int le_formulas3_offset = 3448;
@ -1135,7 +1137,7 @@ public class Fields {
public static final Field ETBCONTROLPIN2 = Field.create("ETBCONTROLPIN2", 868, FieldType.INT, brain_pin_e);
public static final Field ELECTRONICTHROTTLEPIN1MODE = Field.create("ELECTRONICTHROTTLEPIN1MODE", 872, FieldType.INT, pin_output_mode_e);
public static final Field WBOHEATERPIN = Field.create("WBOHEATERPIN", 876, FieldType.INT, brain_pin_e);
public static final Field UNUSED3 = Field.create("UNUSED3", 880, FieldType.INT);
public static final Field CJ125CSPIN = Field.create("CJ125CSPIN", 880, FieldType.INT, brain_pin_e);
public static final Field FUELLEVELEMPTYTANKVOLTAGE = Field.create("FUELLEVELEMPTYTANKVOLTAGE", 884, FieldType.FLOAT);
public static final Field FUELLEVELFULLTANKVOLTAGE = Field.create("FUELLEVELFULLTANKVOLTAGE", 888, FieldType.FLOAT);
public static final String[] ego_sensor_e = {"BPSX", "Innovate", "14Point7", "Narrow", "PLX"};
@ -1474,6 +1476,8 @@ public class Fields {
public static final Field ALTERNATORPWMFREQUENCY = Field.create("ALTERNATORPWMFREQUENCY", 2472, FieldType.INT);
public static final String[] mass_storage_e = {"Auto", "Always", "Never"};
public static final Field STORAGEMODE = Field.create("STORAGEMODE", 2476, FieldType.INT, mass_storage_e);
public static final Field CJ125SPIDEVICE = Field.create("CJ125SPIDEVICE", 2480, FieldType.INT);
public static final Field CJ125CSPINMODE = Field.create("CJ125CSPINMODE", 2484, FieldType.INT, pin_output_mode_e);
public static final Field LE_FORMULAS1 = Field.create("LE_FORMULAS1", 3048, FieldType.INT);
public static final Field LE_FORMULAS2 = Field.create("LE_FORMULAS2", 3248, FieldType.INT);
public static final Field LE_FORMULAS3 = Field.create("LE_FORMULAS3", 3448, FieldType.INT);