mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-994 Move temp calculation to a macro defined in pios_board.h as it is achitecture dependant
+review OPReview-506
This commit is contained in:
parent
cea6496866
commit
840e6aa4f7
@ -472,7 +472,7 @@ static void updateStats()
|
||||
idleCounterClear = 1;
|
||||
#if defined(PIOS_INCLUDE_ADC) && defined(PIOS_ADC_USE_TEMP_SENSOR)
|
||||
float temp_voltage = PIOS_ADC_PinGetVolt(PIOS_ADC_TEMPERATURE_PIN);
|
||||
stats.CPUTemp = (temp_voltage - PIOS_ADC_STM32_TEMP_V25) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f;
|
||||
stats.CPUTemp = PIOS_CONVERT_VOLT_TO_CPU_TEMP(temp_voltage);;
|
||||
#endif
|
||||
SystemStatsSet(&stats);
|
||||
}
|
||||
|
@ -218,6 +218,8 @@ extern uint32_t pios_com_hkosd_id;
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 0
|
||||
#define PIOS_ADC_STM32_TEMP_V25 1.43f /* V */
|
||||
#define PIOS_ADC_STM32_TEMP_AVG_SLOPE 4.3f /* mV/C */
|
||||
#define PIOS_CONVERT_VOLT_TO_CPU_TEMP(x) ((PIOS_ADC_STM32_TEMP_V25 - x) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f)
|
||||
|
||||
// ------------------------
|
||||
// PIOS_RCVR
|
||||
// See also pios_board.c
|
||||
|
@ -238,6 +238,8 @@ extern uint32_t pios_ppm_out_id;
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 0
|
||||
#define PIOS_ADC_STM32_TEMP_V25 1.43f /* V */
|
||||
#define PIOS_ADC_STM32_TEMP_AVG_SLOPE 4.3f /* mV/C */
|
||||
#define PIOS_CONVERT_VOLT_TO_CPU_TEMP(x) ((PIOS_ADC_STM32_TEMP_V25 - x) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f)
|
||||
|
||||
// ------------------------
|
||||
// PIOS_RCVR
|
||||
// See also pios_board.c
|
||||
|
@ -230,6 +230,7 @@ extern uint32_t pios_com_telem_usb_id;
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 6 /* V */
|
||||
#define PIOS_ADC_STM32_TEMP_V25 0.76f /* mV/C */
|
||||
#define PIOS_ADC_STM32_TEMP_AVG_SLOPE 2.5f
|
||||
#define PIOS_CONVERT_VOLT_TO_CPU_TEMP(x) ((x - PIOS_ADC_STM32_TEMP_V25) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f)
|
||||
|
||||
// *****************************************************************
|
||||
// USB
|
||||
|
@ -298,6 +298,7 @@ extern uint32_t pios_packet_handler;
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 3
|
||||
#define PIOS_ADC_STM32_TEMP_V25 0.76f /* V */
|
||||
#define PIOS_ADC_STM32_TEMP_AVG_SLOPE 2.5f /* mV/C */
|
||||
#define PIOS_CONVERT_VOLT_TO_CPU_TEMP(x) ((x - PIOS_ADC_STM32_TEMP_V25) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f)
|
||||
|
||||
// -------------------------
|
||||
// USB
|
||||
|
@ -260,6 +260,7 @@ extern uint32_t pios_com_hkosd_id;
|
||||
#define PIOS_ADC_TEMPERATURE_PIN 3 /* V */
|
||||
#define PIOS_ADC_STM32_TEMP_V25 0.76f /* mV/C */
|
||||
#define PIOS_ADC_STM32_TEMP_AVG_SLOPE 2.5f
|
||||
#define PIOS_CONVERT_VOLT_TO_CPU_TEMP(x) ((x - PIOS_ADC_STM32_TEMP_V25) * 1000.0f / PIOS_ADC_STM32_TEMP_AVG_SLOPE + 25.0f)
|
||||
|
||||
// -------------------------
|
||||
// USB
|
||||
|
Loading…
Reference in New Issue
Block a user