auto-sync
This commit is contained in:
parent
e51d477f6d
commit
09f09380a3
|
@ -248,7 +248,6 @@ void initEngineContoller(void) {
|
|||
return;
|
||||
initLogging(&logger, "Engine Controller");
|
||||
|
||||
engine.engineConfiguration = engineConfiguration;
|
||||
|
||||
initSensors();
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ void printFloatArray(const char *prefix, float array[], int size) {
|
|||
scheduleLogging(&logger);
|
||||
}
|
||||
|
||||
|
||||
extern board_configuration_s *boardConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -259,12 +258,14 @@ static void printMAPInfo(void) {
|
|||
scheduleMsg(&logger, "map type=%d raw=%f MAP=%f", engineConfiguration->map.sensor.sensorType, getRawMap(),
|
||||
getMap());
|
||||
if (engineConfiguration->map.sensor.sensorType == MT_CUSTOM) {
|
||||
scheduleMsg(&logger, "at0=%f at5=%f", engineConfiguration->map.sensor.customValueAt0, engineConfiguration->map.sensor.customValueAt5);
|
||||
scheduleMsg(&logger, "at0=%f at5=%f", engineConfiguration->map.sensor.customValueAt0,
|
||||
engineConfiguration->map.sensor.customValueAt5);
|
||||
}
|
||||
|
||||
scheduleMsg(&logger, "baro type=%d value=%f", engineConfiguration->baroSensor.sensorType, getBaroPressure());
|
||||
if (engineConfiguration->baroSensor.sensorType == MT_CUSTOM) {
|
||||
scheduleMsg(&logger, "min=%f max=%f", engineConfiguration->baroSensor.customValueAt0, engineConfiguration->baroSensor.customValueAt5);
|
||||
scheduleMsg(&logger, "min=%f max=%f", engineConfiguration->baroSensor.customValueAt0,
|
||||
engineConfiguration->baroSensor.customValueAt5);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -401,6 +402,14 @@ static void setGlobalFuelCorrection(float value) {
|
|||
engineConfiguration->globalFuelCorrection = value;
|
||||
}
|
||||
|
||||
static void setCltBias(float value) {
|
||||
engineConfiguration->cltThermistorConf.bias_resistor = value;
|
||||
}
|
||||
|
||||
static void setIatBias(float value) {
|
||||
engineConfiguration->iatThermistorConf.bias_resistor = value;
|
||||
}
|
||||
|
||||
static void setVBattDivider(float value) {
|
||||
engineConfiguration->vbattDividerCoeff = value;
|
||||
}
|
||||
|
@ -700,6 +709,9 @@ void initSettings(void) {
|
|||
|
||||
addConsoleActionF("set_vbatt_divider", setVBattDivider);
|
||||
|
||||
addConsoleActionF("set_clt_bias", setCltBias);
|
||||
addConsoleActionF("set_iat_bias", setIatBias);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
addConsoleActionSS("set_injection_pin", setInjectionPin);
|
||||
addConsoleActionSS("set_ignition_pin", setIgnitionPin);
|
||||
|
|
|
@ -134,6 +134,7 @@ static void sendI2Cbyte(int addr, int data) {
|
|||
|
||||
void initHardware(Logging *logger, Engine *engine) {
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
efiAssertVoid(engineConfiguration!=NULL, "engineConfiguration");
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
printMsg(logger, "initHardware()");
|
||||
|
@ -155,8 +156,9 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
*/
|
||||
initPrimaryPins();
|
||||
|
||||
if (hasFirmwareError())
|
||||
if (hasFirmwareError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
initDataStructures(engineConfiguration);
|
||||
|
||||
|
@ -182,8 +184,9 @@ void initHardware(Logging *logger, Engine *engine) {
|
|||
resetConfigurationExt(logger, engineConfiguration->engineType, engineConfiguration, engineConfiguration2, boardConfiguration);
|
||||
#endif /* EFI_INTERNAL_FLASH */
|
||||
|
||||
if (hasFirmwareError())
|
||||
if (hasFirmwareError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mySetPadMode("board test", getHwPort(boardConfiguration->boardTestModeJumperPin),
|
||||
getHwPin(boardConfiguration->boardTestModeJumperPin), PAL_MODE_INPUT_PULLUP);
|
||||
|
|
|
@ -140,7 +140,7 @@ static void outputPinRegisterExt(const char *msg, io_pin_e ioPin, GPIO_TypeDef *
|
|||
GPIO_TypeDef * getHwPort(brain_pin_e brainPin) {
|
||||
if (brainPin == GPIO_NONE)
|
||||
return GPIO_NULL ;
|
||||
if (brainPin > GPIO_NONE) {
|
||||
if (brainPin > GPIO_NONE || brainPin < 0) {
|
||||
firmwareError("Invalid brain_pin_e: %d", brainPin);
|
||||
return GPIO_NULL ;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ GPIO_TypeDef * getHwPort(brain_pin_e brainPin) {
|
|||
ioportmask_t getHwPin(brain_pin_e brainPin) {
|
||||
if (brainPin == GPIO_NONE)
|
||||
return EFI_ERROR_CODE;
|
||||
if (brainPin > GPIO_NONE) {
|
||||
if (brainPin > GPIO_NONE || brainPin < 0) {
|
||||
firmwareError("Invalid brain_pin_e: %d", brainPin);
|
||||
return EFI_ERROR_CODE;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,23 @@ MMCDriver MMCD1;
|
|||
|
||||
// Peripherial Clock 42MHz SPI2 SPI3
|
||||
// Peripherial Clock 84MHz SPI1 SPI1 SPI2/3
|
||||
#define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) // 42 MHz 21 MHZ
#define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) // 21 MHz 10.5 MHz
#define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) // 10.5 MHz 5.25 MHz
#define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) // 5.25 MHz 2.626 MHz
#define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) // 2.626 MHz 1.3125 MHz
#define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) // 1.3125 MHz 656.25 KHz
#define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) // 656.25 KHz 328.125 KHz
#define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) // 328.125 KHz 164.06 KHz
static SPIConfig hs_spicfg = { NULL, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN,
|
||||
// 42 MHz 21 MHZ
|
||||
#define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000)
|
||||
// 21 MHz 10.5 MHz
|
||||
#define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008)
|
||||
// 10.5 MHz 5.25 MHz
|
||||
#define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010)
|
||||
// 5.25 MHz 2.626 MHz
|
||||
#define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018)
|
||||
// 2.626 MHz 1.3125 MHz
|
||||
#define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020)
|
||||
// 1.3125 MHz 656.25 KHz
|
||||
#define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028)
|
||||
// 656.25 KHz 328.125 KHz
|
||||
#define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030)
|
||||
// 328.125 KHz 164.06 KHz
|
||||
#define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038)
|
||||
static SPIConfig hs_spicfg = { NULL, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN,
|
||||
SPI_BaudRatePrescaler_8 };
|
||||
static SPIConfig ls_spicfg = { NULL, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN,
|
||||
SPI_BaudRatePrescaler_256 };
|
||||
|
|
|
@ -119,6 +119,7 @@ int main_loop_started = FALSE;
|
|||
static MemoryStream firmwareErrorMessageStream;
|
||||
uint8_t errorMessageBuffer[200];
|
||||
static bool hasFirmwareErrorFlag = FALSE;
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
extern board_configuration_s *boardConfiguration;
|
||||
extern Engine engine;
|
||||
|
||||
|
@ -129,6 +130,10 @@ char *getFirmwareError(void) {
|
|||
void runRusEfi(void) {
|
||||
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
||||
|
||||
// that's dirty, this assignment should be nicer or in a better spot
|
||||
engine.engineConfiguration = engineConfiguration;
|
||||
|
||||
|
||||
initErrorHandling();
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue