mirror of
https://github.com/Ralim/IronOS.git
synced 2025-07-23 12:23:06 +02:00
* Update documentation to build IronOS in Windows using MSYS2 environment and fix compilation on case-sensitive file systems. --------- Co-authored-by: Ivan Zorin <ivan.a.zorin@gmail.com>
26 lines
842 B
C++
26 lines
842 B
C++
/*
|
|
* ThermoModel.cpp
|
|
*
|
|
* Created on: 1 May 2021
|
|
* Author: Ralim
|
|
*/
|
|
#include "Setup.h"
|
|
#include "TipThermoModel.h"
|
|
#include "Types.h"
|
|
#include "Utils.hpp"
|
|
#include "configuration.h"
|
|
|
|
extern uint16_t tipSenseResistancex10Ohms;
|
|
TemperatureType_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
|
|
// For the MHP30, we are mimicing the original code and using the resistor fitted to the base of the heater head,
|
|
// this is measured at boot in pid task and in the disconnected tip check if tip is removed
|
|
if (tipSenseResistancex10Ohms > 900 && tipSenseResistancex10Ohms <= 1100) {
|
|
int32_t a = ((tipSenseResistancex10Ohms / 10) + 300) * (3300000 - tipuVDelta);
|
|
int32_t b = a / 1000000;
|
|
int32_t c = tipuVDelta - b;
|
|
int32_t d = c * 243 / 1000;
|
|
return d / 10;
|
|
}
|
|
return 0xFFFF;
|
|
}
|