From 4846f7130563c06818ffd1fd493d9cbd046fae47 Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Wed, 6 Sep 2023 10:18:12 +0200
Subject: [PATCH] Fix log logic error

---
 CLC-qthing/SiliconTorch/Service/SpiderFurnace.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/CLC-qthing/SiliconTorch/Service/SpiderFurnace.cpp b/CLC-qthing/SiliconTorch/Service/SpiderFurnace.cpp
index fc9e3e6..3c3170e 100644
--- a/CLC-qthing/SiliconTorch/Service/SpiderFurnace.cpp
+++ b/CLC-qthing/SiliconTorch/Service/SpiderFurnace.cpp
@@ -176,9 +176,13 @@ namespace SiliconTorch {
 
             if (cnt++ >= 10) {
 
-              u64 logAge    = Time::ms()    - lastLogTime;
-              f32 logDeltaT = temperature() - lastLogTemp;
-              lastLogTime   = Time::ms();
+              u64 timeMS = Time::ms();
+              f32 _temp  = temperature();
+
+              u64 logAge    = timeMS - lastLogTime;
+              f32 logDeltaT = _temp  - lastLogTemp;
+              lastLogTime   = timeMS;
+              lastLogTemp   = _temp;
 
               f32 tempChangeRate = logDeltaT / (logAge / 1000.0f);  // K/s
 
-- 
GitLab