mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
4ff60bd476
commit
e51d477f6d
|
@ -58,6 +58,11 @@ extern board_configuration_s *boardConfiguration;
|
||||||
persistent_config_container_s persistentState CCM_OPTIONAL
|
persistent_config_container_s persistentState CCM_OPTIONAL
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo: it really looks like these fields should become 'static', i.e. private
|
||||||
|
* the whole 'extern ...' pattern is less then perfect, I guess the 'God object' Engine
|
||||||
|
* would be a smaller evil. Whatever is needed should be passed into methods/modules/files as an explicit parameter.
|
||||||
|
*/
|
||||||
engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
|
engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
|
||||||
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
|
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
|
||||||
|
|
||||||
|
@ -79,6 +84,9 @@ static configuration_s cfg = { &persistentState.persistentConfiguration.engineCo
|
||||||
|
|
||||||
configuration_s * configuration = &cfg;
|
configuration_s * configuration = &cfg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo: this should probably become 'static', i.e. private, and propagated around explicitly?
|
||||||
|
*/
|
||||||
Engine engine;
|
Engine engine;
|
||||||
|
|
||||||
static msg_t csThread(void) {
|
static msg_t csThread(void) {
|
||||||
|
|
|
@ -219,7 +219,7 @@ float getTriggerDutyCycle(int index) {
|
||||||
return triggerCentral.triggerState.getTriggerDutyCycle(index);
|
return triggerCentral.triggerState.getTriggerDutyCycle(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTriggerCentral(void) {
|
void initTriggerCentral(Engine *engine) {
|
||||||
strcpy((char*) shaft_signal_msg_index, "_");
|
strcpy((char*) shaft_signal_msg_index, "_");
|
||||||
|
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
|
|
|
@ -16,6 +16,7 @@ typedef void (*ShaftPositionListener)(trigger_event_e signal, int index, void *a
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "ec2.h"
|
#include "ec2.h"
|
||||||
|
#include "engine.h"
|
||||||
|
|
||||||
#define HW_EVENT_TYPES 6
|
#define HW_EVENT_TYPES 6
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ uint64_t getCrankEventCounter(void);
|
||||||
uint64_t getStartOfRevolutionIndex(void);
|
uint64_t getStartOfRevolutionIndex(void);
|
||||||
void hwHandleShaftSignal(trigger_event_e signal);
|
void hwHandleShaftSignal(trigger_event_e signal);
|
||||||
float getTriggerDutyCycle(int index);
|
float getTriggerDutyCycle(int index);
|
||||||
void initTriggerCentral(void);
|
void initTriggerCentral(Engine *engine);
|
||||||
void printAllCallbacksHistogram(void);
|
void printAllCallbacksHistogram(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -39,9 +39,7 @@
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "ec2.h"
|
#include "ec2.h"
|
||||||
|
|
||||||
extern engine_configuration_s *engineConfiguration;
|
|
||||||
extern engine_configuration2_s * engineConfiguration2;
|
extern engine_configuration2_s * engineConfiguration2;
|
||||||
extern board_configuration_s *boardConfiguration;
|
|
||||||
|
|
||||||
static bool isSpiInitialized[5] = { false, false, false, false, false };
|
static bool isSpiInitialized[5] = { false, false, false, false, false };
|
||||||
|
|
||||||
|
@ -103,7 +101,7 @@ void turnOnSpi(spi_device_e device) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSpiModules(void) {
|
static void initSpiModules(board_configuration_s *boardConfiguration) {
|
||||||
if (boardConfiguration->is_enabled_spi_2) {
|
if (boardConfiguration->is_enabled_spi_2) {
|
||||||
turnOnSpi(SPI_DEVICE_2);
|
turnOnSpi(SPI_DEVICE_2);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +132,10 @@ static void sendI2Cbyte(int addr, int data) {
|
||||||
// i2cReleaseBus(&I2CD1);
|
// i2cReleaseBus(&I2CD1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initHardware(Logging *logger) {
|
void initHardware(Logging *logger, Engine *engine) {
|
||||||
|
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||||
|
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||||
|
|
||||||
printMsg(logger, "initHardware()");
|
printMsg(logger, "initHardware()");
|
||||||
// todo: enable protection. it's disabled because it takes
|
// todo: enable protection. it's disabled because it takes
|
||||||
// 10 extra seconds to re-flash the chip
|
// 10 extra seconds to re-flash the chip
|
||||||
|
@ -211,13 +212,13 @@ void initHardware(Logging *logger) {
|
||||||
// requestAdcValue(&adcState, 0);
|
// requestAdcValue(&adcState, 0);
|
||||||
|
|
||||||
// todo: figure out better startup logic
|
// todo: figure out better startup logic
|
||||||
initTriggerCentral();
|
initTriggerCentral(engine);
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
initShaftPositionInputCapture();
|
initShaftPositionInputCapture();
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
|
||||||
initSpiModules();
|
initSpiModules(boardConfiguration);
|
||||||
|
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING
|
||||||
initMmcCard();
|
initMmcCard();
|
||||||
|
|
|
@ -25,6 +25,9 @@ void unlockSpi(void);
|
||||||
|
|
||||||
#define GET_BOARD_TEST_MODE_VALUE() (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin)))
|
#define GET_BOARD_TEST_MODE_VALUE() (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin)))
|
||||||
|
|
||||||
void initHardware(Logging *logging);
|
#ifdef __cplusplus
|
||||||
|
#include "engine.h"
|
||||||
|
void initHardware(Logging *logging, Engine *engine);
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* HARDWARE_H_ */
|
#endif /* HARDWARE_H_ */
|
||||||
|
|
|
@ -120,6 +120,7 @@ static MemoryStream firmwareErrorMessageStream;
|
||||||
uint8_t errorMessageBuffer[200];
|
uint8_t errorMessageBuffer[200];
|
||||||
static bool hasFirmwareErrorFlag = FALSE;
|
static bool hasFirmwareErrorFlag = FALSE;
|
||||||
extern board_configuration_s *boardConfiguration;
|
extern board_configuration_s *boardConfiguration;
|
||||||
|
extern Engine engine;
|
||||||
|
|
||||||
char *getFirmwareError(void) {
|
char *getFirmwareError(void) {
|
||||||
return (char*)errorMessageBuffer;
|
return (char*)errorMessageBuffer;
|
||||||
|
@ -146,7 +147,7 @@ void runRusEfi(void) {
|
||||||
/**
|
/**
|
||||||
* Initialize hardware drivers
|
* Initialize hardware drivers
|
||||||
*/
|
*/
|
||||||
initHardware(&logging);
|
initHardware(&logging, &engine);
|
||||||
|
|
||||||
initStatusLoop();
|
initStatusLoop();
|
||||||
/**
|
/**
|
||||||
|
@ -229,5 +230,5 @@ void firmwareError(const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRusEfiVersion(void) {
|
int getRusEfiVersion(void) {
|
||||||
return 20140907;
|
return 20140908;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ void rusEfiFunctionalTest(void) {
|
||||||
|
|
||||||
initMainEventListener(&engine, engineConfiguration2);
|
initMainEventListener(&engine, engineConfiguration2);
|
||||||
|
|
||||||
initTriggerCentral();
|
initTriggerCentral(&engine);
|
||||||
|
|
||||||
startStatusThreads();
|
startStatusThreads();
|
||||||
startTunerStudioConnectivity();
|
startTunerStudioConnectivity();
|
||||||
|
|
Loading…
Reference in New Issue