From 81f32d189ffd8b9b7207f6d2549796439e2e1863 Mon Sep 17 00:00:00 2001
From: "Carlo A. Nicolau" <cnicolau@km3net.de>
Date: Wed, 24 Jan 2024 15:27:49 +0100
Subject: [PATCH] temperature sensors conversion formula corrected (python only
 update)

---
 host/python/codegen/analogvariables.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/host/python/codegen/analogvariables.py b/host/python/codegen/analogvariables.py
index 3d1a8be..f207102 100644
--- a/host/python/codegen/analogvariables.py
+++ b/host/python/codegen/analogvariables.py
@@ -49,11 +49,19 @@ def convert_chn2meas_TEMP2(_chn):
 
     # new version with quadratic fit
     # (Rocco's mail 9/12/2021)
-    a = -15.327
-    b = 65.478
-    c = -8.819
-    v = channel2voltage_ADC(_chn)
-    return quadratic(a,b,c,v)
+    # a = -15.327
+    # b = 65.478
+    # c = -8.819
+    # v = channel2voltage_ADC(_chn)
+    # return quadratic(a,b,c,v)
+
+    # new version with linear fit
+    # (Rocco's mail  02/05/2023)
+    # temperature = 23.24 * voltage - 25.79
+    a = 23.24
+    b = -25.79
+    v = chennale2voltage_ADC(_chn)
+    return linear_regression(0.0, b, 1.0, a + b, v)
 
 def convert_chn2meas_TEMP1(_chn):
     # same as TEMP2
-- 
GitLab