This commit is contained in:
2025-08-05 04:20:26 -04:00
parent 2072e669cc
commit a896ce6c06

View File

@@ -69,7 +69,7 @@ void app_main(void)
printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024), printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size()); printf("Minimum free heap size: %" PRIu32 " Kbytes\n", esp_get_minimum_free_heap_size() / (uint32_t)(1024));
// Create mutex and queues // Create mutex and queues
xMutex = xSemaphoreCreateMutex(); xMutex = xSemaphoreCreateMutex();
@@ -109,13 +109,13 @@ void task1(void *pvParameters) {
xQueueSend(xQueue1, &task_data, 0); xQueueSend(xQueue1, &task_data, 0);
printf("Task 1 sent x=%" PRIu32 "\n", x); printf("Task 1 sent x=%" PRIu32 "\n", x);
x+=2; x+=2;
vTaskDelay((500)); vTaskDelay(500);
xSemaphoreGive(xMutex); xSemaphoreGive(xMutex);
} }
else { else {
printf("Task 1 timed out waiting for mutex\n"); printf("Task 1 timed out waiting for mutex\n");
} }
vTaskDelay((100)); vTaskDelay(100);
} }
} }
@@ -136,13 +136,13 @@ void task2(void *pvParameters) {
xQueueSend(xQueue2, &task_data, 0); xQueueSend(xQueue2, &task_data, 0);
printf("Task 2 sent y=%" PRIu32 "\n", y); printf("Task 2 sent y=%" PRIu32 "\n", y);
y++; y++;
vTaskDelay((250)); vTaskDelay(250);
xSemaphoreGive(xMutex); xSemaphoreGive(xMutex);
} }
else { else {
printf("Task 2 timed out waiting for mutex\n"); printf("Task 2 timed out waiting for mutex\n");
} }
vTaskDelay((100)); vTaskDelay(100);
} }
} }