Skip to content

Commit 2ddc709

Browse files
committed
[fix]: Fix button_task stack overflow
1 parent 81481e4 commit 2ddc709

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

ESP32/cpp/src/yolo11n.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ struct VlmData {
9191
bool finish;
9292
};
9393

94-
const int buttonPin = 8;
94+
const int BlueButtonPin = 8;
95+
const int RedButtonPin = 9;
9596
static constexpr std::size_t box_count = 7;
9697
static box_t box_list[box_count];
9798
static yolo_box_t yolo_box;
@@ -125,7 +126,8 @@ void play_camera_wav()
125126

126127
void setup_bsp(void)
127128
{
128-
pinMode(buttonPin, INPUT_PULLUP);
129+
pinMode(BlueButtonPin, INPUT_PULLUP);
130+
pinMode(RedButtonPin, INPUT_PULLUP);
129131
}
130132

131133
void setup_lcd(void)
@@ -527,11 +529,20 @@ void recvTask(void* pvParameters)
527529
void button_task(void* pvParameters)
528530
{
529531
while (true) {
530-
if (!digitalRead(buttonPin)) {
532+
if (!digitalRead(BlueButtonPin)) {
531533
play_camera_wav();
532534
button = true;
533535
vTaskDelay(1000);
534536
}
537+
if (!digitalRead(RedButtonPin)) {
538+
play_wav();
539+
state = 0;
540+
vTaskDelay(100);
541+
if (!yolo_work_id.isEmpty()) module_llm.yolo.exit(yolo_work_id);
542+
if (!vlm_work_id.isEmpty()) module_llm.vlm.exit(vlm_work_id);
543+
if (!melotts_work_id.isEmpty()) module_llm.melotts.exit(melotts_work_id);
544+
setup_menu();
545+
}
535546
vTaskDelay(100);
536547
}
537548
}
@@ -609,10 +620,9 @@ void cameraTask(void* pvParameters)
609620
canvas.drawString("<", 30, 40);
610621
if (button) {
611622
box_list[6].draw();
612-
module_llm.vlm.inference(vlm_work_id,
613-
"请用幽默的方式描述这张图片,字数不超过60个。");
614-
button = false;
615-
inference = true;
623+
module_llm.vlm.inference(vlm_work_id, "请用幽默的方式描述这张图片,字数不超过60个。");
624+
button = false;
625+
inference = true;
616626
vlm_data.finish = false;
617627
canvas.fillRect(0, 0, 320, 240, WHITE);
618628
M5.Display.setCursor(50, 50);
@@ -643,7 +653,7 @@ void setup_task(void)
643653
xTaskCreatePinnedToCore(cameraTask, "Camera Task", 8192, NULL, 2, NULL, 0);
644654
xTaskCreatePinnedToCore(menuTask, "Menu Task", 8192, NULL, 1, NULL, 1);
645655
xTaskCreatePinnedToCore(menuBackTask, "Menu Back Task", 8192, NULL, 1, NULL, 1);
646-
xTaskCreatePinnedToCore(button_task, "Button Task", 2048, NULL, 3, NULL, 1);
656+
xTaskCreatePinnedToCore(button_task, "Button Task", 8192, NULL, 3, NULL, 1);
647657
}
648658

649659
void setup()

0 commit comments

Comments
 (0)