aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-03 09:53:00 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-03 09:53:00 +0200
commit10f83102061c3d7d0d6a506c3feb149ef067eb0e (patch)
treef1b018409e1c8c59655fa254bf836cd378220c51
parent6206140d8db1a3b46a78b25a1ac7ded65b920e8a (diff)
downloadglutte-o-matic-10f83102061c3d7d0d6a506c3feb149ef067eb0e.tar.gz
glutte-o-matic-10f83102061c3d7d0d6a506c3feb149ef067eb0e.tar.bz2
glutte-o-matic-10f83102061c3d7d0d6a506c3feb149ef067eb0e.zip
Fix TEMP printout
-rw-r--r--src/common/Core/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/Core/main.c b/src/common/Core/main.c
index f2aaf93..52f1663 100644
--- a/src/common/Core/main.c
+++ b/src/common/Core/main.c
@@ -502,9 +502,16 @@ static void gps_monit_task(void __attribute__ ((unused))*pvParameters) {
}
if (temperature_valid()) {
- const float temp = temperature_get();
+ float temp = temperature_get();
stats_temp(temp);
- usart_debug("TEMP %d.%02d\r\n", (int)temp, (int)(temp * 100.0f - (int)(temp) * 100.0f));
+
+ const char *sign = "";
+ if (temp < 0) {
+ sign = "-";
+ temp = -temp;
+ }
+
+ usart_debug("TEMP %s%d.%02d\r\n", sign, (int)temp, (int)(temp * 100.0f - (int)(temp) * 100.0f));
}
else {
usart_debug("TEMP invalid\r\n");