I hope you are all heading to have a great Christmas and Holidays. I am seeing a very strange behaviour (using STM32L462CE) with Printout and Sprintf Libraries they both will give widely wrong output for float values if they are formatted as %f it seems to be almost always +1 for some parameters. It is also intermittent is not always happing I have tried double and long double but they are giving the same error . Even reading ADC and converting to voltage will cause a problem. if you change to %e or %E you get the correct value. Can anyone help with this issue.
Code: Select all
Battery_Voltage=(float) Battery_Voltage_Raw*3.3f/1024.0f;
PrintOut(PrintHandler,"Value=%f\n",Battery_Voltage);