From c306b84f6cad967bd6da509692018c8f9f346253 Mon Sep 17 00:00:00 2001 From: Dmytro Huz Date: Tue, 29 Nov 2022 16:50:34 +0200 Subject: [PATCH 1/4] Added shell CLI command "matter factoryreset" to Telink lighting-app --- config/telink/app/zephyr.conf | 3 ++- examples/lighting-app/telink/src/AppTask.cpp | 21 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/config/telink/app/zephyr.conf b/config/telink/app/zephyr.conf index c83f5aeccca9c4..bd920eff8b4d49 100644 --- a/config/telink/app/zephyr.conf +++ b/config/telink/app/zephyr.conf @@ -106,5 +106,6 @@ CONFIG_DYNAMIC_INTERRUPTS=y # nvs_sector_size = flash_page_size * mult = 256 * 8 = 2048 CONFIG_SETTINGS_NVS_SECTOR_SIZE_MULT=8 -# Shall settings +# Shell settings +CONFIG_SHELL=n CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=255 \ No newline at end of file diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index a310bdb1907560..1a7bc1b7a419f8 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -48,6 +48,27 @@ #include +#ifdef CONFIG_CHIP_LIB_SHELL +#include + +static int cmd_telink_factoryreset(const struct shell *shell, size_t argc, + char **argv) +{ + ARG_UNUSED(argc); + ARG_UNUSED(argv); + + shell_print(shell, "Performing factoryreset ..."); + chip::Server::GetInstance().ScheduleFactoryReset(); + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(sub_demo, + SHELL_CMD(factoryreset, NULL, "Reset NVS partition command.", cmd_telink_factoryreset), + SHELL_SUBCMD_SET_END +); +SHELL_CMD_REGISTER(matter, &sub_demo, "Telink Matter commands", NULL); +#endif + LOG_MODULE_DECLARE(app); using namespace ::chip; From 01a1597b389dad5d89766bbd17c01bc8c098dbee Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Tue, 29 Nov 2022 16:51:56 +0200 Subject: [PATCH 2/4] [Telink] Restyled --- examples/lighting-app/telink/src/AppTask.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 1a7bc1b7a419f8..cc0c7227dc1620 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -51,21 +51,18 @@ #ifdef CONFIG_CHIP_LIB_SHELL #include -static int cmd_telink_factoryreset(const struct shell *shell, size_t argc, - char **argv) +static int cmd_telink_factoryreset(const struct shell * shell, size_t argc, char ** argv) { - ARG_UNUSED(argc); - ARG_UNUSED(argv); + ARG_UNUSED(argc); + ARG_UNUSED(argv); - shell_print(shell, "Performing factoryreset ..."); - chip::Server::GetInstance().ScheduleFactoryReset(); - return 0; + shell_print(shell, "Performing factoryreset ..."); + chip::Server::GetInstance().ScheduleFactoryReset(); + return 0; } -SHELL_STATIC_SUBCMD_SET_CREATE(sub_demo, - SHELL_CMD(factoryreset, NULL, "Reset NVS partition command.", cmd_telink_factoryreset), - SHELL_SUBCMD_SET_END -); +SHELL_STATIC_SUBCMD_SET_CREATE(sub_demo, SHELL_CMD(factoryreset, NULL, "Reset NVS partition command.", cmd_telink_factoryreset), + SHELL_SUBCMD_SET_END); SHELL_CMD_REGISTER(matter, &sub_demo, "Telink Matter commands", NULL); #endif From a16715f42d54e24335ce291c05b11415db8f062d Mon Sep 17 00:00:00 2001 From: Dmytro Huz Date: Tue, 29 Nov 2022 17:28:03 +0200 Subject: [PATCH 3/4] [Telink] use correct zephyr include path --- src/lib/shell/MainLoopZephyr.cpp | 4 ++-- src/lib/shell/streamer_zephyr.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/shell/MainLoopZephyr.cpp b/src/lib/shell/MainLoopZephyr.cpp index e70a29c52c9dce..17b5d8438499a5 100644 --- a/src/lib/shell/MainLoopZephyr.cpp +++ b/src/lib/shell/MainLoopZephyr.cpp @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +#include +#include #include #include diff --git a/src/lib/shell/streamer_zephyr.cpp b/src/lib/shell/streamer_zephyr.cpp index 40a16d56fbbd94..aad69438ab24b0 100644 --- a/src/lib/shell/streamer_zephyr.cpp +++ b/src/lib/shell/streamer_zephyr.cpp @@ -24,8 +24,8 @@ #include -#include -#include +#include +#include namespace chip { namespace Shell { From 80d1dde95456659a53c1f824669bc24c9eed908e Mon Sep 17 00:00:00 2001 From: Dmytro Huz Date: Wed, 30 Nov 2022 17:22:11 +0200 Subject: [PATCH 4/4] [Telink] reverted to using default shell commands set --- examples/lighting-app/telink/src/AppTask.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index cc0c7227dc1620..a310bdb1907560 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -48,24 +48,6 @@ #include -#ifdef CONFIG_CHIP_LIB_SHELL -#include - -static int cmd_telink_factoryreset(const struct shell * shell, size_t argc, char ** argv) -{ - ARG_UNUSED(argc); - ARG_UNUSED(argv); - - shell_print(shell, "Performing factoryreset ..."); - chip::Server::GetInstance().ScheduleFactoryReset(); - return 0; -} - -SHELL_STATIC_SUBCMD_SET_CREATE(sub_demo, SHELL_CMD(factoryreset, NULL, "Reset NVS partition command.", cmd_telink_factoryreset), - SHELL_SUBCMD_SET_END); -SHELL_CMD_REGISTER(matter, &sub_demo, "Telink Matter commands", NULL); -#endif - LOG_MODULE_DECLARE(app); using namespace ::chip;