diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 5471a5bcba..f5afb753fe 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -221,7 +221,7 @@ static void printInfo(systime_t nowSeconds) { } timeOfPreviousPrintVersion = nowSeconds; appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION, - getConfigurationName(engineConfiguration), + getConfigurationName(engineConfiguration->engineType), DELIMETER); #if EFI_PROD_CODE printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]); diff --git a/firmware/controllers/algo/algo.mk b/firmware/controllers/algo/algo.mk index d5930ee80e..6134d64b17 100644 --- a/firmware/controllers/algo/algo.mk +++ b/firmware/controllers/algo/algo.mk @@ -13,5 +13,6 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/OutputSignalArray.cpp $(PROJECT_DIR)/controllers/algo/engine_configuration.cpp \ $(PROJECT_DIR)/controllers/algo/engine.cpp \ $(PROJECT_DIR)/controllers/algo/event_registry.cpp \ - $(PROJECT_DIR)/controllers/algo/algo.cpp + $(PROJECT_DIR)/controllers/algo/algo.cpp \ + $(PROJECT_DIR)/controllers/algo/enum_strings.cpp diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 90c2e8a72f..293113e0d6 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -428,7 +428,6 @@ typedef struct { extern "C" { #endif /* __cplusplus */ -const char* getConfigurationName(engine_configuration_s *engineConfiguration); void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration); void setWholeFuelMap(engine_configuration_s *engineConfiguration, float value); void setConstantDwell(engine_configuration_s *engineConfiguration, float dwellMs); diff --git a/firmware/controllers/algo/enum_strings.cpp b/firmware/controllers/algo/enum_strings.cpp new file mode 100644 index 0000000000..393db29898 --- /dev/null +++ b/firmware/controllers/algo/enum_strings.cpp @@ -0,0 +1,84 @@ +/** + * @file enum_strings.cpp + * + * Maybe we will figure out a way to auto-generate this file? + * + * @date Sep 4, 2014 + * @author Andrey Belomutskiy, (c) 2012-2014 + */ + +#include "main.h" +#include "enum_strings.h" +#include "error_handling.h" + + +const char* getConfigurationName(engine_type_e engineType) { + switch (engineType) { +#if EFI_SUPPORT_DODGE_NEON + case DODGE_NEON_1995: + return "Dodge Neon"; +#endif /* EFI_SUPPORT_DODGE_NEON */ +#if EFI_SUPPORT_FORD_ASPIRE + case FORD_ASPIRE_1996: + return "Ford Aspire"; +#endif /* EFI_SUPPORT_FORD_ASPIRE */ +#if EFI_SUPPORT_FORD_FIESTA + case FORD_FIESTA: + return "Ford Fiesta"; +#endif /* EFI_SUPPORT_FORD_FIESTA */ +#if EFI_SUPPORT_NISSAN_PRIMERA + case NISSAN_PRIMERA: + return "Nissan Primera"; +#endif /* EFI_SUPPORT_NISSAN_PRIMERA */ + case HONDA_ACCORD_CD: + return "Honda Accord 3w"; + case HONDA_ACCORD_CD_TWO_WIRES: + return "Honda Accord 2w"; + case HONDA_ACCORD_CD_DIP: + return "Honda Dip"; + case FORD_INLINE_6_1995: + return "Ford 1995 inline 6"; + case GY6_139QMB: + return "Gy6 139qmb"; + case MAZDA_MIATA_NB: + return "Mazda Miata NB"; + case MAZDA_323: + return "Mazda 323"; + case SATURN_ION_2004: + return "Saturn Ion"; + case MINI_COOPER_R50: + return "Mini Cooper R50"; + case FORD_ESCORT_GT: + return "Ford Escort GT"; + case CITROEN_TU3JP: + return "Citroen TU3JP"; + case ROVER_V8: + return "Rover v8"; + case MITSU_4G93: + return "Mitsu 4G93"; + case MIATA_1990: + return "Miata 1990"; + case MIATA_1994: + return "Miata 1994"; + case MIATA_1996: + return "Miata 1996"; + default: + firmwareError("Unexpected: engineType %d", engineType); + return NULL; + } +} + +const char * pinModeToString(pin_output_mode_e mode) { + switch (mode) { + case OM_DEFAULT: + return "default"; + case OM_INVERTED: + return "inverted"; + case OM_OPENDRAIN: + return "open drain"; + case OM_OPENDRAIN_INVERTED: + return "open drain inverted"; + default: + return "unexpected"; + } +} diff --git a/firmware/controllers/algo/enum_strings.h b/firmware/controllers/algo/enum_strings.h new file mode 100644 index 0000000000..5e52694cfd --- /dev/null +++ b/firmware/controllers/algo/enum_strings.h @@ -0,0 +1,16 @@ +/** + * @file enum_strings.h + * + * @date Sep 4, 2014 + * @author Andrey Belomutskiy, (c) 2012-2014 + */ + +#ifndef ENUM_STRINGS_H_ +#define ENUM_STRINGS_H_ + +#include "rusefi_enums.h" + +const char* getConfigurationName(engine_type_e engineType); +const char * pinModeToString(pin_output_mode_e mode); + +#endif /* ENUM_STRINGS_H_ */ diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index f0f47484d4..06733b9fa5 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -54,61 +54,6 @@ void printFloatArray(const char *prefix, float array[], int size) { scheduleLogging(&logger); } -const char* getConfigurationName(engine_configuration_s *engineConfiguration) { - switch (engineConfiguration->engineType) { -#if EFI_SUPPORT_DODGE_NEON - case DODGE_NEON_1995: - return "Dodge Neon"; -#endif /* EFI_SUPPORT_DODGE_NEON */ -#if EFI_SUPPORT_FORD_ASPIRE - case FORD_ASPIRE_1996: - return "Ford Aspire"; -#endif /* EFI_SUPPORT_FORD_ASPIRE */ -#if EFI_SUPPORT_FORD_FIESTA - case FORD_FIESTA: - return "Ford Fiesta"; -#endif /* EFI_SUPPORT_FORD_FIESTA */ -#if EFI_SUPPORT_NISSAN_PRIMERA - case NISSAN_PRIMERA: - return "Nissan Primera"; -#endif /* EFI_SUPPORT_NISSAN_PRIMERA */ - case HONDA_ACCORD_CD: - return "Honda Accord 3w"; - case HONDA_ACCORD_CD_TWO_WIRES: - return "Honda Accord 2w"; - case HONDA_ACCORD_CD_DIP: - return "Honda Dip"; - case FORD_INLINE_6_1995: - return "Ford 1995 inline 6"; - case GY6_139QMB: - return "Gy6 139qmb"; - case MAZDA_MIATA_NB: - return "Mazda Miata NB"; - case MAZDA_323: - return "Mazda 323"; - case SATURN_ION_2004: - return "Saturn Ion"; - case MINI_COOPER_R50: - return "Mini Cooper R50"; - case FORD_ESCORT_GT: - return "Ford Escort GT"; - case CITROEN_TU3JP: - return "Citroen TU3JP"; - case ROVER_V8: - return "Rover v8"; - case MITSU_4G93: - return "Mitsu 4G93"; - case MIATA_1990: - return "Miata 1990"; - case MIATA_1994: - return "Miata 1994"; - case MIATA_1996: - return "Miata 1996"; - default: - firmwareError("Unexpected: engineType %d", engineConfiguration->engineType); - return NULL; - } -} extern board_configuration_s *boardConfiguration; @@ -117,7 +62,7 @@ extern board_configuration_s *boardConfiguration; */ void printConfiguration(engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2) { - scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration), + scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType); scheduleMsg(&logger, "configurationVersion=%d", getGlobalConfigurationVersion()); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 1f8f62322e..a6dba5fea8 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -183,7 +183,7 @@ static void triggerShapeInfo() { static void triggerInfo() { #if EFI_PROD_CODE || EFI_SIMULATOR - scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration), + scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType); scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0), diff --git a/firmware/emulation/trigger_emulator.cpp b/firmware/emulation/trigger_emulator.cpp index 0abe5ed07a..27d47e7663 100644 --- a/firmware/emulation/trigger_emulator.cpp +++ b/firmware/emulation/trigger_emulator.cpp @@ -71,7 +71,7 @@ static void emulatorApplyPinState(PwmConfig *state, int stateIndex) { void initTriggerEmulator(void) { #if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) - print("Emulating %s\r\n", getConfigurationName(engineConfiguration)); + print("Emulating %s\r\n", getConfigurationName(engineConfiguration->engineType)); triggerSignal.outputPins[0] = TRIGGER_EMULATOR_PRIMARY; triggerSignal.outputPins[1] = TRIGGER_EMULATOR_SECONDARY; diff --git a/firmware/hw_layer/pin_repository.c b/firmware/hw_layer/pin_repository.c index 616a130164..4365f3276a 100644 --- a/firmware/hw_layer/pin_repository.c +++ b/firmware/hw_layer/pin_repository.c @@ -102,21 +102,6 @@ brain_pin_e parseBrainPin(const char *str) { return basePin + pin; } -const char * pinModeToString(pin_output_mode_e mode) { - switch (mode) { - case OM_DEFAULT: - return "default"; - case OM_INVERTED: - return "inverted"; - case OM_OPENDRAIN: - return "open drain"; - case OM_OPENDRAIN_INVERTED: - return "open drain inverted"; - default: - return "unexpected"; - } -} - char *hwPortname(brain_pin_e brainPin) { if (brainPin == GPIO_INVALID) { return "INVALID"; diff --git a/firmware/hw_layer/pin_repository.h b/firmware/hw_layer/pin_repository.h index aaf7bf5458..0079d82126 100644 --- a/firmware/hw_layer/pin_repository.h +++ b/firmware/hw_layer/pin_repository.h @@ -24,7 +24,6 @@ extern "C" void initPinRepository(void); char *hwPortname(brain_pin_e brainPin); -const char * pinModeToString(pin_output_mode_e mode); brain_pin_e parseBrainPin(const char *str); void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode); char *portname(GPIO_TypeDef* GPIOx); diff --git a/firmware/main.h b/firmware/main.h index d56f738481..700576f07f 100644 --- a/firmware/main.h +++ b/firmware/main.h @@ -26,6 +26,7 @@ extern "C" #include "efitime.h" #include "boards.h" #include "rusefi_enums.h" +#include "enum_strings.h" #include "datalogging.h" #include "chprintf.h"