Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
noahm committed Apr 1, 2024
1 parent 180a9f2 commit 9fd02ad
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 46 deletions.
2 changes: 1 addition & 1 deletion sdk/commands/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type EachSensor<T> = {
left: T;
};

export type PanelName = keyof EachPanel<any>;
export type PanelName = keyof EachPanel<unknown>;

export type EachPanel<T> = {
up_left: T;
Expand Down
2 changes: 1 addition & 1 deletion sdk/commands/sensor_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class SMXPanelTestData {
/**
* These are 16-bit signed integers for the sensor values.
* These are signed as they can be negative, but I imagine them going
* negative is just kind of noise from the hardware.
* negative is just kind of noise from the hardware.
*/
this.sensor_level = {
left: data.sensors[0],
Expand Down
24 changes: 4 additions & 20 deletions ui/stage/fsr-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,10 @@ export function FsrPanel(props: EnabledProps) {
active: props.active,
})}
>
<Fsr
className="top horiz"
badInput={bad_sensor_input.up}
value={sensor_level.up}
/>
<Fsr
className="right vert"
badInput={bad_sensor_input.right}
value={sensor_level.right}
/>
<Fsr
className="bottom horiz"
badInput={bad_sensor_input.down}
value={sensor_level.down}
/>
<Fsr
className="left vert"
badInput={bad_sensor_input.left}
value={sensor_level.left}
/>
<Fsr className="top horiz" badInput={bad_sensor_input.up} value={sensor_level.up} />
<Fsr className="right vert" badInput={bad_sensor_input.right} value={sensor_level.right} />
<Fsr className="bottom horiz" badInput={bad_sensor_input.down} value={sensor_level.down} />
<Fsr className="left vert" badInput={bad_sensor_input.left} value={sensor_level.left} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion ui/stage/simple-pad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function SimplePad({ dev }: Props) {
panelStates.down_right,
]);
}),
[dev]
[dev],
);

return (
Expand Down
20 changes: 4 additions & 16 deletions ui/stage/stage-test.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import { useAtomValue, type Atom } from "jotai";
import { useEffect, useState } from "react";
import type {
SMXPanelTestData,
SMXSensorTestData,
} from "../../sdk/commands/sensor_test";
import type { SMXPanelTestData, SMXSensorTestData } from "../../sdk/commands/sensor_test";
import { requestTestData } from "../pad-coms";
import { FsrPanel } from "./fsr-panel";
import { SmxStage } from "../../sdk";
import {
StageInputs,
type EachPanel,
type PanelName,
} from "../../sdk/commands/inputs";
import { StageInputs, type EachPanel, type PanelName } from "../../sdk/commands/inputs";
import { HID_REPORT_INPUT_STATE } from "../../sdk/packet";

function useInputState(dev: HIDDevice | undefined) {
const [panelStates, setPanelStates] = useState<
EachPanel<boolean> | undefined
>();
const [panelStates, setPanelStates] = useState<EachPanel<boolean> | undefined>();
useEffect(() => {
if (!dev) return;
function handleInputReport(e: HIDInputReportEvent) {
Expand Down Expand Up @@ -67,10 +58,7 @@ export function StageTest({
return null;
}

const entries = Object.entries(testData.panels) as [
PanelName,
SMXPanelTestData
][];
const entries = Object.entries(testData.panels) as [PanelName, SMXPanelTestData][];

return (
<div className="pad">
Expand Down
2 changes: 1 addition & 1 deletion ui/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ export const statusText$ = atom(
);

/** write-only atom. write to this to append a line to statusText */
export const nextStatusTextLine$ = atom(null, (_, set, line: string) => set(statusText$, (prev) => prev + "\n" + line));
export const nextStatusTextLine$ = atom(null, (_, set, line: string) => set(statusText$, (prev) => `${prev}\n${line}`));
8 changes: 2 additions & 6 deletions ui/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function UI() {
devices.map((device) => {
console.log(`Found device: ${device.productName}`);
open_smx_device(device);
})
}),
);
}
}, []);
Expand All @@ -32,11 +32,7 @@ export function UI() {

function PickDeviceButton() {
return (
<button
type="button"
disabled={!browserSupported}
onClick={promptSelectDevice}
>
<button type="button" disabled={!browserSupported} onClick={promptSelectDevice}>
Pick device...
</button>
);
Expand Down

0 comments on commit 9fd02ad

Please sign in to comment.