diff options
author | 2018-02-10 22:34:13 +0200 | |
---|---|---|
committer | 2018-02-10 22:34:13 +0200 | |
commit | 8f996f50529272f8a0096508f1a1be3cfef3f3b5 (patch) | |
tree | ff448e15b50c32d4e081609785add6ba360ce31e /src/tempmodule/main.ino | |
parent | e77063a1df7eb86b0c89bceaf849ac9038032000 (diff) | |
download | coffeetemp-8f996f50529272f8a0096508f1a1be3cfef3f3b5.tar.gz coffeetemp-8f996f50529272f8a0096508f1a1be3cfef3f3b5.tar.bz2 coffeetemp-8f996f50529272f8a0096508f1a1be3cfef3f3b5.zip |
tempmodule: fix resistance lookup.
Diffstat (limited to 'src/tempmodule/main.ino')
-rw-r--r-- | src/tempmodule/main.ino | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tempmodule/main.ino b/src/tempmodule/main.ino index 9b4dad9..9288deb 100644 --- a/src/tempmodule/main.ino +++ b/src/tempmodule/main.ino @@ -218,6 +218,8 @@ static int get_temperature(int res) {2785, 3430}, {2980, 3530}, {3182, 3630}, {3392, 3730}, {3607, 3830}}; + ret = -1; + for (i = 0; i < 9; ++i) { /* If we have a matching resistance, nothing to calculate. */ if (res == lt[i].res) { @@ -231,11 +233,10 @@ static int get_temperature(int res) ret = lt[i].temp + get_temp_subrange(lt[i].res, lt[i + 1].res, res); break; } - - return ret; } - return -1; + return ret; + } /* Returns the last 0-10 part of the temperature, in 0.1°K. */ |