reducing magic constants

This commit is contained in:
rusefillc 2022-01-27 17:39:24 -05:00
parent a73f5559dc
commit 1cf898e6e2
3 changed files with 19 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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 }