-
Notifications
You must be signed in to change notification settings - Fork 1
Telemetry via serial port #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||||||
| import { useEffect, useState } from "react"; | ||||||||||
| import { Select, Flex, useInterval } from "@chakra-ui/react"; | ||||||||||
|
|
||||||||||
| export default function SerialSelector() { | ||||||||||
| const [allDevices, setAllDevices] = useState([]); | ||||||||||
| const [selectedDevice, setSelectedDevice] = useState(""); // State to hold the selected device name | ||||||||||
| const [selectedBaud, setSelectedBaud] = useState(115200); | ||||||||||
|
|
||||||||||
| const refresh = () => { | ||||||||||
| fetch('/serial-info') | ||||||||||
| .then((response) => { | ||||||||||
| if (response.ok) { | ||||||||||
| return response.json(); | ||||||||||
| } else { | ||||||||||
| throw new Error(`Error fetching serial port with code ${response.status}`); | ||||||||||
| } | ||||||||||
| }) | ||||||||||
| .then((body) => { | ||||||||||
| setSelectedDevice(body['connected_device']['device']); // Set default device | ||||||||||
|
||||||||||
| setSelectedDevice(body['connected_device']['device']); // Set default device | |
| if (!selectedDevice) { // Only set default device if no device is selected | |
| setSelectedDevice(body['connected_device']['device']); | |
| } |
Copilot
AI
Jun 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.target.value is a string but selectedBaud is numeric—wrap with parseInt(e.target.value, 10) to ensure the state stays a number.
| onChange={e => setSelectedBaud(e.target.value)} | |
| onChange={e => setSelectedBaud(parseInt(e.target.value, 10))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Footer tag is missing the closing slash—should be
b'</bsr>'to match the regex and proper packet parsing.