From 526ea709454c6210be657993cce6fa7ce9f963e8 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Mon, 14 Oct 2024 21:26:19 -0500 Subject: [PATCH] simplify frame receive in video task --- components/box-emu/src/box-emu.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/components/box-emu/src/box-emu.cpp b/components/box-emu/src/box-emu.cpp index 2ff7899..a30e9b4 100644 --- a/components/box-emu/src/box-emu.cpp +++ b/components/box-emu/src/box-emu.cpp @@ -717,14 +717,7 @@ const uint16_t* BoxEmu::palette() const { bool BoxEmu::video_task_callback(std::mutex &m, std::condition_variable& cv) { const void *_frame_ptr; - if (xQueuePeek(video_queue_, &_frame_ptr, 100 / portTICK_PERIOD_MS) != pdTRUE) { - // we couldn't get anything from the queue, return - return false; - } - if (_frame_ptr == nullptr) { - // make sure we clear the queue - xQueueReceive(video_queue_, &_frame_ptr, 10 / portTICK_PERIOD_MS); - // we got a nullptr, return + if (xQueueReceive(video_queue_, &_frame_ptr, portMAX_DELAY) != pdTRUE) { return false; } static constexpr int num_lines_to_write = num_rows_in_framebuffer; @@ -835,9 +828,5 @@ bool BoxEmu::video_task_callback(std::mutex &m, std::condition_variable& cv) { } } } - - // we don't have to worry here since we know there was an item in the queue - // since we peeked earlier. - xQueueReceive(video_queue_, &_frame_ptr, 10 / portTICK_PERIOD_MS); return false; }