From 791c24f50091ddc88abe98763d5adebd5f344576 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Fri, 28 Feb 2025 13:26:53 -0500 Subject: [PATCH] fix: added a notes fild to Dynamic form allowing for notes to inform users about using BLE and wifi at the same time. --- src/components/Form/DynamicForm.tsx | 3 +++ .../PageComponents/Config/Bluetooth.tsx | 4 +++- src/components/PageComponents/Config/Network.tsx | 4 +++- .../PageComponents/Config/Security/Security.tsx | 2 +- src/components/PageComponents/Connect/Serial.tsx | 15 +++++++++++---- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/Form/DynamicForm.tsx b/src/components/Form/DynamicForm.tsx index 7009c89a..62d00397 100644 --- a/src/components/Form/DynamicForm.tsx +++ b/src/components/Form/DynamicForm.tsx @@ -27,6 +27,7 @@ export interface BaseFormBuilderProps { disabledBy?: DisabledBy[]; label: string; description?: string; + notes?: string; validationText?: string; properties?: Record; } @@ -45,6 +46,7 @@ export interface DynamicFormProps { fieldGroups: { label: string; description: string; + notes?: string; valid?: boolean; validationText?: string; fields: FieldProps[]; @@ -96,6 +98,7 @@ export function DynamicForm({

{fieldGroup.label}

{fieldGroup.description} + {fieldGroup?.notes}
{fieldGroup.fields.map((field) => ( diff --git a/src/components/PageComponents/Config/Bluetooth.tsx b/src/components/PageComponents/Config/Bluetooth.tsx index 21bc7c4e..c14bb2e8 100644 --- a/src/components/PageComponents/Config/Bluetooth.tsx +++ b/src/components/PageComponents/Config/Bluetooth.tsx @@ -69,7 +69,9 @@ export const Bluetooth = () => { fieldGroups={[ { label: "Bluetooth Settings", - description: "Settings for the Bluetooth module", + description: "Settings for the Bluetooth module ", + notes: + "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", fields: [ { type: "toggle", diff --git a/src/components/PageComponents/Config/Network.tsx b/src/components/PageComponents/Config/Network.tsx index afda4eb5..5598ef49 100644 --- a/src/components/PageComponents/Config/Network.tsx +++ b/src/components/PageComponents/Config/Network.tsx @@ -7,7 +7,7 @@ import { } from "@core/utils/ip.ts"; import { Protobuf } from "@meshtastic/js"; -export const Network = (): JSX.Element => { +export const Network = () => { const { config, setWorkingConfig } = useDevice(); const onSubmit = (data: NetworkValidation) => { @@ -49,6 +49,8 @@ export const Network = (): JSX.Element => { { label: "WiFi Config", description: "WiFi radio configuration", + notes: + "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", fields: [ { type: "toggle", diff --git a/src/components/PageComponents/Config/Security/Security.tsx b/src/components/PageComponents/Config/Security/Security.tsx index 9a1c72e9..61c53e11 100644 --- a/src/components/PageComponents/Config/Security/Security.tsx +++ b/src/components/PageComponents/Config/Security/Security.tsx @@ -241,7 +241,7 @@ export const Security = () => { ? getErrorMessage("adminKey") : "", inputChange: adminKeyInputChangeEvent, - selectChange: () => { }, + selectChange: () => {}, bits: [{ text: "256 bit", value: "32", key: "bit256" }], devicePSKBitCount: state.privateKeyBitCount, hide: !state.adminKeyVisible, diff --git a/src/components/PageComponents/Connect/Serial.tsx b/src/components/PageComponents/Connect/Serial.tsx index 529b8c3d..70388d73 100644 --- a/src/components/PageComponents/Connect/Serial.tsx +++ b/src/components/PageComponents/Connect/Serial.tsx @@ -17,7 +17,9 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => { setSerialPorts(await navigator?.serial.getPorts()); }, []); - navigator?.serial?.addEventListener("connect", () => { + navigator?.serial?.addEventListener("connect", (event) => { + console.log(event); + updateSerialPortList(); }); navigator?.serial?.addEventListener("disconnect", () => { @@ -39,16 +41,22 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => { concurrentLogOutput: true, }) .catch((e: Error) => console.log(`Unable to Connect: ${e.message}`)); + console.log(connection); + device.addConnection(connection); subscribeAll(device, connection); closeDialog(); }; + console.log(serialPorts); + return (
{serialPorts.map((port, index) => { + console.log(port); + const { usbProductId, usbVendorId } = port.getInfo(); return ( ); })}