Skip to content

Commit

Permalink
release v0.30a source release
Browse files Browse the repository at this point in the history
  • Loading branch information
russeree committed Nov 28, 2023
1 parent 54e991a commit a0992dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h3>Your browser does not support the Web Serial API. Use Chrome/Chromium</h3>
<div class="content">
<h2>NyanOS (NOS) Graphical User Interface</h2>
<p>A basic interface to your keyboard - Click the Nyan cat and get connected.</p>
<!-- XTerm Javascript Terminal -->
<div id="terminal"></div>
</div>

Expand Down
13 changes: 3 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let reader: ReadableStreamDefaultReader | ReadableStreamBYOBReader | undefined;

const urlParams = new URLSearchParams(window.location.search);
const usePolyfill = urlParams.has('polyfill');
const bufferSize = 8 * 65536; // 8kB
const bufferSize = 8 * 65536; // 65.5kB

const term = new Terminal({
scrollback: 0,
Expand All @@ -54,14 +54,12 @@ const term = new Terminal({

const fitAddon = new FitAddon();
term.loadAddon(fitAddon);

term.loadAddon(new WebLinksAddon());

const encoder = new TextEncoder();

term.onData((data) => {
if (port?.writable == null) {
console.warn(`unable to find writable port`);
return;
}

Expand Down Expand Up @@ -112,17 +110,13 @@ async function connectToPort(): Promise<void> {
parity: 'none' as ParityType,
stopBits: 1,
flowControl: 'none' as FlowControlType,
bufferSize: 8 * 1024,
bufferSize: bufferSize,
};

console.log(options);

try {
await port.open(options);
await port.setSignals({dataTerminalReady: false});
term.clear();
term.writeln('<CONNECTED>');
await port.setSignals({dataTerminalReady: true});
connectButton.disabled = false;
if (connectBubble) {
connectBubble.style.display = 'none'; // Hide the connectBubble
Expand Down Expand Up @@ -261,8 +255,7 @@ document.addEventListener('DOMContentLoaded', async () => {
if (port && port.writable) {
try {
const byteArray = new Uint8Array(reader.result as ArrayBuffer);
const chunkSize = 64;

const chunkSize = 128;
const writer = port.writable.getWriter();
const initialMessage = `write-bitstream ${byteArray.length}\r\n`;
await writer.write(new TextEncoder().encode(initialMessage));
Expand Down

0 comments on commit a0992dc

Please sign in to comment.