explicit precision control
This commit is contained in:
rusefi 2018-01-23 12:05:14 -05:00
parent bcf3ed8f2d
commit adfe5e9274
45 changed files with 184 additions and 184 deletions

View File

@ -503,33 +503,33 @@ static void showFuelInfo2(float rpm, float engineLoad) {
float magicAir = getCylinderAirMass(engineConfiguration, 1, 100, convertCelsiusToKelvin(20));
scheduleMsg(&logger, "SD magic fuel %f", sdMath(engineConfiguration, magicAir, 14.7));
scheduleMsg(&logger, "inj flow %fcc/min displacement %fL", engineConfiguration->injector.flow,
scheduleMsg(&logger, "SD magic fuel %.2f", sdMath(engineConfiguration, magicAir, 14.7));
scheduleMsg(&logger, "inj flow %.2fcc/min displacement %.2fL", engineConfiguration->injector.flow,
engineConfiguration->specs.displacement);
scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->fuelAlgorithm),
boolToString(enginePins.fuelPumpRelay.getLogicValue()));
scheduleMsg(&logger2, "injection phase=%f/global fuel correction=%f", getinjectionOffset(rpm), engineConfiguration->globalFuelCorrection);
scheduleMsg(&logger2, "injection phase=%.2f/global fuel correction=%.2f", getinjectionOffset(rpm), engineConfiguration->globalFuelCorrection);
scheduleMsg(&logger2, "baro correction=%f", engine->engineState.baroCorrection);
scheduleMsg(&logger2, "baro correction=%.2f", engine->engineState.baroCorrection);
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
scheduleMsg(&logger, "base cranking fuel %f", engineConfiguration->cranking.baseFuel);
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE));
scheduleMsg(&logger, "base cranking fuel %.2f", engineConfiguration->cranking.baseFuel);
scheduleMsg(&logger2, "cranking fuel: %.2f", getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE));
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) {
float iatCorrection = engine->engineState.iatFuelCorrection;
float cltCorrection = engine->engineState.cltFuelCorrection;
floatms_t injectorLag = engine->engineState.injectorLag;
scheduleMsg(&logger2, "rpm=%f engineLoad=%f", rpm, engineLoad);
scheduleMsg(&logger2, "baseFuel=%f", baseFuelMs);
scheduleMsg(&logger2, "rpm=%.2f engineLoad=%.2f", rpm, engineLoad);
scheduleMsg(&logger2, "baseFuel=%.2f", baseFuelMs);
scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection,
scheduleMsg(&logger2, "iatCorrection=%.2f cltCorrection=%.2f injectorLag=%.2f", iatCorrection, cltCorrection,
injectorLag);
float value = getRunningFuel(baseFuelMs PASS_ENGINE_PARAMETER_SUFFIX);
scheduleMsg(&logger2, "injection pulse width: %f", value);
scheduleMsg(&logger2, "injection pulse width: %.2f", value);
}
#endif
}

View File

