This commit is contained in:
rusefi 2019-01-04 09:24:23 -05:00
parent 3183930513
commit d7fefe5979
4 changed files with 13 additions and 5 deletions

View File

@ -282,11 +282,6 @@ static void endOfSpiExchange(SPIDriver *spip) {
checkResponse();
}
static int getBandIndex(void) {
float freq = getHIP9011Band(PASS_HIP_PARAMS);
return getHip9011BandIndex(freq);
}
static void sendCommand(hip_state_e s, unsigned char cmd) {
instance.state = s;
tx_buff[0] = cmd;

View File

@ -23,3 +23,9 @@ float getHIP9011Band(DEFINE_HIP_PARAMS) {
return GET_CONFIG_VALUE(knockBandCustom) == 0 ?
BAND(GET_CONFIG_VALUE(cylinderBore)) : GET_CONFIG_VALUE(knockBandCustom);
}
int getBandIndex(DEFINE_HIP_PARAMS) {
float freq = getHIP9011Band(FORWARD_HIP_PARAMS);
return getHip9011BandIndex(freq);
}

View File

@ -42,11 +42,15 @@ public:
#define PASS_HIP_PARAMS
#define DEFINE_HIP_PARAMS
#define GET_CONFIG_VALUE(x) CONFIG(x)
#define FORWARD_HIP_PARAMS
#else
#define PASS_HIP_PARAMS CONFIG(knockBandCustom), \
CONFIG(cylinderBore)
#define FORWARD_HIP_PARAMS knockBandCustom, \
cylinderBore
#define DEFINE_HIP_PARAMS float knockBandCustom,\
float cylinderBore
@ -55,5 +59,6 @@ public:
float getHIP9011Band(DEFINE_HIP_PARAMS);
int getBandIndex(DEFINE_HIP_PARAMS);
#endif /* HW_LAYER_HIP9011_LOGIC_H_ */

View File

@ -35,4 +35,6 @@ TEST(hip9011, band) {
EXPECT_FLOAT_EQ(3, getHIP9011Band(/* knockBandCustom*/3, /*cylinderBore*/76));
EXPECT_FLOAT_EQ(7.5389242, getHIP9011Band(/* knockBandCustom*/0, /*cylinderBore*/76));
EXPECT_EQ(42, getBandIndex(/* knockBandCustom*/0, /*cylinderBore*/76));
}