diff --git a/components/svelte-portal/src/App.svelte b/components/svelte-portal/src/App.svelte index 8858b38..ff6a199 100644 --- a/components/svelte-portal/src/App.svelte +++ b/components/svelte-portal/src/App.svelte @@ -28,6 +28,8 @@ let uart_indicatior = undefined; let uart_terminal = undefined; + let web_socket = undefined; + function receive_uart(data) { uart_indicatior.activate(); uart_history_array_put(data); @@ -43,6 +45,10 @@ } } + function uart_send(data) { + web_socket.send(data); + } + const tabs = ["WiFi", "SYS", "PS", "UART"]; @@ -75,13 +81,13 @@ {:else if current_tab == tabs[3]} - + {/if} - + diff --git a/components/svelte-portal/src/lib/Input.svelte b/components/svelte-portal/src/lib/Input.svelte index f7871c3..86be881 100644 --- a/components/svelte-portal/src/lib/Input.svelte +++ b/components/svelte-portal/src/lib/Input.svelte @@ -1,6 +1,7 @@ diff --git a/components/svelte-portal/src/lib/UartTerminal.svelte b/components/svelte-portal/src/lib/UartTerminal.svelte index b09d6c7..afba022 100644 --- a/components/svelte-portal/src/lib/UartTerminal.svelte +++ b/components/svelte-portal/src/lib/UartTerminal.svelte @@ -23,6 +23,8 @@ export let on_mount = () => {}; + export let send; + function process_bytes() { let decoded = new TextDecoder().decode(new Uint8Array(bytes)); let last_line_complete = @@ -94,6 +96,19 @@ } }); } + + let tx = { + popup: null, + data: "", + eol: "\\r\\n", + }; + + async function uart_send() { + tx.popup.close(); + let eol = tx.eol.replaceAll("\\r", "\r").replaceAll("\\n", "\n"); + let data = tx.data + eol; + send("s" + data); + }
@@ -108,6 +123,7 @@ {/if}
+
@@ -160,6 +176,21 @@ {/if} + + + + + (tx.data = data)} />
+
+ + (tx.eol = data)} /> + +
+
+
+