summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-20 16:59:07 +0900
committerTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-20 16:59:07 +0900
commit377a16d4e37f864431b15a963e6984fd33c8aa0c (patch)
tree520030bf48add2cd93007bd457ffd3ca377c9092
parent52233abc17f2238ffa4ee0a10b72376d503766b2 (diff)
Fix math for temp
QML sets temp to 15~30 and this binding convert it to 0x10~0xF0 Change-Id: I027853e2279ff8b9a5e4a169bf7a7f549cf73a1e Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
-rw-r--r--binding/hvac-demo-binding.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/binding/hvac-demo-binding.c b/binding/hvac-demo-binding.c
index 4913380..3eb1876 100644
--- a/binding/hvac-demo-binding.c
+++ b/binding/hvac-demo-binding.c
@@ -148,7 +148,7 @@ static int open_can_dev()
// Get original get temperature function from cpp hvacplugin code
static uint8_t to_can_temp(uint8_t value)
{
- int result = ((0xF0 - 0x10) / 15) * value - 16;
+ int result = ((0xF0 - 0x10) / 15) * (value - 15) + 0x10;
if (result < 0x10)
result = 0x10;
if (result > 0xF0)