From 41dee449ceb54451bc997d3b656391d5d0d2d229 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Thu, 7 Jul 2022 22:07:33 +1000 Subject: [PATCH] Get Thermal mass --- source/Core/BSP/BSP_Power.h | 2 ++ source/Core/BSP/Magic/BSP.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/Core/BSP/BSP_Power.h b/source/Core/BSP/BSP_Power.h index 37359bc9..3e7a3a07 100644 --- a/source/Core/BSP/BSP_Power.h +++ b/source/Core/BSP/BSP_Power.h @@ -19,6 +19,8 @@ void power_check(); // Returns the tip resistance in x10 ohms, so 7.5 = 75; 14=140 etc uint8_t getTipResitanceX10(); +uint8_t getTipThermalMass(); + #ifdef __cplusplus } #endif diff --git a/source/Core/BSP/Magic/BSP.cpp b/source/Core/BSP/Magic/BSP.cpp index 0dae5e47..70260acb 100644 --- a/source/Core/BSP/Magic/BSP.cpp +++ b/source/Core/BSP/Magic/BSP.cpp @@ -229,10 +229,17 @@ void setStatusLED(const enum StatusLED state) { uint8_t lastTipResistance = 0; // default to unknown uint32_t lastTipReadinguV = 0; uint8_t getTipResitanceX10() { - // Return tip resistance in x10 ohms + // Return tip resistance in x10 ohms // We can measure this using the op-amp return lastTipResistance; } + +uint8_t getTipThermalMass() { + if (lastTipResistance >= 80) { + return TIP_THERMAL_MASS; + } + return (TIP_THERMAL_MASS * 25) / 10; +} void startMeasureTipResistance() { // We want to calculate lastTipResistance // If tip is connected, and the tip is cold and the tip is not being heated