diff --git a/sdk/commands/enabled-sensors.ts b/sdk/commands/enabled-sensors.ts index 3e2b3bf..4e731c9 100644 --- a/sdk/commands/enabled-sensors.ts +++ b/sdk/commands/enabled-sensors.ts @@ -67,10 +67,15 @@ export class EnabledSensors extends StructBuffer< return true; } + override get byteLength() { + return 5; + } + override decode(view: DataView, littleEndian = false, offset = 0): Array[] { const decoded = twoEnabledSensors_t[this.count] .decode(view, littleEndian, offset) .flatMap>(splitTwoSensors); + // decoded now has a trailing entry for the 4 bits of padding on the end of data // so we slice to just the desired data return decoded.slice(0, 9); diff --git a/sdk/index.ts b/sdk/index.ts index 3e37caa..27a684d 100644 --- a/sdk/index.ts +++ b/sdk/index.ts @@ -32,8 +32,10 @@ export async function getStageConfig(dev: HIDDevice) { const encoded_config = smxconfig.encode(); if (encoded_config) { const buf = new Uint8Array(encoded_config.buffer); - console.log("Same Thing:", response.slice(2, -1).toString() === buf.toString()); + console.log("Config Encodes Correctly:", response.slice(2, -1).toString() === buf.toString()); } + + console.log(smxconfig); return smxconfig; } diff --git a/sdk/packet.ts b/sdk/packet.ts index 724e27e..dddb7f1 100644 --- a/sdk/packet.ts +++ b/sdk/packet.ts @@ -123,10 +123,8 @@ export async function process_packets(dev: HIDDevice, responseType: number, debu continue; } + // Create the data buffer here so we can check for start flags and ACKs const data_buffer = new Uint8Array(data.buffer); - if (responseType !== 121) { - console.log(data_buffer); - } // If we see an ACK Command just ignore it and restart if (data_buffer[0] === ACK_COMMAND) { @@ -151,7 +149,6 @@ export async function process_packets(dev: HIDDevice, responseType: number, debu } if (!seenFirstPacket) { - console.log(responseType, current_packet[0]); if (current_packet[0] === responseType) { seenFirstPacket = true; } else { diff --git a/ui/state.ts b/ui/state.ts index b465913..8fb9512 100644 --- a/ui/state.ts +++ b/ui/state.ts @@ -8,7 +8,7 @@ export const uiState = createStore(); /** backing atom of all known devices */ export const devices$ = atom>({}); -export const displayTestData$ = atom(true); +export const displayTestData$ = atom(false); /** current p1 pad, derived from devices$ above */ export const p1Dev$ = atom(