From 1cf898e6e288ccf858114dbd2e20e254e1d3fb91 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 27 Jan 2022 17:39:24 -0500 Subject: [PATCH] reducing magic constants --- firmware/console/binary/tunerstudio_outputs.h | 15 --------------- firmware/controllers/algo/rusefi_enums.h | 18 ++++++++++++++++++ firmware/tunerstudio/rusefi.input | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/firmware/console/binary/tunerstudio_outputs.h b/firmware/console/binary/tunerstudio_outputs.h index a67f6ce87b..13165e6944 100644 --- a/firmware/console/binary/tunerstudio_outputs.h +++ b/firmware/console/binary/tunerstudio_outputs.h @@ -20,21 +20,6 @@ #define WITH_TS_STATE TRUE #endif -enum class TsCalMode : uint8_t { - None = 0, - Tps1Max = 1, - Tps1Min = 2, - EtbKp = 3, - EtbKi = 4, - EtbKd = 5, - Tps1SecondaryMax = 6, - Tps1SecondaryMin = 7, - Tps2Max = 8, - Tps2Min = 9, - Tps2SecondaryMax = 10, - Tps2SecondaryMin = 11, -}; - /** * todo https://github.com/rusefi/rusefi/issues/197 * three locations have to be changed manually diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 1096b6c126..9126492686 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -667,3 +667,21 @@ typedef enum __attribute__ ((__packed__)) { HPFP_CAM_IN2 = 3, HPFP_CAM_EX2 = 4, } hpfp_cam_e; + + +#if __cplusplus +enum class TsCalMode : uint8_t { + None = 0, + Tps1Max = 1, + Tps1Min = 2, + EtbKp = 3, + EtbKi = 4, + EtbKd = 5, + Tps1SecondaryMax = 6, + Tps1SecondaryMin = 7, + Tps2Max = 8, + Tps2Min = 9, + Tps2SecondaryMax = 10, + Tps2SecondaryMin = 11, +}; +#endif // __cplusplus diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 698c4046b0..4b87a6dabc 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -239,7 +239,7 @@ enable2ndByteCanID = false ; TPS 1 Primary maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax } - maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin } + maintainConstantValue = tpsMin, { (calibrationMode == @@TsCalMode_Tps1Min@@ ) ? calibrationValue : tpsMin } ; TPS 1 Secondary maintainConstantValue = tps1SecondaryMax, { (calibrationMode == 6 ) ? calibrationValue : tps1SecondaryMax }