From 7711969e572bd9e7c37edbda722ce4d0a0ab50ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 13 Feb 2022 20:02:55 +0000 Subject: [PATCH] ftostr12ns: change xx from long to int flash: -44 RAM: 0 Largest expected number is 999 after the multiplication by 100. I measured the execution time drops from ~170us to ~73us. --- Firmware/conv2str.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/conv2str.cpp b/Firmware/conv2str.cpp index 10aa711e4..291c15848 100644 --- a/Firmware/conv2str.cpp +++ b/Firmware/conv2str.cpp @@ -104,7 +104,7 @@ char *ftostr43(const float &x, uint8_t offset) //Float to string with 1.23 format char *ftostr12ns(const float &x) { - long xx = x * 100; + int xx = x * 100; xx = abs(xx); conv[0] = (xx / 100) % 10 + '0';