From cf33ef3228e3e9c0754036f28e585497025d6b4b Mon Sep 17 00:00:00 2001 From: jahugg <jan@huggenberg.ch> Date: Wed, 1 Mar 2023 13:14:35 +0100 Subject: [PATCH] added voice commands --- src/main.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main.js b/src/main.js index 5bf6f34..70c3e69 100644 --- a/src/main.js +++ b/src/main.js @@ -515,7 +515,11 @@ function addVoiceControls() { let index = commands.indexOf(command); // get index of command in array let path = availableCommands[index].path; // get corresponding path in availableCommands array navigateToPath(path); - } + } else if (command === "select" || command === "okay") navigateToSelected(); + else if (command === "open") moveDownNavigationLevel(); + else if (command === "emergency call") + navigateToPath("/menu/call/emergency"); + else if (command === "exit") navigateToPath("/"); }; recognition.onspeechend = function () { @@ -544,16 +548,8 @@ function addVoiceControls() { availableCommands.push(command); } - // add custom commands - availableCommands.push({ command: "exit", path: "/" }); - availableCommands.push({ - command: "emergency call", - path: "/menu/call/emergency", - }); - // form commands array for grammarlist commands = availableCommands.map((x) => x.command); - printLogMsg(`Voice > Commands: [${commands}]`); } } @@ -621,7 +617,7 @@ function addMotionControls() { let targetY = averageY; targetY = (targetY - referenceY) * -sensitivity; - // drawMotion(targetY); + drawMotion(targetY); focusClosestItem(targetY); } } -- GitLab