diff --git a/firmware/config/efifeatures.h b/firmware/config/efifeatures.h index 45bf8b40ed..4521af82b1 100644 --- a/firmware/config/efifeatures.h +++ b/firmware/config/efifeatures.h @@ -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 diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 1555a043f3..2101bdb567 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -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; } diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 9cd7b56200..e14d735774 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -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; diff --git a/firmware/util/cli_registry.c b/firmware/util/cli_registry.c index 5a1f0ee2b3..cf001487fe 100644 --- a/firmware/util/cli_registry.c +++ b/firmware/util/cli_registry.c @@ -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; } } diff --git a/firmware/util/cli_registry.h b/firmware/util/cli_registry.h index b5977430ed..9c4e33421d 100644 --- a/firmware/util/cli_registry.h +++ b/firmware/util/cli_registry.h @@ -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);