Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build CI
name: Lint/Build/Test CI

permissions:
contents: read
Expand All @@ -15,15 +15,16 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Build CI
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
node-version: "24"
cache: "pnpm"
- run: pnpm install --frozen-lockfile

- run: pnpm lint
- run: pnpm build
- run: pnpm test
2 changes: 1 addition & 1 deletion .github/workflows/changeset-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
node-version: "24"
cache: "pnpm"
- run: pnpm install --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: "lts/*"
node-version: "24"
cache: "pnpm"
- run: pnpm install --frozen-lockfile

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist
*.local
*.tsbuildinfo
__screenshots__
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"build": "tsc --build --clean && vite build",
"build": "tsc --build && vite build",
"clean": "rm -rfv dist",
"dev": "vite"
},
Expand Down
4 changes: 3 additions & 1 deletion driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
"version": "0.0.6",
"type": "module",
"scripts": {
"build": "tsc --build --clean",
"build": "tsc --build",
"clean": "rm -rfv dist",
"test": "vitest run --browser.headless",
"pretest": "playwright install chromium",
"prepack": "$npm_execpath run clean && $npm_execpath run build"
},
"files": [
Expand Down
6 changes: 3 additions & 3 deletions driver/src/camera/deraw/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const unpackGrayToRgbaFloat16 = (
};

const BAYER_NORMAL = 1 / 255;
const BAYER_NORMAL2 = BAYER_NORMAL * 2;
const BAYER_NORMAL4 = BAYER_NORMAL * 4;
const BAYER_NORMAL2 = 1 / (255 * 2);
const BAYER_NORMAL4 = 1 / (255 * 4);

/**
* Convert Bayer pattern to RGBA float16 format
Expand Down Expand Up @@ -172,7 +172,7 @@ const YUV_NORMAL = 1 / 255;
* @param outBuffer Output buffer
* @returns RGBA float16 buffer
*/
export function uyvyToRgbaFloat16(
export function yuvToRgbaFloat16(
uyvyBuffer: ArrayBuffer,
outBuffer = new ArrayBuffer(
uyvyBuffer.byteLength * 2 * Float16Array.BYTES_PER_ELEMENT,
Expand Down
4 changes: 2 additions & 2 deletions driver/src/camera/deraw/select-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { selectBpp, selectRes } from "../stream/dimensions.js";
import {
bayerToRgbaFloat16,
unpackGrayToRgbaFloat16,
uyvyToRgbaFloat16,
yuvToRgbaFloat16,
} from "./formats.js";
import type { RawToRgba } from "./raw-to-rgba.js";

Expand All @@ -21,7 +21,7 @@ export const selectRawToRgba = (mode: CamMode): RawToRgba => {
case CamFmtVisible.BAYER_8B:
return bayerToRgbaFloat16.bind(null, selectRes(mode)[0]);
case CamFmtVisible.YUV_16B:
return uyvyToRgbaFloat16.bind(null);
return yuvToRgbaFloat16.bind(null);
}
}
};
14 changes: 5 additions & 9 deletions driver/src/camera/stream/dimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const irBpp = {
[CamFmtInfrared.IR_10B]: 10,
} as const;

export const selectRes = <M extends CamMode>(mode: M) => {
export const selectRes = <M extends CamMode>(mode: NonNullable<M>) => {
switch (mode?.stream) {
case undefined:
throw new RangeError("Invalid mode", { cause: mode });
Expand All @@ -58,10 +58,8 @@ export const selectRes = <M extends CamMode>(mode: M) => {
}
};

export const selectBpp = <M extends CamMode>(mode: M) => {
switch (mode?.stream) {
case undefined:
throw new RangeError("Invalid mode", { cause: mode });
export const selectBpp = <M extends CamMode>(mode: NonNullable<M>) => {
switch (mode.stream) {
case Cam.VISIBLE:
return visibleBpp[mode.format] as M extends CamMode<Cam.VISIBLE>
? (typeof visibleBpp)[M["format"]]
Expand All @@ -77,10 +75,8 @@ export const selectBpp = <M extends CamMode>(mode: M) => {
}
};

export const selectFrameSize = (mode: CamMode) => {
switch (mode?.stream) {
case undefined:
throw new RangeError("Invalid mode", { cause: mode });
export const selectFrameSize = (mode: NonNullable<CamMode>) => {
switch (mode.stream) {
case Cam.VISIBLE: {
const [width, height] = visibleRes[mode.res];
const bpp = visibleBpp[mode.format];
Expand Down
57 changes: 0 additions & 57 deletions driver/src/camera/worker/iso-worker.ts

This file was deleted.

2 changes: 1 addition & 1 deletion driver/src/motor/motor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class Motor {
public async setPosition(degrees: number): Promise<void> {
await this.ready;

const halfDegrees = Math.round(degrees * 2);
const halfDegrees = Math.trunc(degrees * 2);
const limited = Math.max(
Math.min(halfDegrees, MOTOR_MAX_TILT),
-MOTOR_MAX_TILT,
Expand Down
17 changes: 17 additions & 0 deletions driver/test/__snapshots__/deraw.test.ts.snap

Large diffs are not rendered by default.

Loading