efiPrint NaN handling #4115

This commit is contained in:
rusefi 2022-08-31 20:00:58 -04:00
parent 29fede7a65
commit 21a1b022e7
1 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,7 @@ int getRemainingStack(thread_t*) {
static void assertString(const char*actual, const char *expected) {
if (strcmp(actual, expected) != 0) {
printf("assertString FAILED\n");
firmwareError(OBD_PCM_Processor_Fault, "chprintf test: got %s while %s", actual, expected);
}
}
@ -47,6 +48,11 @@ static void runChprintfTest() {
msObjectInit(&ts, (uint8_t *) testBuffer, sizeof(testBuffer), 0);
ts.eos = 0; // reset
// chprintf((BaseSequentialStream*)&ts, "%.2f - %.2f", NAN, 0/0);
// ts.buffer[ts.eos] = 0;
// assertString(testBuffer, "0.23/239.9320/0.1234");
// it's a very, very long and mostly forgotten story how this became our %.2f precision format
ts.eos = 0; // reset
chprintf((BaseSequentialStream*)&ts, "%.2f/%.4f/%.4f", 0.239f, 239.932, 0.1234);