From 98c96d34329fdc28da2c14f4583cffa8f7361b22 Mon Sep 17 00:00:00 2001 From: Luigi Date: Tue, 26 Aug 2025 14:23:15 +0200 Subject: [PATCH] Update asr.py Fixed the search_command_num function in libs/unit/asr.py to return the command number for a given word --- m5stack/libs/unit/asr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/m5stack/libs/unit/asr.py b/m5stack/libs/unit/asr.py index ace7e6df..e07ae04b 100644 --- a/m5stack/libs/unit/asr.py +++ b/m5stack/libs/unit/asr.py @@ -287,7 +287,8 @@ def search_command_num(self, command_word: str) -> int: asr.search_command_num("custom command") """ - return -1 + command_dict = {v[0]: k for k, v in self._COMMAND_LIST.items()} + return command_dict.get(command_word, -1) def search_command_word(self, command_num: int) -> str: """Search for the command word associated with a command number.