From 23d06a17f8a4033be57ca46079e5c3e65fa9e845 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Fri, 27 Apr 2018 10:04:26 +0300 Subject: various minor improvements. --- src/tempmodule/indicator.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/tempmodule/indicator.c') diff --git a/src/tempmodule/indicator.c b/src/tempmodule/indicator.c index 774c801..4c1b958 100644 --- a/src/tempmodule/indicator.c +++ b/src/tempmodule/indicator.c @@ -57,8 +57,13 @@ void indicator_init(unsigned int temp, unsigned int const * const calibration) } -void indicator_update(unsigned int temp) +void indicator_update(const unsigned int temp, const unsigned int on) { + if (!on) { + indicator_set_state(0, 0, 0); + return; + } + if (temp > state.calibration[0]) { indicator_set_state(1, 0, 0); } else if (temp > state.calibration[1]) { @@ -75,7 +80,7 @@ void indicator_update(unsigned int temp) void indicator_calibrate(unsigned int const * const calibration) { memcpy(state.calibration, calibration, sizeof(state.calibration)); - indicator_update(state.current_temp); + indicator_update(state.current_temp, 1); } static void indicator_set_state(unsigned int red, unsigned int green, unsigned int blue) -- cgit v1.2.3