mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Handle NTC in TS80P
This commit is contained in:
@@ -16,8 +16,108 @@ history<uint16_t, PID_TIM_HZ> rawTempFilter = { { 0 }, 0, 0 };
|
||||
void resetWatchdog() {
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
}
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
//Lookup table for the NTC
|
||||
//Stored as ADCReading,Temp in degC
|
||||
static const uint16_t NTCHandleLookup[] = {
|
||||
//ADC Reading , Temp in C
|
||||
29189, 0, //
|
||||
29014, 1, //
|
||||
28832, 2, //
|
||||
28644, 3, //
|
||||
28450, 4, //
|
||||
28249, 5, //
|
||||
28042, 6, //
|
||||
27828, 7, //
|
||||
27607, 8, //
|
||||
27380, 9, //
|
||||
27146, 10, //
|
||||
26906, 11, //
|
||||
26660, 12, //
|
||||
26407, 13, //
|
||||
26147, 14, //
|
||||
25882, 15, //
|
||||
25610, 16, //
|
||||
25332, 17, //
|
||||
25049, 18, //
|
||||
24759, 19, //
|
||||
24465, 20, //
|
||||
24164, 21, //
|
||||
23859, 22, //
|
||||
23549, 23, //
|
||||
23234, 24, //
|
||||
22915, 25, //
|
||||
22591, 26, //
|
||||
22264, 27, //
|
||||
21933, 28, //
|
||||
21599, 29, //
|
||||
21261, 30, //
|
||||
20921, 31, //
|
||||
20579, 32, //
|
||||
20234, 33, //
|
||||
19888, 34, //
|
||||
19541, 35, //
|
||||
19192, 36, //
|
||||
18843, 37, //
|
||||
18493, 38, //
|
||||
18143, 39, //
|
||||
17793, 40, //
|
||||
17444, 41, //
|
||||
17096, 42, //
|
||||
16750, 43, //
|
||||
16404, 44, //
|
||||
16061, 45, //
|
||||
15719, 46, //
|
||||
15380, 47, //
|
||||
15044, 48, //
|
||||
14710, 49, //
|
||||
14380, 50, //
|
||||
14053, 51, //
|
||||
13729, 52, //
|
||||
13410, 53, //
|
||||
13094, 54, //
|
||||
12782, 55, //
|
||||
12475, 56, //
|
||||
12172, 57, //
|
||||
11874, 58, //
|
||||
11580, 59, //
|
||||
11292, 60, //
|
||||
11008, 61, //
|
||||
10729, 62, //
|
||||
10455, 63, //
|
||||
10187, 64, //
|
||||
9923, 65, //
|
||||
9665, 66, //
|
||||
9412, 67, //
|
||||
9164, 68, //
|
||||
8921, 69, //
|
||||
8684, 70, //
|
||||
8451, 71, //
|
||||
8225, 72, //
|
||||
8003, 73, //
|
||||
7786, 74, //
|
||||
7575, 75, //
|
||||
7368, 76, //
|
||||
7167, 77, //
|
||||
6970, 78, //
|
||||
6779, 79, //
|
||||
6592, 80, //
|
||||
};
|
||||
#endif
|
||||
uint16_t getHandleTemperature() {
|
||||
#ifdef MODEL_TS80P
|
||||
//TS80P uses 100k NTC resistors instead
|
||||
//NTCG104EF104FT1X from TDK
|
||||
//For now not doing interpolation
|
||||
int32_t result = getADC(0);
|
||||
for (int i = 0; i < (sizeof(NTCHandleLookup) / (2 * sizeof(uint16_t)));
|
||||
i++) {
|
||||
if (result > NTCHandleLookup[(i * 2) + 0]) {
|
||||
return NTCHandleLookup[(i * 2) + 1] * 10;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
// We return the current handle temperature in X10 C
|
||||
// TMP36 in handle, 0.5V offset and then 10mV per deg C (0.75V @ 25C for
|
||||
// example) STM32 = 4096 count @ 3.3V input -> But We oversample by 32/(2^2) =
|
||||
@@ -32,6 +132,7 @@ uint16_t getHandleTemperature() {
|
||||
result *= 100;
|
||||
result /= 993;
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16_t getTipInstantTemperature() {
|
||||
|
||||
@@ -98,7 +98,7 @@ extern uint32_t SystemCoreClock;
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configTICK_RATE_HZ ((TickType_t)100)
|
||||
#define configMAX_PRIORITIES ( 6 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)1024*14) /*Currently use about 9000*/
|
||||
|
||||
Reference in New Issue
Block a user