diff --git a/core/th7/service.go b/core/th7/service.go index 047429f..97ebe06 100644 --- a/core/th7/service.go +++ b/core/th7/service.go @@ -88,23 +88,23 @@ func startCacheService(t *TH7Adapter) { data[k].Value -= cjc_uv data[k].Unit = t.cfg.Channels[k].Unit + + 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) + } + + //TODO: different temp units + data[k].Value = new_value_c } } 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]) + fmt.Println("No valid CJC for Channel", t.cfg.Channels[k].Id) } - 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()