add chord serialization, vitest

This commit is contained in:
2023-07-08 13:29:57 +02:00
parent dbd02e9dec
commit 44f82f2b4e
8 changed files with 1150 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
import {writable} from "svelte/store"
import {CharaDevice} from "$lib/serial/device"
import type {Chord} from "$lib/serial/chord"
export const serialPort = writable<CharaDevice>()
@@ -10,11 +11,6 @@ export interface SerialLogEntry {
export const serialLog = writable<SerialLogEntry[]>([])
export interface Chord {
actions: number[]
phrase: string
}
export const chords = writable<Chord[]>([])
export type CharaLayout = [number[], number[], number[]]
@@ -43,7 +39,6 @@ export async function initSerial() {
for (let i = 0; i < chordCount; i++) {
chordInfo.push(await device.getChord(i))
}
chordInfo.sort(({phrase: a}, {phrase: b}) => a.localeCompare(b))
chords.set(chordInfo)
syncing.set(false)
}