2019-01-03 21:22:35 -08:00
|
|
|
/*
|
|
|
|
* @file HIP9011_logic.cpp
|
|
|
|
*
|
|
|
|
* Created on: Jan 3, 2019
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "HIP9011_logic.h"
|
|
|
|
|
2019-01-03 21:51:32 -08:00
|
|
|
EXTERN_ENGINE;
|
|
|
|
|
2019-01-03 21:22:35 -08:00
|
|
|
HIP9011::HIP9011() {
|
|
|
|
needToInit = true;
|
|
|
|
state = NOT_READY;
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:51:32 -08:00
|
|
|
#define BAND(bore) (900 / (PIF * (bore) / 2))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return frequency band we are interested in
|
|
|
|
*/
|
|
|
|
float getHIP9011Band(DEFINE_HIP_PARAMS) {
|
|
|
|
return GET_CONFIG_VALUE(knockBandCustom) == 0 ?
|
|
|
|
BAND(GET_CONFIG_VALUE(cylinderBore)) : GET_CONFIG_VALUE(knockBandCustom);
|
|
|
|
}
|
2019-01-04 06:24:23 -08:00
|
|
|
|
|
|
|
int getBandIndex(DEFINE_HIP_PARAMS) {
|
|
|
|
float freq = getHIP9011Band(FORWARD_HIP_PARAMS);
|
|
|
|
return getHip9011BandIndex(freq);
|
|
|
|
}
|
|
|
|
|