Questions about freertos(ESP32-s3)
Posted: Mon Jan 29, 2024 1:57 pm
Just started to contact ESP32 also please everyone Pointers.
I tried to create 3 tasks. But no matter how hard you try, there's always a task that's not being performed.
For example, the following code, why not print "sweetHomeTask", which is very confusing to me.
The default freertos configuration is used (idf.py menuconfig)
I tried to create 3 tasks. But no matter how hard you try, there's always a task that's not being performed.
For example, the following code, why not print "sweetHomeTask", which is very confusing to me.
The default freertos configuration is used (idf.py menuconfig)
- #include <iostream>
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "peripheral_init.h"
- #include "SweetHome.h"
- #include "mpu6050_driver.h"
- #include <esp_system.h>
- using namespace std;
- static TaskHandle_t gyroTaskHandle;
- static TaskHandle_t lifeSupportHandle;
- static TaskHandle_t sweetHomeHandle;
- // SemaphoreHandle_t lvglSemaphore = NULL;
- static void gyroTask(void *pvParameters) {
- mpu6050_driver_init();
- for(;;) {
- mpu6050_driver_get_data();
- vTaskDelay(pdMS_TO_TICKS(20));
- }
- }
- static void sweetHomeTask(void *pvParameters) {
- printf("sweetHomeTask\n");
- for(;;) {
- vTaskDelay(pdMS_TO_TICKS(30));
- printf(">>>>>>>>>>>>>>>>>>>%d\n", xPortGetCoreID());
- // lv_timer_handler();
- }
- }
- static void lifeSupportTask(void *pvParameters) {
- xTaskCreate(sweetHomeTask, "sweetHome", 1024*50, NULL, 10, &sweetHomeHandle);
- for(;;) {
- vTaskDelay(pdMS_TO_TICKS(1000));
- // lv_timer_handler();
- lv_tick_inc(5);
- printf("================%d\n", xPortGetCoreID());
- }
- }
- extern "C" void app_main(void)
- {
- peripheral_lcd_init();
- xTaskCreatePinnedToCore(gyroTask, "gyro", 1024*50, NULL, 5, &gyroTaskHandle, 1);
- xTaskCreatePinnedToCore(lifeSupportTask, "lifeSupport", 1024*50, NULL, 6, &lifeSupportHandle, 0);
- printf("end free heap: %ld\n", esp_get_free_heap_size()); // 8439892
- }