diff --git a/firmware/chibios/os/various/chprintf.c b/firmware/chibios/os/various/chprintf.c index 8848c6bd02..af19e6da74 100644 --- a/firmware/chibios/os/various/chprintf.c +++ b/firmware/chibios/os/various/chprintf.c @@ -271,7 +271,9 @@ unsigned_common: chSequentialStreamPut(chp, (uint8_t)filler); } while (++width != 0); } - chSequentialStreamWrite(chp, (uint8_t*)s, i); + if (i > 0) { + chSequentialStreamWrite(chp, (uint8_t*)s, i); + } s += i; while (width) { diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index c1c65d28fe..b64e37734d 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -18,6 +18,15 @@ #define EFI_USE_CCM TRUE +/** + * if you have a 60-2 trigger, or if you just want better performance, you + * probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE + * CH_DBG_ENABLE_CHECKS + * CH_DBG_ENABLE_ASSERTS + * CH_DBG_ENABLE_TRACE + * in chconf.h + * + */ #define EFI_ENABLE_ASSERTS TRUE #ifndef EFI_ENABLE_ASSERTS diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index 19f624bbde..5f6a573745 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -25,7 +25,7 @@ static Logging *logger; static SimplePwm alternatorControl; static OutputPin alternatorPin; -static Pid altPid(10, 0, 0, 10, 90); +static Pid altPid(10, 0, 0, 1, 90); static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE); diff --git a/firmware/util/efilib.cpp b/firmware/util/efilib.cpp index 89cbfeb561..b14d0536f9 100644 --- a/firmware/util/efilib.cpp +++ b/firmware/util/efilib.cpp @@ -55,6 +55,18 @@ uint32_t efiStrlen(const char *param) { return (s - param); } +char * efiTrim(char *param) { + while (param[0] == ' ') { + param++; // that would skip leading spaces + } + int len = efiStrlen(param); + while (len > 0 && param[len - 1] == ' ') { + param[len - 1] = 0; + len--; + } + return param; +} + bool startsWith(const char *line, const char *prefix) { uint32_t len = efiStrlen(prefix); if (efiStrlen(line) < len) { @@ -177,7 +189,6 @@ int efiPow10(int param) { return 10 * efiPow10(10 - 1); } - /** * string to float * @return NAN in case of invalid string @@ -257,7 +268,7 @@ void printHistogram(Logging *logging, histogram_s *histogram) { appendMsgPrefix(logging); appendPrintf(logging, "histogram %s *", histogram->name); for (int i = 0; i < len; i++) - appendPrintf(logging, "%d ", report[i]); + appendPrintf(logging, "%d ", report[i]); appendPrintf(logging, "*"); appendMsgPostfix(logging); scheduleLogging(logging); diff --git a/firmware/util/efilib.h b/firmware/util/efilib.h index 4a84c7bdd4..2e06c2cb50 100644 --- a/firmware/util/efilib.h +++ b/firmware/util/efilib.h @@ -35,6 +35,7 @@ extern "C" { #endif /* __cplusplus */ +char * efiTrim(char *param); uint32_t efiStrlen(const char *param); int efiPow10(int param); bool startsWith(const char *line, const char *prefix); @@ -47,7 +48,6 @@ int atoi(const char *string); */ #define cisnan(f) (*(((int*) (&f))) == 0x7FC00000) - int absI(int32_t value); float absF(float value); float efiRound(float value, float precision);