Skip to content

Commit 9a1667b

Browse files
committed
Merge branch 'main' into fc/add-panel-test-mode
2 parents 7b3ac81 + 77f8f38 commit 9a1667b

25 files changed

+2208
-2089
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ jobs:
1616
runs-on: ubuntu-latest
1717
name: Vite Build
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/configure-pages@v5
21-
- uses: actions/setup-node@v4
19+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20+
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
21+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
2222
with:
23-
node-version: 20
23+
node-version: 22
2424
cache: "yarn"
2525
- run: yarn --immutable
2626

2727
- name: Vite Build
2828
run: yarn build
2929
- name: Upload artifact
30-
uses: actions/upload-pages-artifact@v3
30+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
3131
with:
3232
path: ./dist
3333
deploy:
@@ -43,5 +43,5 @@ jobs:
4343
steps:
4444
- name: Deploy to GitHub Pages
4545
id: deployment
46-
uses: actions/deploy-pages@v4
46+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
4747

.github/workflows/status-checks.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ jobs:
77
runs-on: ubuntu-latest
88
name: Biome Lint
99
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-node@v4
10+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
11+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
1212
with:
13-
node-version: 20
13+
node-version: 22
1414
cache: "yarn"
1515
- run: yarn --immutable
1616
- run: yarn lint:ci
1717
tsc:
1818
runs-on: ubuntu-latest
1919
name: Typescript
2020
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-node@v4
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
22+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
2323
with:
24-
node-version: 20
24+
node-version: 22
2525
cache: "yarn"
2626
- run: yarn --immutable
2727
- run: yarn typecheck
2828
test:
2929
runs-on: ubuntu-latest
3030
name: Tests
3131
steps:
32-
- uses: actions/checkout@v4
33-
- uses: actions/setup-node@v4
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
33+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
3434
with:
35-
node-version: 20
35+
node-version: 22
3636
cache: "yarn"
3737
- run: yarn --immutable
3838
- run: yarn test
3939
build:
4040
runs-on: ubuntu-latest
4141
name: Vite Build
4242
steps:
43-
- uses: actions/checkout@v4
44-
- uses: actions/setup-node@v4
43+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
44+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
4545
with:
46-
node-version: 20
46+
node-version: 22
4747
cache: "yarn"
4848
- run: yarn --immutable
4949
- run: yarn build

.mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[tools]
2-
node = "20.11"
2+
node = "22.13"

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"editor.defaultFormatter": "biomejs.biome",
32
"[typescript]": {
43
"editor.defaultFormatter": "biomejs.biome"
54
},
65
"[typescriptreact]": {
76
"editor.defaultFormatter": "biomejs.biome"
87
},
8+
"[css]": {
9+
"editor.defaultFormatter": "biomejs.biome"
10+
},
911
"typescript.preferences.preferTypeOnlyAutoImports": true,
1012
"editor.codeActionsOnSave": {
1113
"source.fixAll": "explicit"

.yarn/releases/yarn-4.1.1.cjs

Lines changed: 0 additions & 893 deletions
This file was deleted.

.yarn/releases/yarn-4.6.0.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
nodeLinker: node-modules
22

3-
yarnPath: .yarn/releases/yarn-4.1.1.cjs
3+
yarnPath: .yarn/releases/yarn-4.6.0.cjs

package.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@
2323
"@nmann/struct-buffer": "^5.4.1",
2424
"baconjs": "patch:baconjs@npm%3A3.0.17#~/.yarn/patches/baconjs-npm-3.0.17-1a95474784.patch",
2525
"classnames": "^2.5.1",
26-
"jotai": "^2.8.0",
27-
"logrocket": "^8.1.0",
28-
"react": "^18.2.0",
29-
"react-dom": "^18.2.0"
26+
"jotai": "^2.9.3",
27+
"react": "^19.0.0",
28+
"react-dom": "^19.0.0"
3029
},
3130
"devDependencies": {
32-
"@biomejs/biome": "1.7.0",
33-
"@types/react": "^18.2.75",
34-
"@types/react-dom": "^18.2.25",
31+
"@biomejs/biome": "1.9.4",
32+
"@types/react": "^19.0.0",
33+
"@types/react-dom": "^19.0.0",
3534
"@types/w3c-web-hid": "1.0.6",
36-
"@vitejs/plugin-react": "^4.2.1",
37-
"typescript": "^5.4.5",
38-
"vite": "^5.2.8",
39-
"vite-plugin-mkcert": "^1.17.5",
40-
"vitest": "^1.5.0"
35+
"@vitejs/plugin-react": "^4.3.4",
36+
"typescript": "^5.5.4",
37+
"vite": "^6.0.7",
38+
"vite-plugin-mkcert": "^1.17.6",
39+
"vitest": "^2.1.8"
4140
},
42-
"packageManager": "yarn@4.1.1"
41+
"packageManager": "yarn@4.6.0"
4342
}

