From 63d3d63ad0a0a9f27e2295d8955e7d5b5fd09578 Mon Sep 17 00:00:00 2001 From: zhoujie <929834232@qq.com> Date: Sat, 14 Mar 2026 10:43:20 +0800 Subject: [PATCH] 7 --- prj/TCPClient/User/FreeRTOSConfig.h | 2 +- prj/TCPClient/User/main.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/prj/TCPClient/User/FreeRTOSConfig.h b/prj/TCPClient/User/FreeRTOSConfig.h index 3c74007..3511370 100644 --- a/prj/TCPClient/User/FreeRTOSConfig.h +++ b/prj/TCPClient/User/FreeRTOSConfig.h @@ -97,7 +97,7 @@ #define configTICK_RATE_HZ ( ( TickType_t ) 500 ) #define configMAX_PRIORITIES ( 15 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */ -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 12 * 1024 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 diff --git a/prj/TCPClient/User/main.c b/prj/TCPClient/User/main.c index 3c9819a..98faf37 100644 --- a/prj/TCPClient/User/main.c +++ b/prj/TCPClient/User/main.c @@ -187,6 +187,20 @@ void WCHNET_HandleGlobalInt(void) } } +/* ============================================================ + * RTOS Task: Heartbeat (periodic print for debug) + * ============================================================ */ +static void task_heartbeat_entry(void *pvParameters) +{ + (void)pvParameters; + uint32_t cnt = 0; + while (1) + { + printf("[HB] %lu tick=%lu\r\n", cnt++, xTaskGetTickCount()); + vTaskDelay(pdMS_TO_TICKS(2000)); + } +} + /* ============================================================ * RTOS Task: WCHNET protocol stack driver (highest priority) * ============================================================ */ @@ -291,6 +305,7 @@ int main(void) xTaskCreate(task_wchnet_entry, "wchnet", 1024, NULL, 6, NULL); xTaskCreate(task_business_entry, "business", 1024, NULL, 5, NULL); + xTaskCreate(task_heartbeat_entry, "hb", 256, NULL, 3, NULL); vTaskStartScheduler(); /* Should never reach here */