@ -203,13 +203,13 @@ static void accelInfo() {
if (logger == NULL)
return;
// scheduleMsg(logger, "EL accel length=%d", mapInstance.cb.getSize());
scheduleMsg(logger, "EL accel th=%f/mult=%f", engineConfiguration->engineLoadAccelEnrichmentThreshold, engineConfiguration->engineLoadAccelEnrichmentMultiplier);
scheduleMsg(logger, "EL decel th=%f/mult=%f", engineConfiguration->engineLoadDecelEnleanmentThreshold, engineConfiguration->engineLoadDecelEnleanmentMultiplier);
scheduleMsg(logger, "EL accel th=%.2f/mult=%.2f", engineConfiguration->engineLoadAccelEnrichmentThreshold, engineConfiguration->engineLoadAccelEnrichmentMultiplier);
scheduleMsg(logger, "EL decel th=%.2f/mult=%.2f", engineConfiguration->engineLoadDecelEnleanmentThreshold, engineConfiguration->engineLoadDecelEnleanmentMultiplier);
// scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize());
scheduleMsg(logger, "TPS accel th=%f/mult=%f", engineConfiguration->tpsAccelEnrichmentThreshold, -1);
scheduleMsg(logger, "TPS accel th=%.2f/mult=%.2f", engineConfiguration->tpsAccelEnrichmentThreshold, -1);
scheduleMsg(logger, "added to wall=%f/sucked=%f", engineConfiguration->addedToWallCoef, engineConfiguration->suckedOffCoef);
scheduleMsg(logger, "added to wall=%.2f/sucked=%.2f", engineConfiguration->addedToWallCoef, engineConfiguration->suckedOffCoef);
}
void setEngineLoadAccelThr(float value) {

View File

@ -83,7 +83,7 @@ static msg_t auxPidThread(int param) {
percent_t pwm = auxPid.getValue(targetValue, value);
if (engineConfiguration->isVerboseAuxPid1) {
scheduleMsg(logger, "aux duty: %f/value=%f/p=%f/i=%f/d=%f int=%f", pwm, value,
scheduleMsg(logger, "aux duty: %.2f/value=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", pwm, value,
auxPid.getP(), auxPid.getI(), auxPid.getD(), auxPid.getIntegration());
}

View File

@ -47,7 +47,7 @@ MockAdcState::MockAdcState() {
#if EFI_ENABLE_MOCK_ADC || EFI_SIMULATOR
void MockAdcState::setMockVoltage(int hwChannel, float voltage) {
scheduleMsg(&logger, "fake voltage: channel %d value %f", hwChannel, voltage);
scheduleMsg(&logger, "fake voltage: channel %d value %.2f", hwChannel, voltage);
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
hasMockAdc[hwChannel] = true;
@ -483,7 +483,7 @@ void StartupFuelPumping::setPumpsCounter(int newValue) {
pumpsCounter = newValue;
if (pumpsCounter == PUMPS_TO_PRIME) {
scheduleMsg(&logger, "let's squirt prime pulse %f", pumpsCounter);
scheduleMsg(&logger, "let's squirt prime pulse %.2f", pumpsCounter);
pumpsCounter = 0;
} else {
scheduleMsg(&logger, "setPumpsCounter %d", pumpsCounter);

View File

@ -106,7 +106,7 @@ angle_t getinjectionOffset(float rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
angle_t value = fuelPhaseMap.getValue(rpm, engineLoad);
if (cisnan(value)) {
firmwareError(CUSTOM_ERR_ASSERT, "inj offset#1 %f %f", rpm, engineLoad);
firmwareError(CUSTOM_ERR_ASSERT, "inj offset#1 %.2f %.2f", rpm, engineLoad);
return 0;
}
efiAssert(!cisnan(value), "inj offset#1", 0);
@ -167,7 +167,7 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
fuelPerCycle = getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX);
efiAssert(!cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("baseFuel=%f fuelPerCycle=%f \t\n",
printf("baseFuel=%.2f fuelPerCycle=%.2f \t\n",
baseFuel, fuelPerCycle);
#endif /*EFI_PRINTF_FUEL_DETAILS */
}
@ -206,7 +206,7 @@ floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
*/
floatms_t getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (cisnan(vBatt)) {
warning(OBD_System_Voltage_Malfunction, "vBatt=%f", vBatt);
warning(OBD_System_Voltage_Malfunction, "vBatt=%.2f", vBatt);
return 0;
}
float vBattCorrection = interpolate2d("lag", vBatt, INJECTOR_LAG_CURVE);

View File

@ -52,10 +52,10 @@ static int adjustCell(int i, int j, void (*callback)(int, float, float)) {
if (value < TARGET_MIN_AFR) {
float currentMult = adjustments.values[i][j];
// printf("adj %d %d. cur=%f\r\n", i, j, currentMult);
// printf("adj %d %d. cur=%.2f\r\n", i, j, currentMult);
float newValue = maxF(0.1, MULT_STEP_DOWN * currentMult);
adjustments.values[i][j] = newValue;
// printf("adj %d %d. new=%f\r\n", i, j, adjustments.values[i][j]);
// printf("adj %d %d. new=%.2f\r\n", i, j, adjustments.values[i][j]);
if (callback != NULL)
callback(MAX_RPM * i / AVG_TAB_SIZE, 1.0 * MAX_KEY * j / AVG_TAB_SIZE, newValue);
return 1;

View File

@ -96,7 +96,7 @@ static msg_t AltCtrlThread(int param) {
currentAltDuty = altPid.getValue(targetVoltage, vBatt);
if (boardConfiguration->isVerboseAlternator) {
scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, vBatt,
scheduleMsg(logger, "alt duty: %.2f/vbatt=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", currentAltDuty, vBatt,
altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration());
}
@ -113,15 +113,15 @@ void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled),
hwPortname(boardConfiguration->alternatorControlPin),
engineConfiguration->alternatorControl.period);
scheduleMsg(logger, "p=%f/i=%f/d=%f offset=%f", engineConfiguration->alternatorControl.pFactor,
scheduleMsg(logger, "p=%.2f/i=%.2f/d=%.2f offset=%.2f", engineConfiguration->alternatorControl.pFactor,
0, 0, engineConfiguration->alternatorControl.offset); // todo: i & d
scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE), currentAltDuty,
scheduleMsg(logger, "vbatt=%.2f/duty=%.2f/target=%.2f", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE), currentAltDuty,
engineConfiguration->targetVBatt);
}
void setAltPFactor(float p) {
engineConfiguration->alternatorControl.pFactor = p;
scheduleMsg(logger, "setAltPid: %f", p);
scheduleMsg(logger, "setAltPid: %.2f", p);
pidReset();
showAltInfo();
}

View File

@ -51,12 +51,12 @@ float multi_wave_s::getSwitchTime(int index) const {
void checkSwitchTimes2(int size, float *switchTimes) {
if (switchTimes[size - 1] != 1) {
firmwareError(CUSTOM_ERR_WAVE_1, "last switch time has to be 1 not %f", switchTimes[size - 1]);
firmwareError(CUSTOM_ERR_WAVE_1, "last switch time has to be 1 not %.2f", switchTimes[size - 1]);
return;
}
for (int i = 0; i < size - 1; i++) {
if (switchTimes[i] >= switchTimes[i + 1]) {
firmwareError(CUSTOM_ERR_WAVE_2, "invalid switchTimes @%d: %f/%f", i, switchTimes[i], switchTimes[i + 1]);
firmwareError(CUSTOM_ERR_WAVE_2, "invalid switchTimes @%d: %.2f/%.2f", i, switchTimes[i], switchTimes[i + 1]);
}
}
}

View File

@ -353,7 +353,7 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element) {
if (pin->isInitialized() && value != pin->getLogicValue()) {
for (int i = 0;i < calc.currentCalculationLogPosition;i++) {
scheduleMsg(logger, "calc %d: action %s value %f", i, action2String(calc.calcLogAction[i]), calc.calcLogValue[i]);
scheduleMsg(logger, "calc %d: action %s value %.2f", i, action2String(calc.calcLogAction[i]), calc.calcLogValue[i]);
}
scheduleMsg(logger, "setPin %s %s", msg, value ? "on" : "off");
@ -438,7 +438,7 @@ static void showFsio(const char *msg, LEElement *element) {
if (msg != NULL)
scheduleMsg(logger, "%s:", msg);
while (element != NULL) {
scheduleMsg(logger, "action %d: fValue=%f iValue=%d", element->action, element->fValue, element->iValue);
scheduleMsg(logger, "action %d: fValue=%.2f iValue=%d", element->action, element->fValue, element->iValue);
element = element->next;
}
scheduleMsg(logger, "<end>");
@ -471,17 +471,17 @@ static void showFsioInfo(void) {
* in case of FSIO user interface indexes are starting with 0, the argument for that
* is the fact that the target audience is more software developers
*/
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%f", (i + 1), exp,
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%.2f", (i + 1), exp,
hwPortname(boardConfiguration->fsioOutputPins[i]), boardConfiguration->fsioFrequency[i],
engine->fsioLastValue[i]);
// scheduleMsg(logger, "user-defined #%d value=%f", i, engine->engineConfiguration2->fsioLastValue[i]);
// scheduleMsg(logger, "user-defined #%d value=%.2f", i, engine->engineConfiguration2->fsioLastValue[i]);
showFsio(NULL, fsioLogics[i]);
}
}
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
float v = boardConfiguration->fsio_setting[i];
if (!cisnan(v)) {
scheduleMsg(logger, "user property #%d: %f", i + 1, v);
scheduleMsg(logger, "user property #%d: %.2f", i + 1, v);
}
}
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
@ -539,7 +539,7 @@ static void rpnEval(char *line) {
scheduleMsg(logger, "parsing failed");
} else {
float result = evalCalc.getValue2(0, e PASS_ENGINE_PARAMETER_SUFFIX);
scheduleMsg(logger, "Evaluate result: %f", result);
scheduleMsg(logger, "Evaluate result: %.2f", result);
}
#endif
}

View File

@ -81,7 +81,7 @@ FastInterpolation::FastInterpolation(float x1, float y1, float x2, float y2) {
void FastInterpolation::init(float x1, float y1, float x2, float y2) {
if (x1 == x2) {
firmwareError(CUSTOM_ERR_INTERPOLATE, "init: Same x1 and x2 in interpolate: %f/%f", x1, x2);
firmwareError(CUSTOM_ERR_INTERPOLATE, "init: Same x1 and x2 in interpolate: %.2f/%.2f", x1, x2);
return;
}
a = INTERPOLATION_A(x1, y1, x2, y2);
@ -108,7 +108,7 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl
/**
* we could end up here for example while resetting bins while changing engine type
*/
warning(CUSTOM_INTEPOLATE_ERROR, "interpolate%s: Same x1 and x2 in interpolate: %f/%f", msg, x1, x2);
warning(CUSTOM_INTEPOLATE_ERROR, "interpolate%s: Same x1 and x2 in interpolate: %.2f/%.2f", msg, x1, x2);
return NAN;
}
@ -119,8 +119,8 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl
float b = y1 - a * x1;
float result = a * x + b;
#if DEBUG_FUEL
printf("x1=%f y1=%f x2=%f y2=%f\r\n", x1, y1, x2, y2);
printf("a=%f b=%f result=%f\r\n", a, b, result);
printf("x1=%.2f y1=%.2f x2=%.2f y2=%.2f\r\n", x1, y1, x2, y2);
printf("a=%.2f b=%.2f result=%.2f\r\n", a, b, result);
#endif
return result;
}
@ -174,7 +174,7 @@ void ensureArrayIsAscending(const char *msg, const float array[], int size) {
for (int i = 0; i < size - 1; i ++) {
if (array[i] >= array[i+ 1]) {
// todo: this should become a warning under https://github.com/rusefi/rusefi/issues/440
firmwareError(CUSTOM_ERR_AXIS_ORDER, "invalid axis %s at %f", msg, array[i]);
firmwareError(CUSTOM_ERR_AXIS_ORDER, "invalid axis %s at %.2f", msg, array[i]);
}
}
}
@ -211,16 +211,16 @@ int findIndexMsg(const char *msg, const float array[], int size, float value) {
// ?
middle = (left + right) / 2;
// print("left=%d middle=%d right=%d: %f\r\n", left, middle, right, array[middle]);
// print("left=%d middle=%d right=%d: %.2f\r\n", left, middle, right, array[middle]);
if (middle == left)
break;
if (middle != 0 && array[middle - 1] > array[middle]) {
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
firmwareError(CUSTOM_ERR_6147, "%s: out of order %f %f", msg, array[middle - 1], array[middle]);
firmwareError(CUSTOM_ERR_6147, "%s: out of order %.2f %.2f", msg, array[middle - 1], array[middle]);
#else
warning(CUSTOM_ERR_6147, "%s: out of order %f %f", msg, array[middle - 1], array[middle]);
warning(CUSTOM_ERR_6147, "%s: out of order %.2f %.2f", msg, array[middle - 1], array[middle]);
#endif /* EFI_UNIT_TEST */
}

View File

@ -37,11 +37,11 @@ int needInterpolationLogging(void);
template<typename vType>
float interpolate3d(float x, float xBin[], int xBinSize, float y, float yBin[], int yBinSize, vType* map[]) {
if (cisnan(x)) {
warning(CUSTOM_INTEPOLATE_ERROR_3, "%f: x is NaN in interpolate3d", x);
warning(CUSTOM_INTEPOLATE_ERROR_3, "%.2f: x is NaN in interpolate3d", x);
return NAN;
}
if (cisnan(y)) {
warning(CUSTOM_INTEPOLATE_ERROR_2, "%f: y is NaN in interpolate3d", y);
warning(CUSTOM_INTEPOLATE_ERROR_2, "%.2f: y is NaN in interpolate3d", y);
return NAN;
}
@ -123,8 +123,8 @@ float interpolate3d(float x, float xBin[], int xBinSize, float y, float yBin[],
#if DEBUG_INTERPOLATION
if (needInterpolationLogging()) {
printf("X=%f:\r\nrange %f - %f\r\n", x, xMin, xMax);
printf("X interpolation range %f %f result %f\r\n", rpmMinKeyMinValue, rpmMaxKeyMinValue, keyMinValue);
printf("X=%.2f:\r\nrange %.2f - %.2f\r\n", x, xMin, xMax);
printf("X interpolation range %.2f %.2f result %.2f\r\n", rpmMinKeyMinValue, rpmMaxKeyMinValue, keyMinValue);
}
#endif /* DEBUG_INTERPOLATION */
@ -138,8 +138,8 @@ float interpolate3d(float x, float xBin[], int xBinSize, float y, float yBin[],
#if DEBUG_INTERPOLATION
if (needInterpolationLogging()) {
printf("key=%f:\r\nrange %f - %f\r\n", y, keyMin, keyMax);
printf("key interpolation range %f %f result %f\r\n", rpmMinKeyMaxValue, rpmMaxKeyMaxValue, keyMaxValue);
printf("key=%.2f:\r\nrange %.2f - %.2f\r\n", y, keyMin, keyMax);
printf("key interpolation range %.2f %.2f result %.2f\r\n", rpmMinKeyMaxValue, rpmMaxKeyMaxValue, keyMaxValue);
}
#endif /* DEBUG_INTERPOLATION */

View File

@ -56,7 +56,7 @@ void Table2D<SIZE>::preCalc(float *bin, float *values) {
float x1 = bin[i];
float x2 = bin[i + 1];
if (x1 == x2) {
warning(CUSTOM_INTEPOLATE_ERROR_4, "preCalc: Same x1 and x2 in interpolate: %f/%f", x1, x2);
warning(CUSTOM_INTEPOLATE_ERROR_4, "preCalc: Same x1 and x2 in interpolate: %.2f/%.2f", x1, x2);
return;
}

View File

@ -149,7 +149,7 @@ static void setThrottleConsole(int level) {
float dc = 0.01 + (minI(level, 98)) / 100.0;
etbPwmUp.setSimplePwmDutyCycle(dc);
print("st = %f\r\n", dc);
print("st = %.2f\r\n", dc);
}
static void showEthInfo(void) {
@ -158,15 +158,15 @@ static void showEthInfo(void) {
scheduleMsg(&logger, "etbAutoTune=%d",
engine->etbAutoTune);
scheduleMsg(&logger, "throttlePedal=%f %f/%f @%s",
scheduleMsg(&logger, "throttlePedal=%.2f %.2f/%.2f @%s",
getPedalPosition(),
engineConfiguration->throttlePedalUpVoltage,
engineConfiguration->throttlePedalWOTVoltage,
getPinNameByAdcChannel("tPedal", engineConfiguration->pedalPositionChannel, pinNameBuffer));
scheduleMsg(&logger, "TPS=%f", getTPS());
scheduleMsg(&logger, "TPS=%.2f", getTPS());
scheduleMsg(&logger, "etbControlPin1=%s duty=%f freq=%d",
scheduleMsg(&logger, "etbControlPin1=%s duty=%.2f freq=%d",
hwPortname(boardConfiguration->etbControlPin1),
currentEtbDuty,
engineConfiguration->etbFreq);

View File

@ -323,7 +323,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel,
}
float voltage = adcVoltage * dividerCoeff;
scheduleMsg(&logger, "%s ADC%d %s %s adc=%f/input=%fv/divider=%f", name, hwChannel, getAdcMode(hwChannel),
scheduleMsg(&logger, "%s ADC%d %s %s adc=%.2f/input=%.2fv/divider=%.2f", name, hwChannel, getAdcMode(hwChannel),
getPinNameByAdcChannel(name, hwChannel, pinNameBuffer), adcVoltage, voltage, dividerCoeff);
#endif
}
@ -335,7 +335,7 @@ static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
}
static void printAnalogInfo(void) {
scheduleMsg(&logger, "analogInputDividerCoefficient: %f", engineConfiguration->analogInputDividerCoefficient);
scheduleMsg(&logger, "analogInputDividerCoefficient: %.2f", engineConfiguration->analogInputDividerCoefficient);
printAnalogChannelInfo("hip9011", engineConfiguration->hipOutputChannel);
printAnalogChannelInfo("fuel gauge", engineConfiguration->fuelLevelSensor);

View File

@ -70,16 +70,16 @@ static percent_t currentIdlePosition = -100.0f;
static percent_t baseIdlePosition = currentIdlePosition;
void idleDebug(const char *msg, percent_t value) {
scheduleMsg(logger, "idle debug: %s%f", msg, value);
scheduleMsg(logger, "idle debug: %s%.2f", msg, value);
}
static void showIdleInfo(void) {
const char * idleModeStr = getIdle_mode_e(engineConfiguration->idleMode);
scheduleMsg(logger, "idleMode=%s position=%f isStepper=%s", idleModeStr,
scheduleMsg(logger, "idleMode=%s position=%.2f isStepper=%s", idleModeStr,
getIdlePosition(), boolToString(boardConfiguration->useStepperIdle));
if (boardConfiguration->useStepperIdle) {
scheduleMsg(logger, "directionPin=%s reactionTime=%f", hwPortname(boardConfiguration->idle.stepperDirectionPin),
scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(boardConfiguration->idle.stepperDirectionPin),
engineConfiguration->idleStepperReactionTime);
scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(boardConfiguration->idle.stepperStepPin),
engineConfiguration->idleStepperTotalSteps);

View File

@ -84,18 +84,18 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, flo
int onTimeSt = onTimeMs < 1 ? 1 : MS2ST(onTimeMs);
int offTimeSt = offTimeMs < 1 ? 1 : MS2ST(offTimeMs);
if (delaySt < 0) {
scheduleMsg(logger, "Invalid delay %f", delayMs);
scheduleMsg(logger, "Invalid delay %.2f", delayMs);
return;
}
if (onTimeSt <= 0) {
scheduleMsg(logger, "Invalid onTime %f", onTimeMs);
scheduleMsg(logger, "Invalid onTime %.2f", onTimeMs);
return;
}
if (offTimeSt <= 0) {
scheduleMsg(logger, "Invalid offTime %f", offTimeMs);
scheduleMsg(logger, "Invalid offTime %.2f", offTimeMs);
return;
}
scheduleMsg(logger, "Running bench: ON_TIME=%f ms OFF_TIME=%fms Counter=%d", onTimeMs, offTimeMs, count);
scheduleMsg(logger, "Running bench: ON_TIME=%.2f ms OFF_TIME=%.2fms Counter=%d", onTimeMs, offTimeMs, count);
scheduleMsg(logger, "output on %s", hwPortname(brainPin));
if (delaySt != 0) {

View File

@ -224,10 +224,10 @@ static void showLine(lcd_line_e line, int screenY) {
#endif
return;
case LL_CLT_TEMPERATURE:
lcdPrintf("Coolant %f", getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("Coolant %.2f", getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_IAT_TEMPERATURE:
lcdPrintf("Intake Air %f", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("Intake Air %.2f", getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_ALGORITHM:
lcdPrintf(getEngine_load_mode_e(engineConfiguration->fuelAlgorithm));
@ -236,7 +236,7 @@ static void showLine(lcd_line_e line, int screenY) {
lcdPrintf(getInjection_mode_e(engineConfiguration->injectionMode));
return;
case LL_ING_FLOW:
lcdPrintf("Inj %fcc", engineConfiguration->injector.flow);
lcdPrintf("Inj %.2fcc", engineConfiguration->injector.flow);
return;
case LL_IGNITION:
lcdPrintf(getIgnition_mode_e(engineConfiguration->ignitionMode));
@ -244,24 +244,24 @@ static void showLine(lcd_line_e line, int screenY) {
case LL_TPS:
getPinNameByAdcChannel("tps", engineConfiguration->tpsAdcChannel, buffer);
lcdPrintf("Throttle %s %f%%", buffer, getTPS());
lcdPrintf("Throttle %s %.2f%%", buffer, getTPS());
return;
case LL_FUEL_CLT_CORRECTION:
lcdPrintf("CLT corr %fv", getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("CLT corr %.2fv", getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_VBATT:
lcdPrintf("Battery %fv", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("Battery %.2fv", getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE));
return;
case LL_KNOCK:
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, buffer);
lcdPrintf("Knock %s %fv", buffer, engine->knockVolts);
lcdPrintf("Knock %s %.2fv", buffer, engine->knockVolts);
return;
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
case LL_BARO:
if (hasBaroSensor()) {
lcdPrintf("Baro: %f", getBaroPressure());
lcdPrintf("Baro: %.2f", getBaroPressure());
} else {
lcdPrintf("Baro: none");
}
@ -269,28 +269,28 @@ static void showLine(lcd_line_e line, int screenY) {
#endif
case LL_AFR:
if (hasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
lcdPrintf("AFR: %f", getAfr());
lcdPrintf("AFR: %.2f", getAfr());
} else {
lcdPrintf("AFR: none");
}
return;
case LL_MAP:
if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
lcdPrintf("MAP %f", getMap());
lcdPrintf("MAP %.2f", getMap());
} else {
lcdPrintf("MAP: none");
}
return;
case LL_MAF_V:
if (hasMafSensor()) {
lcdPrintf("MAF: %fv", getMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("MAF: %.2fv", getMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
} else {
lcdPrintf("MAF: none");
}
return;
case LL_MAF_KG_HR:
if (hasMafSensor()) {
lcdPrintf("MAF: %f kg/hr", getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
lcdPrintf("MAF: %.2f kg/hr", getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
} else {
lcdPrintf("MAF: none");
}

View File

@ -205,7 +205,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
efiAssert(!cisnan(angle), "findAngle#3", false);
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER_SUFFIX));
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("registerInjectionEvent angle=%f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex);
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex);
#endif
return true;
}
@ -250,7 +250,7 @@ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (cisnan(dwellMs) || dwellMs <= 0) {
// this could happen during engine configuration reset
warning(CUSTOM_ERR_DWELL_DURATION, "invalid dwell: %f at rpm=%d", dwellMs, rpm);
warning(CUSTOM_ERR_DWELL_DURATION, "invalid dwell: %.2f at rpm=%d", dwellMs, rpm);
return 0;
}
return dwellMs;
@ -299,7 +299,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position, angle
int index = triggerIndexByAngle[(int)angleOffset];
angle_t eventAngle = eventAngles[index];
if (angleOffset < eventAngle) {
warning(CUSTOM_OBD_ANGLE_CONSTRAINT_VIOLATION, "angle constraint violation in findTriggerPosition(): %f/%f", angleOffset, eventAngle);
warning(CUSTOM_OBD_ANGLE_CONSTRAINT_VIOLATION, "angle constraint violation in findTriggerPosition(): %.2f/%.2f", angleOffset, eventAngle);
return;
}

View File

@ -18,7 +18,7 @@ void setAlgorithm(engine_load_mode_e algo DECLARE_ENGINE_PARAMETER_SUFFIX);
#if EFI_ENABLE_ASSERTS
#define assertAngleRange(angle, msg) if(angle > 10000000 || angle < -10000000) { firmwareError(ERROR_ANGLE_RANGE, "angle range %s %f", msg, angle);angle = 0;}
#define assertAngleRange(angle, msg) if(angle > 10000000 || angle < -10000000) { firmwareError(ERROR_ANGLE_RANGE, "angle range %s %.2f", msg, angle);angle = 0;}
#else
#define assertAngleRange(angle, msg) {}
#endif

View File

@ -137,7 +137,7 @@ void Pid::showPidStatus(Logging *logging, const char*msg) {
pid->dFactor,
pid->period);
scheduleMsg(logging, "%s status: value=%f input=%f/target=%f iTerm=%.5f dTerm=%.5f",
scheduleMsg(logging, "%s status: value=%.2f input=%.2f/target=%.2f iTerm=%.5f dTerm=%.5f",
msg,
prevResult,
prevInput,

View File

@ -67,7 +67,7 @@ int PID_AutoTune::Runtime(Logging *logging) {
output = outputStart + oStep;
if (output != prevOutput) {
scheduleMsg(logging, "direction change %f", output);
scheduleMsg(logging, "direction change %.2f", output);
}
@ -88,7 +88,7 @@ int PID_AutoTune::Runtime(Logging *logging) {
}
if (isMax || isMin) {
scheduleMsg(logging, "min %d max %d %f peakType=%d", isMin, isMax, input, peakType);
scheduleMsg(logging, "min %d max %d %.2f peakType=%d", isMin, isMax, input, peakType);
}

View File

@ -111,7 +111,7 @@ floatms_t getSpeedDensityFuel(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float airMass = getCylinderAirMass(engineConfiguration, ENGINE(engineState.currentVE), adjustedMap, tChargeK);
efiAssert(!cisnan(airMass), "NaN airMass", 0);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("map=%f adjustedMap=%f airMass=%f\t\n",
printf("map=%.2f adjustedMap=%.2f airMass=%.2f\t\n",
map, adjustedMap, engine->engineState.airMass);
#endif /*EFI_PRINTF_FUEL_DETAILS */

View File

@ -104,7 +104,7 @@ float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DEC
*/
float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (cisnan(mapKPa) || mapKPa < CONFIG(mapErrorDetectionTooLow) || mapKPa > CONFIG(mapErrorDetectionTooHigh)) {
warning(OBD_Manifold_Absolute_Pressure_Circuit_Malfunction, "unexpected MAP value: %f", mapKPa);
warning(OBD_Manifold_Absolute_Pressure_Circuit_Malfunction, "unexpected MAP value: %.2f", mapKPa);
return 0;
}
return mapKPa;
@ -214,13 +214,13 @@ extern int mapMinBufferLength;
static void printMAPInfo(void) {
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
scheduleMsg(logger, "instant value=%fkPa", getRawMap());
scheduleMsg(logger, "instant value=%.2fkPa", getRawMap());
if (engineConfiguration->hasFrequencyReportingMapSensor) {
scheduleMsg(logger, "instant value=%fHz @ %s", mapFreq, hwPortname(boardConfiguration->frequencyReportingMapInputPin));
scheduleMsg(logger, "instant value=%.2fHz @ %s", mapFreq, hwPortname(boardConfiguration->frequencyReportingMapInputPin));
} else {
scheduleMsg(logger, "map type=%d/%s MAP=%fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
scheduleMsg(logger, "map type=%d/%s MAP=%.2fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
getMap(),
mapMinBufferLength);
@ -228,10 +228,10 @@ static void printMAPInfo(void) {
adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel;
static char pinNameBuffer[16];
scheduleMsg(logger, "MAP %fv @%s", getVoltage("mapinfo", mapAdc),
scheduleMsg(logger, "MAP %.2fv @%s", getVoltage("mapinfo", mapAdc),
getPinNameByAdcChannel("map", mapAdc, pinNameBuffer));
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
scheduleMsg(logger, "at %fv=%f at %fv=%f",
scheduleMsg(logger, "at %.2fv=%.2f at %.2fv=%.2f",
engineConfiguration->mapLowValueVoltage,
engineConfiguration->map.sensor.lowValue,
engineConfiguration->mapHighValueVoltage,
@ -240,9 +240,9 @@ static void printMAPInfo(void) {
}
if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
scheduleMsg(logger, "baro type=%d value=%f", engineConfiguration->baroSensor.type, getBaroPressure());
scheduleMsg(logger, "baro type=%d value=%.2f", engineConfiguration->baroSensor.type, getBaroPressure());
if (engineConfiguration->baroSensor.type == MT_CUSTOM) {
scheduleMsg(logger, "min=%f@%f max=%f@%f",
scheduleMsg(logger, "min=%.2f@%.2f max=%.2f@%.2f",
engineConfiguration->baroSensor.lowValue,
engineConfiguration->mapLowValueVoltage,
engineConfiguration->baroSensor.highValue,
@ -270,7 +270,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIG(useFixedBaroCorrFromMap)) {
// Read initial MAP sensor value and store it for Baro correction.
storedInitialBaroPressure = getRawMap(PASS_ENGINE_PARAMETER_SIGNATURE);
scheduleMsg(logger, "Get initial baro MAP pressure = %fkPa", storedInitialBaroPressure);
scheduleMsg(logger, "Get initial baro MAP pressure = %.2fkPa", storedInitialBaroPressure);
// validate if it's within a reasonable range (the engine should not be spinning etc.)
storedInitialBaroPressure = validateBaroMap(storedInitialBaroPressure);
if (!cisnan(storedInitialBaroPressure)) {

View File

@ -123,7 +123,7 @@ float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->useLinearCltSensor);
if (!isValidCoolantTemperature(temperature)) {
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
warning(OBD_Engine_Coolant_Temperature_Circuit_Malfunction, "unrealistic CLT %f", temperature);
warning(OBD_Engine_Coolant_Temperature_Circuit_Malfunction, "unrealistic CLT %.2f", temperature);
engine->isCltBroken = true;
return LIMPING_MODE_CLT_TEMPERATURE;
}
@ -158,7 +158,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
* See https://github.com/rusefi/rusefi/issues/375
* See https://sourceforge.net/p/rusefi/tickets/149/
*/
firmwareError(CUSTOM_ERR_NATURAL_LOGARITHM_ERROR, "Natural logarithm logf() is broken: %f", tc->resistance_1);
firmwareError(CUSTOM_ERR_NATURAL_LOGARITHM_ERROR, "Natural logarithm logf() is broken: %.2f", tc->resistance_1);
}
float L2 = logf(tc->resistance_2);
float L3 = logf(tc->resistance_3);
@ -205,7 +205,7 @@ float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!isValidIntakeAirTemperature(temperature)) {
efiAssert(engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
#if EFI_PROD_CODE || EFI_UNIT_TEST || defined(__DOXYGEN__)
warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %f", temperature);
warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %.2f", temperature);
#endif /* EFI_PROD_CODE */
return LIMPING_MODE_IAT_TEMPERATURE;
}
@ -236,7 +236,7 @@ static void testCltByR(float resistance) {
// we expect periodicSlowCallback to already update configuration in the curve helper class see setConfig
float kTemp = engine->engineState.cltCurve.getKelvinTemperatureByResistance(resistance);
scheduleMsg(logger, "for R=%f we have %f", resistance, (kTemp - KELV));
scheduleMsg(logger, "for R=%.2f we have %.2f", resistance, (kTemp - KELV));
}
#endif

View File

@ -79,13 +79,13 @@ percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (result < engineConfiguration->tpsErrorDetectionTooLow) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// too much noise with simulator
warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %f", result);
warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %.2f", result);
#endif /* EFI_PROD_CODE */
}
if (result > engineConfiguration->tpsErrorDetectionTooHigh) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// too much noise with simulator
warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %f", result);
warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %.2f", result);
#endif /* EFI_PROD_CODE */
}

View File

@ -66,7 +66,7 @@ void printFloatArray(const char *prefix, float array[], int size) {
appendMsgPrefix(&logger);
appendPrintf(&logger, prefix);
for (int j = 0; j < size; j++) {
appendPrintf(&logger, "%f ", array[j]);
appendPrintf(&logger, "%.2f ", array[j]);
}
appendMsgPostfix(&logger);
scheduleLogging(&logger);
@ -209,9 +209,9 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "configurationVersion=%d", getGlobalConfigurationVersion());
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
// print("line %d (%f): ", k, engineConfiguration->fuelKeyBins[k]);
// print("line %d (%.2f): ", k, engineConfiguration->fuelKeyBins[k]);
// for (int r = 0; r < FUEL_RPM_COUNT; r++) {
// print("%f ", engineConfiguration->fuelTable[k][r]);
// print("%.2f ", engineConfiguration->fuelTable[k][r]);
// }
// print("\r\n");
}
@ -232,16 +232,16 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "rpmHardLimit: %d/operationMode=%d", engineConfiguration->rpmHardLimit,
engineConfiguration->operationMode);
scheduleMsg(&logger, "globalTriggerAngleOffset=%f", engineConfiguration->globalTriggerAngleOffset);
scheduleMsg(&logger, "globalTriggerAngleOffset=%.2f", engineConfiguration->globalTriggerAngleOffset);
scheduleMsg(&logger, "=== cranking ===");
scheduleMsg(&logger, "crankingRpm: %d", engineConfiguration->cranking.rpm);
scheduleMsg(&logger, "cranking injection %s", getInjection_mode_e(engineConfiguration->crankingInjectionMode));
if (engineConfiguration->useConstantDwellDuringCranking) {
scheduleMsg(&logger, "ignitionDwellForCrankingMs=%f", engineConfiguration->ignitionDwellForCrankingMs);
scheduleMsg(&logger, "ignitionDwellForCrankingMs=%.2f", engineConfiguration->ignitionDwellForCrankingMs);
} else {
scheduleMsg(&logger, "cranking charge charge angle=%f fire at %f", engineConfiguration->crankingChargeAngle,
scheduleMsg(&logger, "cranking charge charge angle=%.2f fire at %.2f", engineConfiguration->crankingChargeAngle,
engineConfiguration->crankingTimingAngle);
}
@ -253,10 +253,10 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
if (engineConfiguration->timingMode == TM_FIXED) {
scheduleMsg(&logger, "fixedModeTiming: %d", (int) engineConfiguration->fixedModeTiming);
}
scheduleMsg(&logger, "ignitionOffset=%f", engineConfiguration->ignitionOffset);
scheduleMsg(&logger, "ignitionOffset=%.2f", engineConfiguration->ignitionOffset);
scheduleMsg(&logger, "=== injection ===");
scheduleMsg(&logger, "injection %s offset=%f/enabled=%s", getInjection_mode_e(engineConfiguration->injectionMode),
scheduleMsg(&logger, "injection %s offset=%.2f/enabled=%s", getInjection_mode_e(engineConfiguration->injectionMode),
(double) engineConfiguration->extraInjectionOffset, boolToString(engineConfiguration->isInjectionEnabled));
printOutputs(engineConfiguration);
@ -389,15 +389,15 @@ static void printThermistor(const char *msg, ThermistorConf *config, ThermistorM
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 volts=%.2f Celsius=%.2f sensorR=%.2f on channel %d", msg, voltage, t, r, adcChannel);
scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(msg, adcChannel, pinNameBuffer));
scheduleMsg(&logger, "C=%f/R=%f C=%f/R=%f C=%f/R=%f",
scheduleMsg(&logger, "C=%.2f/R=%.2f C=%.2f/R=%.2f C=%.2f/R=%.2f",
tc->tempC_1, tc->resistance_1,
tc->tempC_2, tc->resistance_2,
tc->tempC_3, tc->resistance_3);
// %.5f
scheduleMsg(&logger, "bias resistor=%fK A=%.5f B=%.5f C=%.5f", tc->bias_resistor / 1000,
scheduleMsg(&logger, "bias resistor=%.2fK A=%.5f B=%.5f C=%.5f", tc->bias_resistor / 1000,
tm->s_h_a, tm->s_h_b, tm->s_h_c);
scheduleMsg(&logger, "==============================");
}
@ -410,10 +410,10 @@ static void printTPSInfo(void) {
}
static char pinNameBuffer[16];
scheduleMsg(&logger, "tps min (closed) %d/max (full) %d v=%f @%s", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
scheduleMsg(&logger, "tps min (closed) %d/max (full) %d v=%.2f @%s", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
getTPSVoltage(PASS_ENGINE_PARAMETER_SIGNATURE), getPinNameByAdcChannel("tps", engineConfiguration->tpsAdcChannel, pinNameBuffer));
#endif /* EFI_PROD_CODE */
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS12bitAdc() / TPS_TS_CONVERSION, getTPS(PASS_ENGINE_PARAMETER_SIGNATURE),
scheduleMsg(&logger, "current 10bit=%d value=%.2f rate=%.2f", getTPS12bitAdc() / TPS_TS_CONVERSION, getTPS(PASS_ENGINE_PARAMETER_SIGNATURE),
getTpsRateOfChange());
}
@ -436,7 +436,7 @@ static void printTemperatureInfo(void) {
scheduleMsg(&logger, "A/C relay=%s @ %s", boolToString(enginePins.acRelay.getLogicValue()),
hwPortname(boardConfiguration->acRelayPin));
scheduleMsg(&logger, "warmupPID=%d corr=%f", boardConfiguration->useWarmupPidAfr,
scheduleMsg(&logger, "warmupPID=%d corr=%.2f", boardConfiguration->useWarmupPidAfr,
engine->engineState.cltFuelCorrection);
#endif /* EFI_ANALOG_SENSORS */
@ -471,13 +471,13 @@ static void setRpmHardLimit(int value) {
static void setCrankingIACExtra(float percent) {
engineConfiguration->crankingIACposition = percent;
scheduleMsg(&logger, "cranking_iac %f", percent);
scheduleMsg(&logger, "cranking_iac %.2f", percent);
}
static void setCrankingFuel(float timeMs) {
engineConfiguration->cranking.baseFuel = timeMs;
scheduleMsg(&logger, "cranking_fuel %f", timeMs);
scheduleMsg(&logger, "cranking_fuel %.2f", timeMs);
printTemperatureInfo();
}
@ -567,7 +567,7 @@ static void setCrankingChargeAngle(float value) {
static void setGlobalFuelCorrection(float value) {
if (value < 0.01 || value > 50)
return;
scheduleMsg(&logger, "setting fuel mult=%f", value);
scheduleMsg(&logger, "setting fuel mult=%.2f", value);
engineConfiguration->globalFuelCorrection = value;
}
@ -577,7 +577,7 @@ static void setCltBias(float value) {
static void setFanSetting(float onTempC, float offTempC) {
if (onTempC <= offTempC) {
scheduleMsg(&logger, "ON temp [%f] should be above OFF temp [%f]", onTempC, offTempC);
scheduleMsg(&logger, "ON temp [%.2f] should be above OFF temp [%.2f]", onTempC, offTempC);
return;
}
engineConfiguration->fanOnTemperature = onTempC;
@ -594,7 +594,7 @@ static void setVBattDivider(float value) {
static void setWholeTimingMap(float value) {
// todo: table helper?
scheduleMsg(&logger, "Setting whole timing map to %f", value);
scheduleMsg(&logger, "Setting whole timing map to %.2f", value);
for (int l = 0; l < IGN_LOAD_COUNT; l++) {
for (int r = 0; r < IGN_RPM_COUNT; r++) {
config->ignitionTable[l][r] = value;
@ -603,17 +603,17 @@ static void setWholeTimingMap(float value) {
}
static void setWholePhaseMapCmd(float value) {
scheduleMsg(&logger, "Setting whole injection phase map to %f", value);
scheduleMsg(&logger, "Setting whole injection phase map to %.2f", value);
setMap(config->injectionPhase, value);
}
static void setWholeTimingMapCmd(float value) {
scheduleMsg(&logger, "Setting whole timing advance map to %f", value);
scheduleMsg(&logger, "Setting whole timing advance map to %.2f", value);
setWholeTimingMap(value);
}
static void setWholeVeCmd(float value) {
scheduleMsg(&logger, "Setting whole VE map to %f", value);
scheduleMsg(&logger, "Setting whole VE map to %.2f", value);
if (engineConfiguration->fuelAlgorithm != LM_SPEED_DENSITY) {
scheduleMsg(&logger, "WARNING: setting VE map not in SD mode is pointless");
}
@ -621,7 +621,7 @@ static void setWholeVeCmd(float value) {
}
static void setWholeFuelMapCmd(float value) {
scheduleMsg(&logger, "Setting whole fuel map to %f", value);
scheduleMsg(&logger, "Setting whole fuel map to %.2f", value);
if (engineConfiguration->fuelAlgorithm == LM_SPEED_DENSITY) {
scheduleMsg(&logger, "WARNING: setting fuel map in SD mode is pointless");
}
@ -820,7 +820,7 @@ static void setTimingMap(const char * rpmStr, const char *loadStr, const char *v
loadIndex = loadIndex < 0 ? 0 : loadIndex;
config->ignitionTable[loadIndex][rpmIndex] = value;
scheduleMsg(&logger, "Setting timing map entry %d:%d to %f", rpmIndex, loadIndex, value);
scheduleMsg(&logger, "Setting timing map entry %d:%d to %.2f", rpmIndex, loadIndex, value);
}
static void setFuelMap(const char * rpmStr, const char *loadStr, const char *valueStr) {
@ -834,7 +834,7 @@ static void setFuelMap(const char * rpmStr, const char *loadStr, const char *val
loadIndex = loadIndex < 0 ? 0 : loadIndex;
config->fuelTable[loadIndex][rpmIndex] = value;
scheduleMsg(&logger, "Setting fuel map entry %d:%d to %f", rpmIndex, loadIndex, value);
scheduleMsg(&logger, "Setting fuel map entry %d:%d to %.2f", rpmIndex, loadIndex, value);
}
static void setSpiMode(int index, bool mode) {
@ -1067,7 +1067,7 @@ static void getValue(const char *paramStr) {
while (currentF < getF_plain + sizeof(getF_plain)/sizeof(getF_plain[0])) {
if (strEqualCaseInsensitive(paramStr, currentF->token)) {
float value = *currentF->value;
scheduleMsg(&logger, "%s value: %f", currentF->token, value);
scheduleMsg(&logger, "%s value: %.2f", currentF->token, value);
return;
}
currentF++;
@ -1086,7 +1086,7 @@ static void getValue(const char *paramStr) {
} else if (strEqualCaseInsensitive(paramStr, "nb_vvt_index")) {
scheduleMsg(&logger, "nb_vvt_index=%d", engineConfiguration->nbVvtIndex);
} else if (strEqualCaseInsensitive(paramStr, "global_trigger_offset_angle")) {
scheduleMsg(&logger, "global_trigger_offset=%f", engineConfiguration->globalTriggerAngleOffset);
scheduleMsg(&logger, "global_trigger_offset=%.2f", engineConfiguration->globalTriggerAngleOffset);
} else if (strEqualCaseInsensitive(paramStr, "isHip9011Enabled")) {
scheduleMsg(&logger, "isHip9011Enabled=%d", boardConfiguration->isHip9011Enabled);
}

View File

@ -53,7 +53,7 @@ void PwmConfig::init(float *st, single_wave_s *waves) {
*/
void SimplePwm::setSimplePwmDutyCycle(float dutyCycle) {
if (dutyCycle < 0 || dutyCycle > 1) {
firmwareError(CUSTOM_ERR_ASSERT_VOID, "spwd:dutyCycle %f", dutyCycle);
firmwareError(CUSTOM_ERR_ASSERT_VOID, "spwd:dutyCycle %.2f", dutyCycle);
}
multiWave.setSwitchTime(0, dutyCycle);
}
@ -64,7 +64,7 @@ static efitimeus_t getNextSwitchTimeUs(PwmConfig *state) {
float switchTime = state->multiWave.getSwitchTime(state->safe.phaseIndex);
float periodNt = state->safe.periodNt;
#if DEBUG_PWM
scheduleMsg(&logger, "iteration=%d switchTime=%f period=%f", iteration, switchTime, period);
scheduleMsg(&logger, "iteration=%d switchTime=%.2f period=%.2f", iteration, switchTime, period);
#endif
/**
@ -117,7 +117,7 @@ void PwmConfig::handleCycleStart() {
efitimeus_t PwmConfig::togglePwmState() {
#if DEBUG_PWM
scheduleMsg(&logger, "togglePwmState phaseIndex=%d iteration=%d", safe.phaseIndex, safe.iteration);
scheduleMsg(&logger, "period=%f safe.period=%f", period, safe.period);
scheduleMsg(&logger, "period=%.2f safe.period=%.2f", period, safe.period);
#endif
if (cisnan(periodNt)) {
@ -186,7 +186,7 @@ void copyPwmParameters(PwmConfig *state, int phaseCount, float *switchTimes, int
state->multiWave.setSwitchTime(phaseIndex, switchTimes[phaseIndex]);
for (int waveIndex = 0; waveIndex < waveCount; waveIndex++) {
// print("output switch time index (%d/%d) at %f to %d\r\n", phaseIndex,waveIndex,
// print("output switch time index (%d/%d) at %.2f to %d\r\n", phaseIndex,waveIndex,
// switchTimes[phaseIndex], pinStates[waveIndex][phaseIndex]);
state->multiWave.waves[waveIndex].pinStates[phaseIndex] = pinStates[waveIndex][phaseIndex];
}

View File

@ -107,7 +107,7 @@ void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engine->engineState.auxValveStart >= engine->engineState.auxValveEnd) {
// this is a fatal error to make this really visible
firmwareError(CUSTOM_AUX_OUT_OF_ORDER, "out of order at %f %f %f", x,
firmwareError(CUSTOM_AUX_OUT_OF_ORDER, "out of order at %.2f %.2f %.2f", x,
engine->engineState.auxValveStart,
engine->engineState.auxValveEnd);
}

View File

@ -218,7 +218,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
*/
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("fuel injectionDuration=%f adjusted=%f\t\n", ENGINE(injectionDuration), injectionDuration);
printf("fuel injectionDuration=%.2f adjusted=%.2f\t\n", ENGINE(injectionDuration), injectionDuration);
#endif /*EFI_PRINTF_FUEL_DETAILS */
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -227,9 +227,9 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
* see also injectorDutyCycle
*/
if (!isCranking && injectionDuration * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
warning(CUSTOM_TOO_LONG_FUEL_INJECTION, "Too long fuel injection %fms", injectionDuration);
warning(CUSTOM_TOO_LONG_FUEL_INJECTION, "Too long fuel injection %.2fms", injectionDuration);
} else if (isCranking && injectionDuration * getNumberOfInjections(engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
warning(CUSTOM_TOO_LONG_CRANKING_FUEL_INJECTION, "Too long cranking fuel injection %fms", injectionDuration);
warning(CUSTOM_TOO_LONG_CRANKING_FUEL_INJECTION, "Too long cranking fuel injection %.2fms", injectionDuration);
}
// Store 'pure' injection duration (w/o injector lag) for fuel rate calc.
@ -241,25 +241,25 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
return;
}
if (injectionDuration < 0) {
warning(CUSTOM_OBD_NEG_INJECTION, "Negative injection pulse %f", injectionDuration);
warning(CUSTOM_OBD_NEG_INJECTION, "Negative injection pulse %.2f", injectionDuration);
return;
}
floatus_t durationUs = MS2US(injectionDuration);
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
scheduleMsg(logger, "handleFuel totalPerCycle=%f", totalPerCycle);
scheduleMsg(logger, "handleFuel engineCycleDuration=%f", engineCycleDuration);
scheduleMsg(logger, "handleFuel totalPerCycle=%.2f", totalPerCycle);
scheduleMsg(logger, "handleFuel engineCycleDuration=%.2f", engineCycleDuration);
#endif /* FUEL_MATH_EXTREME_LOGGING */
floatus_t injectionStartDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * event->injectionStart.angleOffset;
#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__)
scheduleMsg(logger, "handleFuel pin=%s eventIndex %d duration=%fms %d", event->output->name,
scheduleMsg(logger, "handleFuel pin=%s eventIndex %d duration=%.2fms %d", event->output->name,
eventIndex,
injectionDuration,
getRevolutionCounter());
scheduleMsg(logger, "handleFuel pin=%s delay=%f %d", event->output->name, injectionStartDelayUs,
scheduleMsg(logger, "handleFuel pin=%s delay=%.2f %d", event->output->name, injectionStartDelayUs,
getRevolutionCounter());
#endif /* EFI_DEFAILED_LOGGING */
@ -282,7 +282,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
} else {
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("scheduling injection angle=%f/delay=%f injectionDuration=%f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration);
printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration);
#endif
// we are in this branch of code only in case of NOT IM_SIMULTANEOUS/IM_SINGLE_POINT injection
@ -582,8 +582,8 @@ static void showMainInfo(Engine *engine) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
int rpm = engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE);
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
scheduleMsg(logger, "rpm %d engine_load %f", rpm, el);
scheduleMsg(logger, "fuel %fms timing %f", getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX), engine->engineState.timingAdvance);
scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el);
scheduleMsg(logger, "fuel %.2fms timing %.2f", getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX), engine->engineState.timingAdvance);
#endif
}

View File

@ -126,7 +126,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
const floatms_t dwellMs = ENGINE(engineState.sparkDwell);
if (cisnan(dwellMs) || dwellMs <= 0) {
warning(CUSTOM_DWELL, "invalid dwell to handle: %f at %d", dwellMs, rpm);
warning(CUSTOM_DWELL, "invalid dwell to handle: %.2f at %d", dwellMs, rpm);
return;
}
@ -135,7 +135,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
ignitionErrorDetection.add(isIgnitionError);
if (isIgnitionError) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
scheduleMsg(logger, "Negative spark delay=%f", chargeDelayUs);
scheduleMsg(logger, "Negative spark delay=%.2f", chargeDelayUs);
#endif /* EFI_PROD_CODE */
chargeDelayUs = 0;
return;
@ -293,7 +293,7 @@ static ALWAYS_INLINE void prepareIgnitionSchedule(DECLARE_ENGINE_PARAMETER_SIGNA
warning(CUSTOM_ZERO_DWELL, "dwell is zero?");
}
if (engine->engineState.dwellAngle > maxAllowedDwellAngle) {
warning(CUSTOM_DWELL_TOO_LONG, "dwell angle too long: %f", engine->engineState.dwellAngle);
warning(CUSTOM_DWELL_TOO_LONG, "dwell angle too long: %.2f", engine->engineState.dwellAngle);
}
// todo: add some check for dwell overflow? like 4 times 6 ms while engine cycle is less then that

View File

@ -120,13 +120,13 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
previousVvtCamTime = nowNt;
if (engineConfiguration->isPrintTriggerSynchDetails) {
scheduleMsg(logger, "vvt ratio %f", ratio);
scheduleMsg(logger, "vvt ratio %.2f", ratio);
}
if (ratio < boardConfiguration->nb2ratioFrom || ratio > boardConfiguration->nb2ratioTo) {
return;
}
if (engineConfiguration->isPrintTriggerSynchDetails) {
scheduleMsg(logger, "looks good: vvt ratio %f", ratio);
scheduleMsg(logger, "looks good: vvt ratio %.2f", ratio);
}
}
@ -339,10 +339,10 @@ static void triggerShapeInfo(void) {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
TriggerShape *s = &engine->triggerCentral.triggerShape;
scheduleMsg(logger, "useRise=%s", boolToString(s->useRiseEdge));
scheduleMsg(logger, "gap from %f to %f", s->syncRatioFrom, s->syncRatioTo);
scheduleMsg(logger, "gap from %.2f to %.2f", s->syncRatioFrom, s->syncRatioTo);
for (int i = 0; i < s->getSize(); i++) {
scheduleMsg(logger, "event %d %f", i, s->eventAngles[i]);
scheduleMsg(logger, "event %d %.2f", i, s->eventAngles[i]);
}
#endif
}
@ -385,16 +385,16 @@ void printAllTriggers() {
TriggerShape *s = &engine->triggerCentral.triggerShape;
s->initializeTriggerShape(NULL PASS_ENGINE_PARAMETER_SUFFIX);
fprintf(fp, "TRIGGERTYPE %d %d %s %f\r\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition);
fprintf(fp, "TRIGGERTYPE %d %d %s %.2f\r\n", triggerId, s->getLength(), getTrigger_type_e(tt), s->tdcPosition);
fprintf(fp, "# duty %f %f\r\n", s->dutyCycle[0], s->dutyCycle[1]);
fprintf(fp, "# duty %.2f %.2f\r\n", s->dutyCycle[0], s->dutyCycle[1]);
for (int i = 0; i < s->getLength(); i++) {
int triggerDefinitionCoordinate = (s->getTriggerShapeSynchPointIndex() + i) % s->getSize();
fprintf(fp, "event %d %d %f\r\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
fprintf(fp, "event %d %d %.2f\r\n", i, s->triggerSignals[triggerDefinitionCoordinate], s->eventAngles[i]);
}
}
@ -446,7 +446,7 @@ void triggerInfo(void) {
TriggerShape *ts = &engine->triggerCentral.triggerShape;
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s useOnlyFirstChannel=%s tdcOffset=%f",
scheduleMsg(logger, "Template %s (%d) trigger %s (%d) useRiseEdge=%s onlyFront=%s useOnlyFirstChannel=%s tdcOffset=%.2f",
getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType,
getTrigger_type_e(engineConfiguration->trigger.type), engineConfiguration->trigger.type,
boolToString(TRIGGER_SHAPE(useRiseEdge)), boolToString(engineConfiguration->useOnlyRisingEdgeForTrigger),
@ -469,7 +469,7 @@ void triggerInfo(void) {
scheduleMsg(logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->trigger.type,
boolToString(TRIGGER_SHAPE(needSecondTriggerInput)));
scheduleMsg(logger, "expected duty #0=%f/#1=%f", TRIGGER_SHAPE(dutyCycle[0]), TRIGGER_SHAPE(dutyCycle[1]));
scheduleMsg(logger, "expected duty #0=%.2f/#1=%.2f", TRIGGER_SHAPE(dutyCycle[0]), TRIGGER_SHAPE(dutyCycle[1]));
scheduleMsg(logger, "synchronizationNeeded=%s/isError=%s/total errors=%d ord_err=%d/total revolutions=%d/self=%s",
boolToString(ts->isSynchronizationNeeded),
@ -478,7 +478,7 @@ void triggerInfo(void) {
boolToString(engineConfiguration->directSelfStimulation));
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
scheduleMsg(logger, "gap from %f to %f", ts->syncRatioFrom, ts->syncRatioTo);
scheduleMsg(logger, "gap from %.2f to %.2f", ts->syncRatioFrom, ts->syncRatioTo);
}
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */

View File

@ -196,11 +196,11 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
// todo: skip a number of signal from the beginning
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// scheduleMsg(&logger, "from %f to %f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, currentDuration, shaftPositionState->toothed_previous_duration);
// scheduleMsg(&logger, "ratio %f", 1.0 * currentDuration/ shaftPositionState->toothed_previous_duration);
// scheduleMsg(&logger, "from %.2f to %.2f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, currentDuration, shaftPositionState->toothed_previous_duration);
// scheduleMsg(&logger, "ratio %.2f", 1.0 * currentDuration/ shaftPositionState->toothed_previous_duration);
#else
if (printTriggerDebug) {
printf("ratio %f: current=%d previous=%d\r\n", 1.0 * currentDuration / toothed_previous_duration,
printf("ratio %.2f: current=%d previous=%d\r\n", 1.0 * currentDuration / toothed_previous_duration,
currentDuration, toothed_previous_duration);
}
#endif
@ -243,7 +243,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
float gap3 = 1.0 * durationBeforePrevious / thirdPreviousDuration;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
scheduleMsg(logger, "%d: cur=%f/prev=%f/3rd=%f @ %d while expected from %f to %f and 2nd from %f to %f and 3rd from %f to %f error=%d",
scheduleMsg(logger, "%d: cur=%.2f/prev=%.2f/3rd=%.2f @ %d while expected from %.2f to %.2f and 2nd from %.2f to %.2f and 3rd from %.2f to %.2f error=%d",
getTimeNowSeconds(),
gap, prevGap, gap3,
currentCycle.current_index,
@ -253,7 +253,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
someSortOfTriggerError);
#else
actualSynchGap = gap;
print("current gap %f/%f/%f c=%d prev=%d\r\n", gap, prevGap, gap3, currentDuration, toothed_previous_duration);
print("current gap %.2f/%.2f/%.2f c=%d prev=%d\r\n", gap, prevGap, gap3, currentDuration, toothed_previous_duration);
#endif /* EFI_PROD_CODE */
}

View File

@ -352,7 +352,7 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {
printf("addEvent2 %f i=%d r/f=%d\r\n", angle, waveIndex, stateParam);
printf("addEvent2 %.2f i=%d r/f=%d\r\n", angle, waveIndex, stateParam);
}
#endif
@ -383,7 +383,7 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
efiAssertVoid(angle > 0, "angle should be positive");
if (size > 0) {
if (angle <= previousAngle) {
warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: %f and %f, size=%d", angle, previousAngle, size);
warning(CUSTOM_ERR_TRG_ANGLE_ORDER, "invalid angle order: %.2f and %.2f, size=%d", angle, previousAngle, size);
shapeDefinitionError = true;
return;
}
@ -492,7 +492,7 @@ void TriggerShape::setTriggerSynchronizationGap2(float syncRatioFrom, float sync
this->syncRatioTo = syncRatioTo;
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
if (printTriggerDebug) {
printf("setTriggerSynchronizationGap2 %f %f\r\n", syncRatioFrom, syncRatioTo);
printf("setTriggerSynchronizationGap2 %.2f %.2f\r\n", syncRatioFrom, syncRatioTo);
}
#endif /* EFI_UNIT_TEST */
}

View File

@ -79,7 +79,7 @@ void startEmulator(void) {
//static void printAdvance(int rpm, int maf100) {
// float advance = getAdvance(rpm, maf100 / 100.0);
// print("advance for %d rpm %d maf100: %f\r\n", rpm, maf100, advance);
// print("advance for %d rpm %d maf100: %.2f\r\n", rpm, maf100, advance);
//}
static void initECUstimulator(Engine *engine) {

View File

@ -62,7 +62,7 @@ void scAddData(float angle, float value) {
}
if (remainingSize(&logging) > 100) {
appendPrintf(&logging, "%f|%f|", angle, value);
appendPrintf(&logging, "%.2f|%.2f|", angle, value);
}
}

View File

@ -135,7 +135,7 @@ static void showHipInfo(void) {
}
printSpiState(logger, boardConfiguration);
scheduleMsg(logger, "enabled=%s state=%d bore=%fmm freq=%fkHz PaSDO=%d",
scheduleMsg(logger, "enabled=%s state=%d bore=%.2fmm freq=%.2fkHz PaSDO=%d",
boolToString(boardConfiguration->isHip9011Enabled),
state,
engineConfiguration->cylinderBore, getBand(),
@ -143,9 +143,9 @@ static void showHipInfo(void) {
char *outputName = getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, hipPinNameBuffer);
scheduleMsg(logger, "band_index=%d gain %f/index=%d output=%s", currentBandIndex, boardConfiguration->hip9011Gain, currentGainIndex,
scheduleMsg(logger, "band_index=%d gain %.2f/index=%d output=%s", currentBandIndex, boardConfiguration->hip9011Gain, currentGainIndex,
outputName);
scheduleMsg(logger, "integrator index=%d knockVThreshold=%f knockCount=%d maxKnockSubDeg=%f",
scheduleMsg(logger, "integrator index=%d knockVThreshold=%.2f knockCount=%d maxKnockSubDeg=%.2f",
currentIntergratorIndex, engineConfiguration->knockVThreshold,
engine->knockCount, engineConfiguration->maxKnockSubDeg);
@ -158,7 +158,7 @@ static void showHipInfo(void) {
msg);
scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(boardConfiguration->hip9011CsPin), settingUpdateCount);
scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f adv=%d",
scheduleMsg(logger, "hip %.2fv/last=%.2f@%s/max=%.2f adv=%d",
engine->knockVolts,
getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
@ -168,7 +168,7 @@ static void showHipInfo(void) {
scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "start %f end %f", engineConfiguration->knockDetectionWindowStart,
scheduleMsg(logger, "start %.2f end %.2f", engineConfiguration->knockDetectionWindowStart,
engineConfiguration->knockDetectionWindowEnd);
hipValueMax = 0;

View File

@ -513,7 +513,7 @@ void AdcDevice::enableChannelAndPin(adc_channel_e hwChannel) {
static void printAdcValue(adc_channel_e channel) {
int value = getAdcValue("print", channel);
float volts = adcToVoltsDivided(value);
scheduleMsg(&logger, "adc voltage : %f", volts);
scheduleMsg(&logger, "adc voltage : %.2f", volts);
}
adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) {
@ -537,7 +537,7 @@ static void printFullAdcReport(Logging *logger) {
appendPrintf(logger, " ch%d %s%d", index, portname(port), pin);
appendPrintf(logger, " ADC%d 12bit=%d", hwIndex, adcValue);
float volts = adcToVolts(adcValue);
appendPrintf(logger, " v=%f", volts);
appendPrintf(logger, " v=%.2f", volts);
appendMsgPostfix(logger);
scheduleLogging(logger);

View File

@ -58,7 +58,7 @@ static void processAdcPin(AdcDevice *adc, int index) {
// print("ADC%d val= %d%s", hwIndex, value, DELIMETER);
float volts = adcToVolts(adcValue) * 2;
print("v=%f adc=%d c=%d (hit 'n'<ENTER> for next step\r\n", volts, adcValue, c++);
print("v=%.2f adc=%d c=%d (hit 'n'<ENTER> for next step\r\n", volts, adcValue, c++);
chThdSleepMilliseconds(300);

View File

@ -135,7 +135,7 @@ static void egtRead(void) {
if (code != MC_INVALID) {
int refBits = ((egtPacket & 0xFFFF) / 16); // bits 15:4
float refTemp = refBits / 16.0;
scheduleMsg(logger, "reference temperature %f", refTemp);
scheduleMsg(logger, "reference temperature %.2f", refTemp);
scheduleMsg(logger, "EGT temperature %d", GET_TEMPERATURE_C(egtPacket));
}

View File

@ -50,13 +50,13 @@ static void printGpsInfo(void) {
scheduleMsg(&logging, "GPS RX %s", hwPortname(boardConfiguration->gps_rx_pin));
scheduleMsg(&logging, "GPS TX %s", hwPortname(boardConfiguration->gps_tx_pin));
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %f\r\n", gpsMesagesCount, uartErrors, getCurrentSpeed());
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f\r\n", gpsMesagesCount, uartErrors, getCurrentSpeed());
float sec = currentTimeMillis() / 1000.0;
scheduleMsg(&logging, "communication speed: %f", gpsMesagesCount / sec);
scheduleMsg(&logging, "communication speed: %.2f", gpsMesagesCount / sec);
print("GPS latitude = %f\r\n", GPSdata.latitude);
print("GPS longitude = %f\r\n", GPSdata.longitude);
print("GPS latitude = %.2f\r\n", GPSdata.latitude);
print("GPS longitude = %.2f\r\n", GPSdata.longitude);
}
static struct tm curTm;

View File

@ -35,7 +35,7 @@ void applyPinState(PwmConfig *state, int stateIndex) {
void startSimplePwm(PwmConfig *state, const char *msg, OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback) {
efiAssertVoid(dutyCycle >= 0 && dutyCycle <= 1, "dutyCycle");
if (frequency < 1) {
warning(CUSTOM_OBD_LOW_FREQUENCY, "low frequency %f", frequency);
warning(CUSTOM_OBD_LOW_FREQUENCY, "low frequency %.2f", frequency);
return;
}

View File

@ -37,7 +37,7 @@ static msg_t stThread(StepperMotor *motor) {
waitForSlowAdc();
// now check if stepper motor re-initialization is requested - if the throttle pedal is pressed at startup
bool forceStepperParking = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE) && getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > STEPPER_PARKING_TPS;
scheduleMsg(logger, "Stepper: savedStepperPos=%d forceStepperParking=%d (tps=%f)", motor->currentPosition, (forceStepperParking ? 1 : 0), getTPS(PASS_ENGINE_PARAMETER_SIGNATURE));
scheduleMsg(logger, "Stepper: savedStepperPos=%d forceStepperParking=%d (tps=%.2f)", motor->currentPosition, (forceStepperParking ? 1 : 0), getTPS(PASS_ENGINE_PARAMETER_SIGNATURE));
if (motor->currentPosition < 0 || forceStepperParking) {
// reset saved value

View File

@ -54,7 +54,7 @@ static void speedInfo(void) {
scheduleMsg(logger, "VSS input at %s",
hwPortname(boardConfiguration->vehicleSpeedSensorInputPin));
scheduleMsg(logger, "c=%f eventCounter=%d speed=%f",
scheduleMsg(logger, "c=%.2f eventCounter=%d speed=%.2f",
engineConfiguration->vehicleSpeedCoef,
engine->engineState.vssEventCounter,
getVehicleSpeed());

View File

@ -168,7 +168,7 @@ void appendFloat(Logging *logging, float value, int precision) {
break;
default:
appendPrintf(logging, "%f", value);
appendPrintf(logging, "%.2f", value);
}
}

View File

@ -64,9 +64,9 @@ static void runChprintfTest() {
msObjectInit(&testStream, (uint8_t *) testBuffer, sizeof(testBuffer), 0);
// it's a very, very long and mostly forgotten story how this became our %f precision format
// it's a very, very long and mostly forgotten story how this became our %.2f precision format
testStream.eos = 0; // reset
chprintf((BaseSequentialStream*)&testStream, "%f/%.4f/%.4f", 0.239f, 239.932, 0.1234);
chprintf((BaseSequentialStream*)&testStream, "%.2f/%.4f/%.4f", 0.239f, 239.932, 0.1234);
testStream.buffer[testStream.eos] = 0;
assertString(testBuffer, "0.23/239.9320/0.1234");
@ -87,8 +87,8 @@ static void runChprintfTest() {
}
{
LoggingWithStorage testLogging("test");
appendPrintf(&testLogging, "a%fb", -1.2);
assertString(testLogging.buffer, "a-1.20b");
appendPrintf(&testLogging, "a%.2fb%fc", -1.2, -3.4);
assertString(testLogging.buffer, "a-1.20b-3.400000095c");
}
}