mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Correct the NTC lookup
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "Setup.h"
|
#include "Setup.h"
|
||||||
#include "TipThermoModel.h"
|
#include "TipThermoModel.h"
|
||||||
#include "USBPD.h"
|
#include "USBPD.h"
|
||||||
|
#include "Utils.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "history.hpp"
|
#include "history.hpp"
|
||||||
@@ -29,107 +30,51 @@ void resetWatchdog() {
|
|||||||
static const int32_t NTCHandleLookup[] = {
|
static const int32_t NTCHandleLookup[] = {
|
||||||
// ADC Reading , Temp in C x10
|
// ADC Reading , Temp in C x10
|
||||||
|
|
||||||
// 64179, -400, //
|
3221, -400, //
|
||||||
// 64001, -390, //
|
4144, -350, //
|
||||||
// 63813, -380, //
|
5271, -300, //
|
||||||
// 63618, -370, //
|
6622, -250, //
|
||||||
// 63415, -360, //
|
8219, -200, //
|
||||||
// 63204, -350, //
|
10075, -150, //
|
||||||
// 62983, -340, //
|
12190, -100, //
|
||||||
// 62757, -330, //
|
14554, -50, //
|
||||||
// 62518, -320, //
|
17151, 0, //
|
||||||
// 62271, -310, //
|
19937, 50, //
|
||||||
// 62012, -300, //
|
22867, 100, //
|
||||||
// 61748, -290, //
|
25886, 150, //
|
||||||
// 61473, -280, //
|
28944, 200, //
|
||||||
// 61186, -270, //
|
29546, 210, //
|
||||||
// 60891, -260, //
|
30159, 220, //
|
||||||
// 60585, -250, //
|
30769, 230, //
|
||||||
// 60268, -240, //
|
31373, 240, //
|
||||||
// 59941, -230, //
|
31969, 250, //
|
||||||
// 59604, -220, //
|
32566, 260, //
|
||||||
// 59255, -210, //
|
33159, 270, //
|
||||||
58896, -200, //
|
33749, 280, //
|
||||||
58526, -190, //
|
34334, 290, //
|
||||||
58145, -180, //
|
34916, 300, //
|
||||||
57752, -170, //
|
35491, 310, //
|
||||||
57349, -160, //
|
36062, 320, //
|
||||||
56934, -150, //
|
36628, 330, //
|
||||||
56510, -140, //
|
37186, 340, //
|
||||||
56073, -130, //
|
37739, 350, //
|
||||||
55626, -120, //
|
38286, 360, //
|
||||||
55167, -110, //
|
38825, 370, //
|
||||||
54699, -100, //
|
39358, 380, //
|
||||||
54220, -90, //
|
39884, 390, //
|
||||||
53729, -80, //
|
40400, 400, //
|
||||||
53229, -70, //
|
42879, 450, //
|
||||||
52717, -60, //
|
45160, 500, //
|
||||||
52200, -50, //
|
47235, 550, //
|
||||||
51667, -40, //
|
49111, 600, //
|
||||||
51128, -30, //
|
50792, 650, //
|
||||||
50582, -20, //
|
52292, 700, //
|
||||||
50025, -10, //
|
53621, 750, //
|
||||||
49455, 0, //
|
54797, 800, //
|
||||||
48883, 10, //
|
55836, 850, //
|
||||||
48302, 20, //
|
56748, 900, //
|
||||||
47712, 30, //
|
57550, 950, //
|
||||||
47116, 40, //
|
58257, 1000, //
|
||||||
46510, 50, //
|
|
||||||
45902, 60, //
|
|
||||||
45286, 70, //
|
|
||||||
44666, 80, //
|
|
||||||
44044, 90, //
|
|
||||||
43412, 100, //
|
|
||||||
42783, 110, //
|
|
||||||
42148, 120, //
|
|
||||||
41500, 130, //
|
|
||||||
40860, 140, //
|
|
||||||
40222, 150, //
|
|
||||||
39576, 160, //
|
|
||||||
38935, 170, //
|
|
||||||
38289, 180, //
|
|
||||||
37640, 190, //
|
|
||||||
36989, 200, //
|
|
||||||
36353, 210, //
|
|
||||||
35705, 220, //
|
|
||||||
35060, 230, //
|
|
||||||
34422, 240, //
|
|
||||||
33792, 250, //
|
|
||||||
33160, 260, //
|
|
||||||
32534, 270, //
|
|
||||||
31910, 280, //
|
|
||||||
31291, 290, //
|
|
||||||
30677, 300, //
|
|
||||||
30069, 310, //
|
|
||||||
29466, 320, //
|
|
||||||
28867, 330, //
|
|
||||||
28277, 340, //
|
|
||||||
27693, 350, //
|
|
||||||
27115, 360, //
|
|
||||||
26544, 370, //
|
|
||||||
25981, 380, //
|
|
||||||
25426, 390, //
|
|
||||||
24880, 400, //
|
|
||||||
24339, 410, //
|
|
||||||
23806, 420, //
|
|
||||||
23281, 430, //
|
|
||||||
22767, 440, //
|
|
||||||
22259, 450, //
|
|
||||||
// 21761, 460, //
|
|
||||||
// 21268, 470, //
|
|
||||||
// 20787, 480, //
|
|
||||||
// 20313, 490, //
|
|
||||||
// 19848, 500, //
|
|
||||||
// 19392, 510, //
|
|
||||||
// 18945, 520, //
|
|
||||||
// 18507, 530, //
|
|
||||||
// 18076, 540, //
|
|
||||||
// 17655, 550, //
|
|
||||||
// 17242, 560, //
|
|
||||||
// 16838, 570, //
|
|
||||||
// 16442, 580, //
|
|
||||||
// 16052, 590, //
|
|
||||||
// 15672, 600, //
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -138,28 +83,7 @@ uint16_t getHandleTemperature(uint8_t sample) {
|
|||||||
// Tip is wired up with an NTC thermistor
|
// Tip is wired up with an NTC thermistor
|
||||||
// 10K NTC balanced with a 10K pulldown
|
// 10K NTC balanced with a 10K pulldown
|
||||||
// NTCG163JF103FTDS
|
// NTCG163JF103FTDS
|
||||||
#ifdef TEMP_NTC
|
return Utils::InterpolateLookupTable(NTCHandleLookup, sizeof(NTCHandleLookup) / (2 * sizeof(int32_t)), result);
|
||||||
// vout =
|
|
||||||
// For now not doing interpolation
|
|
||||||
for (uint32_t i = 0; i < (sizeof(NTCHandleLookup) / (2 * sizeof(uint16_t))); i++) {
|
|
||||||
if (result > NTCHandleLookup[(i * 2) + 0]) {
|
|
||||||
return NTCHandleLookup[(i * 2) + 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 45 * 10;
|
|
||||||
#endif
|
|
||||||
#ifdef TEMP_TMP36
|
|
||||||
#warn This is not shipped in production
|
|
||||||
result -= 10240; // remove 0.5V offset
|
|
||||||
// 10mV per C
|
|
||||||
// 204.7 counts per Deg C above 0C
|
|
||||||
result *= 10;
|
|
||||||
result /= 205;
|
|
||||||
if (result < 0) {
|
|
||||||
result = 0;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample) {
|
uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample) {
|
||||||
|
|||||||
Reference in New Issue
Block a user