From 9cd4327788c3ae45aeb1b6d95f0703392ed938c5 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 11 Sep 2014 08:02:51 -0500 Subject: [PATCH] auto-sync --- .../tunerstudio/tunerstudio_configuration.h | 3 +- firmware/controllers/settings.cpp | 29 +++++++++++++++++++ firmware/hw_layer/mmc_card.c | 5 ++-- firmware/hw_layer/mmc_card.h | 2 +- firmware/rusefi.cpp | 2 +- firmware/util/cli_registry.c | 9 ++++-- firmware/util/cli_registry.h | 5 ++-- 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/firmware/console/tunerstudio/tunerstudio_configuration.h b/firmware/console/tunerstudio/tunerstudio_configuration.h index 7653e7725d..7eb0fe9ffb 100644 --- a/firmware/console/tunerstudio/tunerstudio_configuration.h +++ b/firmware/console/tunerstudio/tunerstudio_configuration.h @@ -18,8 +18,7 @@ /** - * please be aware that current "stable" version of TunerStudio does not - * support 'float' (F32) type. You would need a beta version to handle floats + * please be aware that 'float' (F32) type requires TunerStudio version 2.6 and later */ typedef struct { // primary instrument cluster gauges diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 4bbba94ef3..3333b63266 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -591,6 +591,32 @@ static void setSpiMode(int index, bool mode) { scheduleMsg(&logger, "spi %d mode: %s", index, boolToString(mode)); } +static void enableOrDisable(const char *param, bool isEnabled) { + if (strEqualCaseInsensitive(param, "fastadc")) { + boardConfiguration->isFastAdcEnabled = isEnabled; + } else if (strEqualCaseInsensitive(param, "injection")) { + engineConfiguration->isInjectionEnabled = isEnabled; + } else if (strEqualCaseInsensitive(param, "ignition")) { + engineConfiguration->isIgnitionEnabled = isEnabled; + } else if (strEqualCaseInsensitive(param, "self_stimulation")) { + engineConfiguration->directSelfStimulation = isEnabled; + } else if (strEqualCaseInsensitive(param, "engine_control")) { + boardConfiguration->isEngineControlEnabled = isEnabled; + } else { + scheduleMsg(&logger, "unexpected [%s]", param); + return; // well, MISRA would not like this 'return' here :( + } + scheduleMsg(&logger, "[%s] %s", param, isEnabled ? "enabled" : "disabled"); +} + +static void enable(const char *param) { + enableOrDisable(param, true); +} + +static void disable(const char *param) { + enableOrDisable(param, false); +} + static void enableSpi(int index) { setSpiMode(index, true); } @@ -704,6 +730,9 @@ void initSettings(void) { addConsoleActionI("enable_spi", enableSpi); addConsoleActionI("disable_spi", disableSpi); + addConsoleActionS("enable", enable); + addConsoleActionS("disable", disable); + addConsoleActionII("set_toothed_wheel", setToothedWheel); addConsoleActionI("set_trigger_type", setTriggerType); diff --git a/firmware/hw_layer/mmc_card.c b/firmware/hw_layer/mmc_card.c index 8e9557464c..d0e1960e9d 100644 --- a/firmware/hw_layer/mmc_card.c +++ b/firmware/hw_layer/mmc_card.c @@ -120,7 +120,8 @@ static void createLogFile(void) { unlockSpi(); } -static void ff_cmd_dir(char *path) { +static void ff_cmd_dir(const char *pathx) { + char *path = (char *)pathx; // todo: fix this hack! DIR dir; FILINFO fno; char *fn; @@ -168,7 +169,7 @@ static int errorReported = FALSE; // this is used to report the error only once /** * @brief Appends specified line to the current log file */ -void appendToLog(char *line) { +void appendToLog(const char *line) { UINT bytesWrited; if (!fs_ready) { diff --git a/firmware/hw_layer/mmc_card.h b/firmware/hw_layer/mmc_card.h index 13106e4d61..dd74c6de33 100644 --- a/firmware/hw_layer/mmc_card.h +++ b/firmware/hw_layer/mmc_card.h @@ -17,7 +17,7 @@ extern "C" void initMmcCard(void); bool isSdCardAlive(void); -void appendToLog(char *line); +void appendToLog(const char *line); #ifdef __cplusplus } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 8db79cd6b5..fa5a610246 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -235,5 +235,5 @@ void firmwareError(const char *fmt, ...) { } int getRusEfiVersion(void) { - return 20140910; + return 20140911; } diff --git a/firmware/util/cli_registry.c b/firmware/util/cli_registry.c index 6952d96ae8..4328436f5c 100644 --- a/firmware/util/cli_registry.c +++ b/firmware/util/cli_registry.c @@ -279,7 +279,12 @@ int tokenLength(const char *msgp) { return result; } -int strEqual(const char *str1, const char *str2) { +bool strEqualCaseInsensitive(const char *str1, const char *str2) { + // todo: actual implementation! + return strEqual(str1, str2); +} + +bool strEqual(const char *str1, const char *str2) { // todo: there must be a standard function?! int len1 = strlen(str1); int len2 = strlen(str2); @@ -289,7 +294,7 @@ int strEqual(const char *str1, const char *str2) { for (int i = 0; i < len1; i++) if (str1[i] != str2[i]) return false; - return TRUE; + return true; } void initConsoleLogic() { diff --git a/firmware/util/cli_registry.h b/firmware/util/cli_registry.h index 2f06662389..ca87092c39 100644 --- a/firmware/util/cli_registry.h +++ b/firmware/util/cli_registry.h @@ -43,13 +43,14 @@ typedef void (*VoidInt)(int); typedef void (*VoidFloat)(float); typedef void (*VoidFloatFloat)(float, float); typedef void (*VoidIntInt)(int, int); -typedef void (*VoidCharPtr)(char *); +typedef void (*VoidCharPtr)(const char *); typedef void (*VoidCharPtrCharPtr)(const char *, const char *); typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *); typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *); char *validateSecureLine(char *line); -int strEqual(const char *str1, const char *str2); +bool strEqualCaseInsensitive(const char *str1, const char *str2); +bool strEqual(const char *str1, const char *str2); void resetConsoleActions(void); void helpCommand(void); void initConsoleLogic(void);