auto-sync

This commit is contained in:
rusEfi 2014-09-17 15:03:04 -05:00
parent 53fb1b7779
commit d5a8802cc9
5 changed files with 30 additions and 3 deletions

View File

@ -65,6 +65,10 @@
//#define EFI_POTENTIOMETER FALSE
#define EFI_POTENTIOMETER TRUE
#define EFI_MAX_31855 TRUE
#define EFI_HIP_9011 FALSE
#define EFI_INTERNAL_ADC TRUE
#define EFI_DENSO_ADC FALSE

View File

@ -272,6 +272,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
*/
boardConfiguration->triggerSimulatorFrequency = 1200;
boardConfiguration->max31855spiDevice = SPI_NONE;
for (int i = 0; i < MAX31855_CS_COUNT; i++) {
boardConfiguration->max31855_cs[i] = GPIO_NONE;
}

View File

@ -195,6 +195,9 @@ typedef struct {
unsigned int isEngineControlEnabled : 1; // bit 5
brain_pin_e logicAnalyzerPins[LOGIC_ANALYZER_CHANNEL_COUNT];
/**
* default or inverted input
*/
uint8_t logicAnalyzerMode[LOGIC_ANALYZER_CHANNEL_COUNT];
int unrealisticRpmThreashold;
@ -203,7 +206,9 @@ typedef struct {
brain_pin_e max31855_cs[MAX31855_CS_COUNT];
int unusedbs[92];
spi_device_e max31855spiDevice;
int unusedbs[91];
} board_configuration_s;

View File

@ -43,6 +43,11 @@ static void doAddAction(const char *token, int type, Void callback, void *param)
current->token = token;
current->parameterType = type;
current->callback = callback;
current->param = param;
}
void addConsoleActionP(const char *token, VoidPtr callback, void *param) {
doAddAction(token, NO_PARAMETER_P, (Void) callback, param);
}
/**
@ -93,6 +98,7 @@ void addConsoleActionFF(const char *token, VoidFloatFloat callback) {
static int getParameterCount(action_type_e parameterType) {
switch (parameterType) {
case NO_PARAMETER:
case NO_PARAMETER_P:
return 0;
case ONE_PARAMETER:
case FLOAT_PARAMETER:
@ -373,8 +379,12 @@ static bool handleConsoleLineInternal(char *line, int lineLength) {
for (int i = 0; i < consoleActionCount; i++) {
TokenCallback *current = &consoleActions[i];
if (strEqual(line, current->token)) {
// invoke callback function by reference
(*current->callback)();
if (current->parameterType == NO_PARAMETER) {
(*current->callback)();
} else if (current->parameterType == NO_PARAMETER_P) {
VoidPtr cb = (VoidPtr) current->callback;
(*cb)(current->param);
}
return true;
}
}

View File

@ -18,6 +18,7 @@ extern "C"
typedef enum {
NO_PARAMETER,
NO_PARAMETER_P,
ONE_PARAMETER,
FLOAT_PARAMETER,
STRING_PARAMETER,
@ -32,12 +33,16 @@ typedef struct {
const char *token;
action_type_e parameterType;
void (*callback)(void);
void *param;
} TokenCallback;
//void addDefaultConsoleActions(void);
//void handleActionWithParameter(TokenCallback *current, char *parameter);
int tokenLength(const char *msgp);
typedef void (*VoidPtr)(void*);
typedef void (*Void)(void);
typedef void (*VoidInt)(int);
typedef void (*VoidFloat)(float);
@ -56,6 +61,8 @@ void helpCommand(void);
void initConsoleLogic(void);
void handleConsoleLine(char *line);
void addConsoleAction(const char *token, Void callback);
void addConsoleActionP(const char *token, VoidPtr callback, void *param);
void addConsoleActionI(const char *token, VoidInt callback);
void addConsoleActionII(const char *token, VoidIntInt callback);
void addConsoleActionF(const char *token, VoidFloat callback);