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()