Use the uxTaskGetStackHighWaterMark() function to query the stack status
This commit is contained in:
parent
60dfae03c2
commit
145e6845a0
@ -41,6 +41,10 @@ void Read_Onboard_Temperature(void *pvParameters)
|
|||||||
adc_init();
|
adc_init();
|
||||||
adc_set_temp_sensor_enabled(true);
|
adc_set_temp_sensor_enabled(true);
|
||||||
adc_select_input(4); // Input 4 is the onboard temperature sensor.
|
adc_select_input(4); // Input 4 is the onboard temperature sensor.
|
||||||
|
|
||||||
|
UBaseType_t uxHighWaterMark;
|
||||||
|
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );
|
||||||
|
printf("%ld\n", uxHighWaterMark);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
const float conversionFactor = 3.3f / (1 << 12);
|
const float conversionFactor = 3.3f / (1 << 12);
|
||||||
@ -49,7 +53,10 @@ void Read_Onboard_Temperature(void *pvParameters)
|
|||||||
float tempC = 27.0f - (adc - 0.706f) / 0.001721f;
|
float tempC = 27.0f - (adc - 0.706f) / 0.001721f;
|
||||||
|
|
||||||
printf("Onboard temperature %.02f°C %.02f°F\n", tempC, (tempC * 9 / 5 + 32));
|
printf("Onboard temperature %.02f°C %.02f°F\n", tempC, (tempC * 9 / 5 + 32));
|
||||||
|
|
||||||
|
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );
|
||||||
|
printf("%ld\n", uxHighWaterMark);
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(3000)); // 非阻塞延时
|
vTaskDelay(pdMS_TO_TICKS(3000)); // 非阻塞延时
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +80,7 @@ int main(void)
|
|||||||
|
|
||||||
// CPU温度
|
// CPU温度
|
||||||
xReturned = xTaskCreate(Read_Onboard_Temperature, "Temperature task", 512, NULL, tskIDLE_PRIORITY, &Read_Onboard_Temperature_xHandle);
|
xReturned = xTaskCreate(Read_Onboard_Temperature, "Temperature task", 512, NULL, tskIDLE_PRIORITY, &Read_Onboard_Temperature_xHandle);
|
||||||
|
/*
|
||||||
// IM1253B 电压、功率模块
|
// IM1253B 电压、功率模块
|
||||||
xReturned = xTaskCreate(IM1253B, "IM1253B task", 1024, NULL, tskIDLE_PRIORITY, &IM1253B_xHandle);
|
xReturned = xTaskCreate(IM1253B, "IM1253B task", 1024, NULL, tskIDLE_PRIORITY, &IM1253B_xHandle);
|
||||||
|
|
||||||
@ -85,7 +92,7 @@ int main(void)
|
|||||||
|
|
||||||
// HC-04 蓝牙模块
|
// HC-04 蓝牙模块
|
||||||
xReturned = xTaskCreate(HC_04, "HC_04 task", 512, NULL, tskIDLE_PRIORITY, &HC_04_xHandle);
|
xReturned = xTaskCreate(HC_04, "HC_04 task", 512, NULL, tskIDLE_PRIORITY, &HC_04_xHandle);
|
||||||
|
*/
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user