diff options
author | 2018-04-27 10:04:26 +0300 | |
---|---|---|
committer | 2018-04-27 10:04:26 +0300 | |
commit | 23d06a17f8a4033be57ca46079e5c3e65fa9e845 (patch) | |
tree | 7bfec5a9deedcc1e7de7c9ecd54ecf36020212c8 /src/tempmodule/indicator.c | |
parent | 884013b71ba9abd9ab0c9d0a8f90a769aff9b6a9 (diff) | |
download | coffeetemp-23d06a17f8a4033be57ca46079e5c3e65fa9e845.tar.gz coffeetemp-23d06a17f8a4033be57ca46079e5c3e65fa9e845.tar.bz2 coffeetemp-23d06a17f8a4033be57ca46079e5c3e65fa9e845.zip |
various minor improvements.
Diffstat (limited to 'src/tempmodule/indicator.c')
-rw-r--r-- | src/tempmodule/indicator.c | 9 |
1 files changed, 7 insertions, 2 deletions
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) |