diff --git a/next.config.js b/next.config.js index 686299c..43a7257 100644 --- a/next.config.js +++ b/next.config.js @@ -3,7 +3,7 @@ const nextConfig = { output: "export", basePath: process.env.NEXT_PUBLIC_BASE_PATH ?? "", - reactStrictMode: true, // Enable React strict mode for improved error handling + reactStrictMode: false, swcMinify: true, // Enable SWC minification for improved performance compiler: { removeConsole: process.env.NODE_ENV !== "development", // Remove console.log in production diff --git a/src/components/SerialProvider/SerialProvider.tsx b/src/components/SerialProvider/SerialProvider.tsx index f74f873..19a10cc 100644 --- a/src/components/SerialProvider/SerialProvider.tsx +++ b/src/components/SerialProvider/SerialProvider.tsx @@ -1,3 +1,4 @@ +import { useWriteCommand } from "@/utils/serialUtils"; import { useCallback, useEffect, useRef, useState } from "react"; // Needing to do this as the typescript definitions for the Web Serial API are not yet complete @@ -326,7 +327,10 @@ const useWebSerial = ({ ); if (lastCommandIndex) { - if (completeString.startsWith(lastCommandIndex.command)) { + if ( + completeString.startsWith(lastCommandIndex.command) || + lastCommandIndex.command === "binary" + ) { lastCommandIndex.response = completeString; lastProcessedCommand = lastProcessedCommand + 1; } else { @@ -466,7 +470,7 @@ const useWebSerial = ({ const queueWriteAndResponseBinary = async (message: Uint8Array) => { const id = commandCounter.current++; - const messageString = "long msg"; + const messageString = "binary"; // const messageString = String.fromCharCode.apply( // null, // Array.from(new Uint8Array(message))