auto-sync
This commit is contained in:
parent
f93cc56c1f
commit
457248ccf2
|
@ -55,8 +55,6 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "rusefi_outputs.h"
|
#include "rusefi_outputs.h"
|
||||||
|
|
||||||
extern float knockVolts;
|
|
||||||
|
|
||||||
extern bool_t main_loop_started;
|
extern bool_t main_loop_started;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
|
@ -187,7 +185,7 @@ static void printSensors(Logging *log, bool fileFormat) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
reportSensorF(log, fileFormat, "ks", "count", engine->knockCount, 0);
|
reportSensorF(log, fileFormat, "ks", "count", engine->knockCount, 0);
|
||||||
reportSensorF(log, fileFormat, "kv", "v", knockVolts, 2);
|
reportSensorF(log, fileFormat, "kv", "v", engine->knockVolts, 2);
|
||||||
|
|
||||||
|
|
||||||
// reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2);
|
// reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2);
|
||||||
|
@ -595,7 +593,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
|
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
|
||||||
tsOutputChannels->pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_F);
|
tsOutputChannels->pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_F);
|
||||||
tsOutputChannels->knockCount = engine->knockCount;
|
tsOutputChannels->knockCount = engine->knockCount;
|
||||||
tsOutputChannels->knockLevel = knockVolts;
|
tsOutputChannels->knockLevel = engine->knockVolts;
|
||||||
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
||||||
tsOutputChannels->fuelLevel = engine->engineState.fuelLevel;
|
tsOutputChannels->fuelLevel = engine->engineState.fuelLevel;
|
||||||
tsOutputChannels->hasFatalError = hasFirmwareError();
|
tsOutputChannels->hasFatalError = hasFirmwareError();
|
||||||
|
|
|
@ -85,6 +85,8 @@ Engine::Engine(persistent_config_s *config) {
|
||||||
knockEver = false;
|
knockEver = false;
|
||||||
knockCount = 0;
|
knockCount = 0;
|
||||||
knockDebug = false;
|
knockDebug = false;
|
||||||
|
knockVolts = 0;
|
||||||
|
|
||||||
timeOfLastKnockEvent = 0;
|
timeOfLastKnockEvent = 0;
|
||||||
injectorLagMs = fuelMs = 0;
|
injectorLagMs = fuelMs = 0;
|
||||||
clutchDownState = clutchUpState = false;
|
clutchDownState = clutchUpState = false;
|
||||||
|
@ -144,6 +146,7 @@ void Engine::printKnockState(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::knockLogic(float knockVolts) {
|
void Engine::knockLogic(float knockVolts) {
|
||||||
|
this->knockVolts = knockVolts;
|
||||||
knockNow = knockVolts > engineConfiguration->knockVThreshold;
|
knockNow = knockVolts > engineConfiguration->knockVThreshold;
|
||||||
/**
|
/**
|
||||||
* KnockCount is directly proportional to the degrees of ignition
|
* KnockCount is directly proportional to the degrees of ignition
|
||||||
|
|
|
@ -211,6 +211,8 @@ public:
|
||||||
*/
|
*/
|
||||||
int knockCount;
|
int knockCount;
|
||||||
|
|
||||||
|
float knockVolts;
|
||||||
|
|
||||||
bool_t knockDebug;
|
bool_t knockDebug;
|
||||||
|
|
||||||
efitimeus_t timeOfLastKnockEvent;
|
efitimeus_t timeOfLastKnockEvent;
|
||||||
|
|
|
@ -33,8 +33,6 @@ static MenuItem ROOT(NULL, NULL);
|
||||||
|
|
||||||
static MenuTree tree(&ROOT);
|
static MenuTree tree(&ROOT);
|
||||||
|
|
||||||
extern float knockVolts; // todo: nicer getter
|
|
||||||
|
|
||||||
static MenuItem miRpm(tree.root, LL_RPM);
|
static MenuItem miRpm(tree.root, LL_RPM);
|
||||||
static MenuItem miSensors(tree.root, "sensors");
|
static MenuItem miSensors(tree.root, "sensors");
|
||||||
static MenuItem miBench(tree.root, "bench test");
|
static MenuItem miBench(tree.root, "bench test");
|
||||||
|
@ -239,7 +237,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
||||||
return;
|
return;
|
||||||
case LL_KNOCK:
|
case LL_KNOCK:
|
||||||
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, buffer);
|
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, buffer);
|
||||||
lcdPrintf("Knock %s %fv", buffer, knockVolts);
|
lcdPrintf("Knock %s %fv", buffer, engine->knockVolts);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
||||||
|
|
|
@ -58,8 +58,6 @@ static int settingUpdateCount = 0;
|
||||||
static int totalKnockEventsCount = 0;
|
static int totalKnockEventsCount = 0;
|
||||||
static int currentPrescaler;
|
static int currentPrescaler;
|
||||||
static float hipValueMax = 0;
|
static float hipValueMax = 0;
|
||||||
// todo: move this to engine state
|
|
||||||
float knockVolts = 0;
|
|
||||||
static int spiCount = 0;
|
static int spiCount = 0;
|
||||||
|
|
||||||
static unsigned char tx_buff[1];
|
static unsigned char tx_buff[1];
|
||||||
|
@ -150,7 +148,7 @@ static void showHipInfo(void) {
|
||||||
scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount);
|
scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount);
|
||||||
|
|
||||||
scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f spiCount=%d adv=%d",
|
scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f spiCount=%d adv=%d",
|
||||||
knockVolts,
|
engine->knockVolts,
|
||||||
getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
|
getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
|
||||||
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, pinNameBuffer),
|
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, pinNameBuffer),
|
||||||
hipValueMax,
|
hipValueMax,
|
||||||
|
@ -274,9 +272,9 @@ void hipAdcCallback(adcsample_t value) {
|
||||||
if (state == WAITING_FOR_ADC_TO_SKIP) {
|
if (state == WAITING_FOR_ADC_TO_SKIP) {
|
||||||
state = WAITING_FOR_RESULT_ADC;
|
state = WAITING_FOR_RESULT_ADC;
|
||||||
} else if (state == WAITING_FOR_RESULT_ADC) {
|
} else if (state == WAITING_FOR_RESULT_ADC) {
|
||||||
knockVolts = adcToVoltsDivided(value);
|
engine->knockVolts = adcToVoltsDivided(value);
|
||||||
hipValueMax = maxF(knockVolts, hipValueMax);
|
hipValueMax = maxF(engine->knockVolts, hipValueMax);
|
||||||
engine->knockLogic(knockVolts);
|
engine->knockLogic(engine->knockVolts);
|
||||||
|
|
||||||
float angleWindowWidth =
|
float angleWindowWidth =
|
||||||
engineConfiguration->knockDetectionWindowEnd - engineConfiguration->knockDetectionWindowStart;
|
engineConfiguration->knockDetectionWindowEnd - engineConfiguration->knockDetectionWindowStart;
|
||||||
|
|
Loading…
Reference in New Issue