From 7ecb3ff21cfcd1c16974e9964728a8758c3d51f6 Mon Sep 17 00:00:00 2001 From: William Clark Date: Mon, 5 Dec 2022 12:44:45 +0000 Subject: [PATCH] forgot to convert the value --- core/th7/service.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/th7/service.go b/core/th7/service.go index adf7bf6..047429f 100644 --- a/core/th7/service.go +++ b/core/th7/service.go @@ -84,17 +84,27 @@ func startCacheService(t *TH7Adapter) { cjc_uv, err := thermocouple.UV(tc, pcb_temperature) if err != nil { log.Println("Error doing CJC", err) - continue + } else { + + data[k].Value -= cjc_uv + data[k].Unit = t.cfg.Channels[k].Unit } - data[k].Value -= cjc_uv - data[k].Unit = t.cfg.Channels[k].Unit } else { // CJC can not be applied // board temp out of range for specified thermocouple type // perhaps just subtract board temperature? dont know fmt.Println("No valid CJC", t.cfg.Channels[k]) } + + new_value_c, err := thermocouple.C(tc, data[k].Value) + if err != nil { + log.Println("Error converting UV to C", t.cfg.Channels[k], data[k].Value) + } + + data[k].Value = new_value_c + + //TODO: different temp units } t.mu.Lock()