feat: complete device serial api implementation

This commit is contained in:
2023-07-24 21:04:42 +02:00
parent 21dbfa48de
commit e64082d578
8 changed files with 219 additions and 49 deletions

View File

@@ -56,8 +56,18 @@
<div class="backdrop" transition:fade={{duration: 250}} on:click={() => (powerDialog = !powerDialog)} />
<dialog open transition:slide={{duration: 250}}>
<h3>Boot Menu</h3>
<button><span class="icon">restart_alt</span>Reboot WIP</button>
<button><span class="icon">rule_settings</span>Bootloader WIP</button>
<button
on:click={() => {
$serialPort.reboot()
$serialPort = undefined
}}><span class="icon">restart_alt</span>Reboot</button
>
<button
on:click={() => {
$serialPort.bootloader()
$serialPort = undefined
}}><span class="icon">rule_settings</span>Bootloader</button
>
</dialog>
{/if}
{/if}

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import {chords} from "$lib/serial/connection"
import {chords, serialPort} from "$lib/serial/connection"
import {KEYMAP_CODES} from "$lib/serial/keymap-codes"
import FlexSearch from "flexsearch"
import type {Index} from "flexsearch"
@@ -7,6 +7,7 @@
import type {Chord} from "$lib/serial/chord"
import tippy from "tippy.js"
import {calculateChordCoverage} from "$lib/chords/coverage"
import {SETTING_IDS} from "$lib/serial/settings"
$: searchIndex = $chords?.length > 0 ? buildIndex($chords) : undefined
@@ -44,6 +45,11 @@
{/if}
<button class="icon" on:click={sort}>sort</button>
<button class="icon">filter_list</button>
{#if $serialPort}
{#await $serialPort.getSetting(SETTING_IDS.enableChording) then enableChording}
<label><input type="checkbox" checked={enableChording !== 0} /> Enable Chording</label>
{/await}
{/if}
<section>
<table>

View File

@@ -0,0 +1,4 @@
<script>
</script>
<label><input type="checkbox" />Serial Log</label>