hip9011: types, some comments
This commit is contained in:
parent
2a8207ec58
commit
8ec850c4da
|
@ -413,8 +413,12 @@ static int hip_init() {
|
|||
}
|
||||
|
||||
#if EFI_HIP_9011_DEBUG
|
||||
/* reset error counter now */
|
||||
/* reset counters now */
|
||||
instance.correctResponsesCount = 0;
|
||||
instance.invalidResponsesCount = 0;
|
||||
instance.samples = 0;
|
||||
instance.overrun = 0;
|
||||
instance.unsync = 0;
|
||||
#endif
|
||||
|
||||
instance.state = READY_TO_INTEGRATE;
|
||||
|
@ -598,8 +602,14 @@ static void showHipInfo() {
|
|||
return;
|
||||
}
|
||||
|
||||
efiPrintf("HIP9011: enabled %s state %s",
|
||||
boolToString(engineConfiguration->isHip9011Enabled),
|
||||
efiPrintf("HIP9011: enabled %s",
|
||||
boolToString(engineConfiguration->isHip9011Enabled));
|
||||
|
||||
if (!engineConfiguration->isHip9011Enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
efiPrintf(" State %s",
|
||||
hip_state_names[instance.state]);
|
||||
|
||||
efiPrintf(" Advanced mode: enabled %d used %d",
|
||||
|
|
|
@ -116,7 +116,7 @@ float HIP9011::getRpmByAngleWindowAndTimeUs(int timeUs, float p_angleWindowWidth
|
|||
* '60000000' because revolutions per MINUTE in uS conversion
|
||||
*/
|
||||
float windowWidthMult = p_angleWindowWidth / 360.0f;
|
||||
return 60000000.0f / integrationTimeUs * windowWidthMult;
|
||||
return (60.0f * 1000.0f * 1000.0f) / integrationTimeUs * windowWidthMult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,7 @@ void HIP9011::prepareRpmLookup(void) {
|
|||
}
|
||||
|
||||
int HIP9011::getIntegrationIndexByRpm(float rpm) {
|
||||
int i = findIndexMsg("getIbR", rpmLookup, INT_LOOKUP_SIZE, (rpm));
|
||||
int i = findIndexMsg("getIbR", rpmLookup, INT_LOOKUP_SIZE, (uint16_t)(rpm));
|
||||
return i == -1 ? INT_LOOKUP_SIZE - 1 : INT_LOOKUP_SIZE - i - 1;
|
||||
}
|
||||
|
||||
|
@ -159,10 +159,10 @@ void HIP9011::handleSettings(int rpm DEFINE_PARAM_SUFFIX(DEFINE_HIP_PARAMS)) {
|
|||
|
||||
setAngleWindowWidth(FORWARD_HIP_PARAMS);
|
||||
|
||||
int new_prescaler = GET_CONFIG_VALUE(hip9011Prescaler);
|
||||
int new_integratorIdx = getIntegrationIndexByRpm(rpm);
|
||||
int new_gainIdx = getGainIndex(FORWARD_HIP_PARAMS);
|
||||
int new_bandIdx = getBandIndex(FORWARD_HIP_PARAMS);
|
||||
uint8_t new_prescaler = GET_CONFIG_VALUE(hip9011Prescaler);
|
||||
uint8_t new_integratorIdx = getIntegrationIndexByRpm(rpm);
|
||||
uint8_t new_gainIdx = getGainIndex(FORWARD_HIP_PARAMS);
|
||||
uint8_t new_bandIdx = getBandIndex(FORWARD_HIP_PARAMS);
|
||||
|
||||
if (gainIdx != new_gainIdx) {
|
||||
ret = sendCommand(SET_GAIN_CMD(new_gainIdx));
|
||||
|
|
|
@ -119,9 +119,10 @@ public:
|
|||
hip_state_e state;
|
||||
int8_t cylinderNumber = -1;
|
||||
int8_t expectedCylinderNumber = -1;
|
||||
int rawValue[HIP_INPUT_CHANNELS];
|
||||
uint16_t rawValue[HIP_INPUT_CHANNELS];
|
||||
|
||||
float rpmLookup[INT_LOOKUP_SIZE];
|
||||
/* No need to have float accuracity, 65535 RPM is reasonable limit */
|
||||
uint16_t rpmLookup[INT_LOOKUP_SIZE];
|
||||
|
||||
// Timestamp of the last sensed event
|
||||
efitick_t knockSampleTimestamp = 0;
|
||||
|
@ -131,7 +132,7 @@ public:
|
|||
int correctResponsesCount = 0;
|
||||
int invalidResponsesCount = 0;
|
||||
|
||||
/* counters */
|
||||
/* logic error counters */
|
||||
int samples = 0;
|
||||
int overrun = 0;
|
||||
int unsync = 0;
|
||||
|
|
Loading…
Reference in New Issue