static void showHipInfo(void) { if (!CONFIGB(isHip9011Enabled)) { scheduleMsg(logger, "hip9011 driver not active"); return; } printSpiState(logger, boardConfiguration); scheduleMsg(logger, "enabled=%s state=%s bore=%.2fmm freq=%.2fkHz PaSDO=%d", boolToString(CONFIGB(isHip9011Enabled)), getHip_state_e(instance.state), engineConfiguration->cylinderBore, getHIP9011Band(PASS_HIP_PARAMS), engineConfiguration->hip9011PrescalerAndSDO); char *outputName = getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, hipPinNameBuffer); scheduleMsg(logger, "band_index=%d gain %.2f/index=%d output=%s", instance.currentBandIndex, engineConfiguration->hip9011Gain, instance.currentGainIndex, outputName); scheduleMsg(logger, "integrator index=%d knockVThreshold=%.2f knockCount=%d maxKnockSubDeg=%.2f", instance.currentIntergratorIndex, engineConfiguration->knockVThreshold, engine->knockCount, engineConfiguration->maxKnockSubDeg); const char * msg = instance.invalidHip9011ResponsesCount > 0 ? "NOT GOOD" : "ok"; scheduleMsg(logger, "spi=%s IntHold@%s/%d response count=%d incorrect response=%d %s", getSpi_device_e(engineConfiguration->hip9011SpiDevice), hwPortname(CONFIGB(hip9011IntHoldPin)), CONFIGB(hip9011IntHoldPinMode), instance.correctResponsesCount, instance.invalidHip9011ResponsesCount, msg); scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(CONFIGB(hip9011CsPin)), instance.settingUpdateCount); #if EFI_PROD_CODE scheduleMsg(logger, "hip %.2fv/last=%.2f@%s/max=%.2f adv=%d", engine->knockVolts, getVoltage("hipinfo", engineConfiguration->hipOutputChannel), getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer), hipValueMax, CONFIGB(useTpicAdvancedMode)); scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(engineConfiguration->hip9011SpiDevice))); scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice))); scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice))); #endif /* EFI_PROD_CODE */ scheduleMsg(logger, "start %.2f end %.2f", engineConfiguration->knockDetectionWindowStart, engineConfiguration->knockDetectionWindowEnd); hipValueMax = 0; engine->printKnockState(); }
static void addChannel(const char *name, adc_channel_e setting, adc_channel_mode_e mode) { if (setting == EFI_ADC_NONE) { return; } if (adcHwChannelEnabled[setting] != ADC_OFF) { getPinNameByAdcChannel(name, setting, errorMsgBuff); firmwareError(CUSTOM_ERR_ADC_USED, "ADC mapping error: input %s for %s already used by %s?", errorMsgBuff, name, adcHwChannelUsage[setting]); } adcHwChannelUsage[setting] = name; adcHwChannelEnabled[setting] = mode; }
static void printTemperatureInfo(void) { printThermistor("CLT", &engineConfiguration2->clt); printThermistor("IAT", &engineConfiguration2->iat); float rClt = getResistance(&engineConfiguration2->clt); float rIat = getResistance(&engineConfiguration2->iat); #if EFI_PROD_CODE int cltChannel = engineConfiguration2->clt.channel; scheduleMsg(&logger, "CLT R=%f on channel %d@%s", rClt, cltChannel, getPinNameByAdcChannel(cltChannel, pinNameBuffer)); int iatChannel = engineConfiguration2->iat.channel; scheduleMsg(&logger, "IAT R=%f on channel %d@%s", rIat, iatChannel, getPinNameByAdcChannel(iatChannel, pinNameBuffer)); scheduleMsg(&logger, "cranking fuel %fms @ %fC", engineConfiguration->crankingSettings.fuelAtMinTempMs, engineConfiguration->crankingSettings.coolantTempMinC); scheduleMsg(&logger, "cranking fuel %fms @ %fC", engineConfiguration->crankingSettings.fuelAtMaxTempMs, engineConfiguration->crankingSettings.coolantTempMaxC); #endif }
static void printThermistor(char *msg, Thermistor *thermistor) { int adcChannel = thermistor->channel; float voltage = getVoltageDivided(adcChannel); float r = getResistance(thermistor); float t = getTemperatureC(thermistor); scheduleMsg(&logger, "%s v=%f C=%f R=%f on channel %d", msg, voltage, t, r, adcChannel); scheduleMsg(&logger, "bias=%f A=%f B=%f C=%f", thermistor->config->bias_resistor, thermistor->config->s_h_a, thermistor->config->s_h_b, thermistor->config->s_h_c); #if EFI_PROD_CODE scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(adcChannel, pinNameBuffer)); #endif }
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage, float dividerCoeff) { #if HAL_USE_ADC || defined(__DOXYGEN__) if (hwChannel == EFI_ADC_NONE) { scheduleMsg(&logger, "ADC is not assigned for %s", name); return; } if (fastAdc.isHwUsed(hwChannel)) { scheduleMsg(&logger, "fast enabled=%s", boolToString(boardConfiguration->isFastAdcEnabled)); } float voltage = adcVoltage * dividerCoeff; scheduleMsg(&logger, "%s ADC%d %s %s adc=%f/input=%fv/divider=%f", name, hwChannel, getAdcMode(hwChannel), getPinNameByAdcChannel(name, hwChannel, pinNameBuffer), adcVoltage, voltage, dividerCoeff); #endif }
static void printThermistor(const char *msg, ThermistorConf *config, ThermistorMath *tm) { thermistor_curve_s * curve = &tm->curve; adc_channel_e adcChannel = config->adcChannel; float voltage = getVoltageDivided("term", adcChannel); float r = getResistance(config); float t = getTemperatureC(config, tm); thermistor_conf_s *tc = &config->config; scheduleMsg(&logger, "%s volts=%f Celsius=%f sensorR=%f on channel %d", msg, voltage, t, r, adcChannel); scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(adcChannel, pinNameBuffer)); scheduleMsg(&logger, "C=%f/R=%f C=%f/R=%f C=%f/R=%f", tc->tempC_1, tc->resistance_1, tc->tempC_2, tc->resistance_2, tc->tempC_3, tc->resistance_3); scheduleMsg(&logger, "bias resistor=%fK A=%..100000f B=%..100000f C=%..100000f", tc->bias_resistor / 1000, curve->s_h_a, curve->s_h_b, curve->s_h_c); scheduleMsg(&logger, "=============================="); }
static void showHipInfo(void) { if (!boardConfiguration->isHip9011Enabled) { scheduleMsg(logger, "hip9011 driver not active"); return; } printSpiState(logger, boardConfiguration); scheduleMsg(logger, "enabled=%s state=%d bore=%fmm freq=%fkHz PaSDO=%d", boolToString(boardConfiguration->isHip9011Enabled), state, engineConfiguration->cylinderBore, getBand(), engineConfiguration->hip9011PrescalerAndSDO); scheduleMsg(logger, "band_index=%d gain %f/index=%d", currentBandIndex, boardConfiguration->hip9011Gain, currentGainIndex); scheduleMsg(logger, "integrator index=%d knockVThreshold=%f knockCount=%d maxKnockSubDeg=%f", currentIntergratorIndex, engineConfiguration->knockVThreshold, engine->knockCount, engineConfiguration->maxKnockSubDeg); scheduleMsg(logger, "spi=%s IntHold@%s response count=%d incorrect response=%d", getSpi_device_e(hipSpiDevice), hwPortname(boardConfiguration->hip9011IntHoldPin), correctResponse, invalidResponse); scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount); scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f spiCount=%d adv=%d", engine->knockVolts, getVoltage("hipinfo", engineConfiguration->hipOutputChannel), getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer), hipValueMax, spiCount, boardConfiguration->useTpicAdvancedMode); scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(hipSpiDevice))); scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(hipSpiDevice))); scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(hipSpiDevice))); scheduleMsg(logger, "start %f end %f", engineConfiguration->knockDetectionWindowStart, engineConfiguration->knockDetectionWindowEnd); hipValueMax = 0; engine->printKnockState(); }
static void showEthInfo(void) { static char pinNameBuffer[16]; scheduleMsg(&logger, "etbAutoTune=%d", engine->etbAutoTune); scheduleMsg(&logger, "throttlePedal=%.2f %.2f/%.2f @%s", getPedalPosition(), engineConfiguration->throttlePedalUpVoltage, engineConfiguration->throttlePedalWOTVoltage, getPinNameByAdcChannel("tPedal", engineConfiguration->throttlePedalPositionAdcChannel, pinNameBuffer)); scheduleMsg(&logger, "TPS=%.2f", getTPS()); scheduleMsg(&logger, "dir=%d DC=%f", etb1.dcMotor.isOpenDirection(), etb1.dcMotor.Get()); scheduleMsg(&logger, "etbControlPin1=%s duty=%.2f freq=%d", hwPortname(CONFIGB(etb1.controlPin1)), currentEtbDuty, engineConfiguration->etbFreq); scheduleMsg(&logger, "close dir=%s", hwPortname(CONFIGB(etb1.directionPin2))); pid.showPidStatus(&logger, "ETB"); }
static void showLine(lcd_line_e line, int screenY) { static char buffer[10]; switch (line) { case LL_VERSION: lcdPrintf("version %s", VCS_VERSION); return; case LL_CONFIG: lcdPrintf("config %s", getConfigurationName(engineConfiguration->engineType)); return; case LL_RPM: lcdPrintf("RPM %d", getRpmE(engine)); { char sdState; if (boardConfiguration->isSdCardEnabled) { sdState = isSdCardAlive() ? 'L' : 'n'; } else { sdState = 'D'; } int seconds = getTimeNowSeconds(); if (seconds < 10000) { lcdPrintf(" %d%c", seconds, sdState); } } return; case LL_CLT_TEMPERATURE: lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_F)); return; case LL_IAT_TEMPERATURE: lcdPrintf("Intake Air %f", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F)); return; case LL_ALGORITHM: lcdPrintf(getEngine_load_mode_e(engineConfiguration->algorithm)); return; case LL_INJECTION: lcdPrintf(getInjection_mode_e(engineConfiguration->injectionMode)); return; case LL_ING_FLOW: lcdPrintf("Inj %fcc", engineConfiguration->injector.flow); return; case LL_IGNITION: lcdPrintf(getIgnition_mode_e(engineConfiguration->ignitionMode)); return; case LL_TPS: getPinNameByAdcChannel(engineConfiguration->tpsAdcChannel, buffer); lcdPrintf("Throttle %s %f%%", buffer, getTPS()); return; case LL_VBATT: lcdPrintf("Battery %fv", getVBatt(PASS_ENGINE_PARAMETER_F)); return; case LL_KNOCK: getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, buffer); lcdPrintf("Knock %s %fv", buffer, engine->knockVolts); return; #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) case LL_BARO: if (hasBaroSensor()) { lcdPrintf("Baro: %f", getBaroPressure()); } else { lcdPrintf("Baro: none"); } return; #endif case LL_AFR: if (engineConfiguration->hasAfrSensor) { lcdPrintf("AFR: %f", getAfr()); } else { lcdPrintf("AFR: none"); } return; case LL_MAP: if (engineConfiguration->hasMapSensor) { lcdPrintf("MAP %f", getMap()); } else { lcdPrintf("MAP: none"); } return; case LL_MAF_V: if (hasMafSensor()) { lcdPrintf("MAF: %fv", getMaf()); } else { lcdPrintf("MAF: none"); } return; case LL_MAF_KG_HR: if (hasMafSensor()) { lcdPrintf("MAF: %f kg/hr", getRealMaf()); } else { lcdPrintf("MAF: none"); } return; case LL_TRIGGER_ERRORS: lcdPrintf("Errors"); return; case LL_TRIGGER_DUTY: lcdPrintf("Duty"); return; default: lcdPrintf("()"); } }
// todo: move this logic somewhere else? static void getKnockInfo(void) { adc_channel_e hwChannel = engineConfiguration->externalKnockSenseAdc; scheduleMsg(&logger, "externalKnockSenseAdc on ADC", getPinNameByAdcChannel("knock", hwChannel, pinNameBuffer)); engine->printKnockState(); }