From 139529309185f4be24dd27aa958038d04827d647 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Thu, 13 Jun 2019 23:59:47 -0500 Subject: [PATCH] Make that a bit easier to read --- src/thermo.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/thermo.c b/src/thermo.c index c50ddeb..deef70b 100644 --- a/src/thermo.c +++ b/src/thermo.c @@ -76,12 +76,16 @@ void hexagram_thermo_draw_face(hexagram_thermo *thermo, void hexagram_thermo_draw_needle(hexagram_thermo *thermo, cairo_t *cr, double temp) { - if (temp > 260) { - temp = 260; + double fahrenheit = temp * (9.0 / 5.0) + 32.0; + + if (fahrenheit < 120) { + fahrenheit = 120; + } else if (fahrenheit > 260) { + fahrenheit = 260; } hexagram_gauge_draw_needle(&thermo->gauge, cr, 0.9, - ((temp * (9.0/5.0) + 32.0) - 120) / 140.0); + (fahrenheit - 120) / 140.0); }