|

楼主 |
发表于 2024-8-22 23:02:56
|
显示全部楼层
任务执行一次就卡死了,static void MQTT_Platform(void *para) { /*send the message to MQTT servicer*/ printf("enter MQTT_Platform successfully\r\n"); char data_buffer[1024] = {0}; // data buffer Initialization msg.payload = data_buffer; msg.qos = QOS0; while (1) { platform_mutex_lock(&G_xTaskMutex); // waitting for ping message xEventGroupWaitBits((EventGroupHandle_t)Event_Handle, (EventBits_t)PING_MODE1|PING_MODE2, // add event signal in here (BaseType_t)pdTRUE, // clear the signal when complete once upload (BaseType_t)pdTRUE, (TickType_t)portMAX_DELAY); if (xQueueReceive(G_xMessageQueueToMQTT, data_buffer + strlen(data_buffer), 10)) { printf("number is %d\r\n",(int*)uxQueueMessagesWaiting(G_xMessageQueueToMQTT)); printf("remained memory size :%d\r\n",(int*)uxTaskGetStackHighWaterMark(G_xQueuePlatform)); while (xQueueReceive(G_xMessageQueueToMQTT, data_buffer + strlen(data_buffer), 10)) { printf("state is %d\r\n",(int*)xTaskGetSchedulerState()); } msg.payloadlen = strlen(msg.payload); mqtt_publish(client, "mcu_test", &msg); // publish the message to mqtt server memset(data_buffer, 0, sizeof(data_buffer)); // reset data buffer platform_mutex_unlock(&G_xTaskMutex); printf("send data to MQTT server successfully\r\n"); vTaskDelay(pdMS_TO_TICKS(1000)); } else { printf("No data received\r\n"); platform_mutex_unlock(&G_xTaskMutex); vTaskDelay(1000); } } } |
|