Skip to content

Commit

Permalink
Fixed firmware upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jLynx committed Jan 27, 2024
1 parent 671795b commit c94bdc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/components/SerialProvider/SerialProvider.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c94bdc7

Please sign in to comment.