renovate.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:best-practices",
5+
":preserveSemverRanges",
6+
"group:allNonMajor",
7+
"group:linters",
8+
"group:react"
9+
]
10+
}

sdk/commands/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ const packed_panel_settings_t = new StructBuffer("packed_panel_settings_t", {
1717
loadCellHighThreshold: uint8_t,
1818

1919
/**
20-
* FSR Thresholds
21-
* 4 Sensors per threshold
20+
* Activation threshold when pressing.
21+
* 4 values, one for each sensor on this panel.
2222
*/
2323
fsrLowThreshold: uint8_t[4],
24+
/**
25+
* Release threshold when lifting.
26+
* 4 values, one for each sensor on this panel.
27+
*/
2428
fsrHighThreshold: uint8_t[4],
2529

2630
/**
@@ -357,14 +361,13 @@ export class SMXConfig {
357361
*/
358362
constructor(data: Uint8Array, firmwareVersion: number) {
359363
this.firmwareVersion = firmwareVersion;
360-
console.log("Config Firmware Version: ", this.firmwareVersion);
361-
console.log("CONFIG RAW DATA: ", data.toString());
364+
console.debug("CONFIG RAW DATA: ", data.toString());
362365

363366
if (this.firmwareVersion >= 5) {
364367
this.config = smx_config_t.decode(data.slice(2, -1), true);
365368
} else {
366369
this.oldConfigSize = data[1];
367-
console.log("Reading Old Config");
370+
console.debug("Reading Old Config");
368371

369372
const slicedData = data.slice(2, -1);
370373
// handle very old stage's smaller config data by padding

sdk/commands/data_info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class SMXDeviceInfo {
2323
player = 0;
2424

2525
constructor(data: Uint8Array) {
26-
console.log("DEVICEINFO RAW DATA: ", data.toString());
26+
console.debug("DEVICEINFO RAW DATA: ", data.toString());
2727
this.#decode(data);
2828
}
2929

sdk/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ export {
1111
SENSOR_COUNT,
1212
PANEL_COUNT,
1313
} from "./api.js";
14-
export { type PanelName, type EachPanel } from "./commands/inputs.js";
14+
export type { PanelName, EachPanel } from "./commands/inputs.js";
1515
export { SensorTestMode, type SMXPanelTestData, type SMXSensorTestData } from "./commands/sensor_test.js";
1616
export { SMXStage } from "./smx.js";

sdk/packet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function send_data(dev: HIDDevice, data: Uint8Array, debug = false)
3131
// Send each packet
3232
for (const packet of packets) {
3333
if (debug) {
34-
console.log("OUTGOING RAW PACKET: ", packet.toString());
34+
console.debug("OUTGOING RAW PACKET: ", packet.toString());
3535
}
3636
await dev.sendReport(HID_REPORT_OUTPUT, packet);
3737
}

sdk/smx.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class SMXEvents {
5151
.filter((e) => e.type === "host_cmd_finished")
5252
.map((e) => e.type === "host_cmd_finished");
5353

54-
finishedCommand$.log("Cmd Finished");
55-
5654
const okSend$ = finishedCommand$.startWith(true);
5755

5856
// Main USB Output
@@ -103,7 +101,7 @@ export class SMXStage {
103101

104102
// write outgoing events to the device
105103
this.events.eventsToSend$.onValue(async (value) => {
106-
this.debug && console.log("writing to HID");
104+
this.debug && console.debug("writing to HID");
107105
await send_data(this.dev, value, this.debug);
108106
});
109107

@@ -338,9 +336,9 @@ void SMX::SMXManager::UpdatePanelTestMode()
338336
const encoded_config = this._config.encode();
339337
if (encoded_config) {
340338
this.debug &&
341-
console.log("Config Encodes Correctly: ", data.slice(2, -1).toString() === encoded_config.toString());
339+
console.debug("Config Encodes Correctly: ", data.slice(2, -1).toString() === encoded_config.toString());
342340
}
343-
this.debug && console.log("Got Config: ", this.config);
341+
this.debug && console.info("Got Config: ", this.config);
344342

345343
return this._config;
346344
}
@@ -349,15 +347,15 @@ void SMX::SMXManager::UpdatePanelTestMode()
349347
// biome-ignore lint/style/noNonNullAssertion: config should very much be defined here
350348
this.test = new SMXSensorTestData(data, this.test_mode, this.config!.flags.PlatformFlags_FSR);
351349

352-
this.debug && console.log("Got Test: ", this.test);
350+
this.debug && console.debug("Got Test: ", this.test);
353351

354352
return this.test;
355353
}
356354

357355
private handleDeviceInfo(data: Uint8Array): SMXDeviceInfo {
358356
this.info = new SMXDeviceInfo(data);
359357

360-
this.debug && console.log("Got Info: ", this.info);
358+
this.debug && console.debug("Got Info: ", this.info);
361359

362360
return this.info;
363361
}

sdk/state-machines/collate-packets.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ export type Packet = { type: "host_cmd_finished" } | DataPacket | AckPacket;
2424
export const collatePackets: StateF<DataView, PacketHandlingState, Packet> = (state, event) => {
2525
// TODO: This whole function could maybe just use a bit more comments
2626
if (!Bacon.hasValue(event)) {
27-
console.log("No Event Value");
27+
console.debug("No Event Value");
2828
return [state, []];
2929
}
3030

3131
let currentPacket = state.currentPacket;
3232
const data = new Uint8Array(event.value.buffer);
3333

34-
console.log("INCOMING RAW PACKET: ", data.toString());
34+
console.debug("INCOMING RAW PACKET: ", data.toString());
3535

3636
// Return if packet is empty
3737
if (data.length <= PACKET_PREAMBLE_SIZE) {
38-
console.log("Empty Packet");
38+
console.debug("Empty Packet");
3939
return [state, []];
4040
}
4141
const cmd = data[0];
@@ -46,12 +46,12 @@ export const collatePackets: StateF<DataView, PacketHandlingState, Packet> = (st
4646
// we ignore the packet if we didn't request it, since it might be requested
4747
// for a different program.
4848
// TODO: Handle this? Not sure there's anything to handle here tbh
49-
console.log("Found Packet Flag Device Info");
49+
console.debug("Found Packet Flag Device Info");
5050
}
5151

5252
if (PACKET_PREAMBLE_SIZE + byte_len > data.length) {
5353
// TODO: Can this even happen???
54-
console.log("Communication Error: Oversized Packet (ignored)");
54+
console.warn("Communication Error: Oversized Packet (ignored)");
5555
return [state, []];
5656
}
5757

@@ -71,7 +71,7 @@ export const collatePackets: StateF<DataView, PacketHandlingState, Packet> = (st
7171
* This shouldn't happen, so warn about it and recover by clearing the junk in the buffer.
7272
* TODO: Again, does this actually happen???!?
7373
*/
74-
console.log(
74+
console.warn(
7575
"Got PACKET_FLAG_OF_START_COMMAND, but we had ${current_packet.length} bytes in the buffer. Dropping it and continuing.",
7676
);
7777
currentPacket = new Uint8Array(0);

ui/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as Bacon from "baconjs";
22
import { Provider } from "jotai";
3-
import LogRocket from "logrocket";
43
import { createRoot } from "react-dom/client";
54

65
import { uiState } from "./state.ts";
76
import { UI } from "./ui.tsx";
87

9-
LogRocket.init("rgozwj/smx-config-web");
10-
118
Bacon.fromEvent(document, "DOMContentLoaded").onValue(async () => {
129
const rootEl = document.getElementById("root");
1310
if (!rootEl) return;

ui/pad-coms.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ export async function promptSelectDevice() {
1616

1717
export async function open_smx_device(dev: HIDDevice, autoSelect = false) {
1818
if (!dev.opened) {
19-
await dev.open();
19+
try {
20+
await dev.open();
21+
} catch (e) {
22+
console.error(e);
23+
uiState.set(nextStatusTextLine$, "failed to open device; more details in the browser console.");
24+
uiState.set(
25+
nextStatusTextLine$,
26+
"if you are using linux, permissions to talk to a stage are still an unsolved puzzle.",
27+
);
28+
return;
29+
}
2030
}
2131

2232
const stage = new SMXStage(dev);

0 commit comments

Comments
 (0)