From 38f06079e7851d5773b0aa5ada7613411f56455a Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Fri, 26 May 2023 15:52:52 +0800 Subject: [PATCH 1/2] [Shell] Add vTaskDelay to free cpu --- examples/platform/ameba/shell/launch_shell.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/platform/ameba/shell/launch_shell.cpp b/examples/platform/ameba/shell/launch_shell.cpp index 435966b27e89fa..40a0517b7e2b66 100644 --- a/examples/platform/ameba/shell/launch_shell.cpp +++ b/examples/platform/ameba/shell/launch_shell.cpp @@ -27,7 +27,9 @@ namespace { void MatterShellTask(void * args) { + const TickType_t xDelay = 1000 / portTICK_PERIOD_MS; chip::Shell::Engine::Root().RunMainLoop(); + vTaskDelay(xDelay); } } // namespace From cea8df829e3622565a3f02cbb188a294bcfd7229 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Fri, 26 May 2023 18:05:41 +0800 Subject: [PATCH 2/2] add delay in matter shell loop --- examples/platform/ameba/shell/launch_shell.cpp | 2 -- src/lib/shell/MainLoopAmeba.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/platform/ameba/shell/launch_shell.cpp b/examples/platform/ameba/shell/launch_shell.cpp index 40a0517b7e2b66..435966b27e89fa 100644 --- a/examples/platform/ameba/shell/launch_shell.cpp +++ b/examples/platform/ameba/shell/launch_shell.cpp @@ -27,9 +27,7 @@ namespace { void MatterShellTask(void * args) { - const TickType_t xDelay = 1000 / portTICK_PERIOD_MS; chip::Shell::Engine::Root().RunMainLoop(); - vTaskDelay(xDelay); } } // namespace diff --git a/src/lib/shell/MainLoopAmeba.cpp b/src/lib/shell/MainLoopAmeba.cpp index 0526980e7f6080..b8476a5dd9a9f0 100644 --- a/src/lib/shell/MainLoopAmeba.cpp +++ b/src/lib/shell/MainLoopAmeba.cpp @@ -146,6 +146,7 @@ void Engine::RunMainLoop() ProcessShellLine(reinterpret_cast(line)); #endif } + vTaskDelay(pdMS_TO_TICKS(10)); // delay 10ms } }