Skip to content

Commit

Permalink
Update linearly to v0.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Oct 19, 2023
1 parent e1a164f commit 93c8750
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This is a list of ConfigName and their value types:
| ConfigName | ConfigType | Example |
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------ |
| aperture | `Aperture` | `2.2`, `5.6`, `'auto'` |
| autoFocusFrameCenter | `Vec2` | The center of auto focus frame. Normalized from [0, 0] (top-left) to [1, 1] (bottom-right) |
| autoFocusFrameCenter | `vec2` | The center of auto focus frame. Normalized from [0, 0] (top-left) to [1, 1] (bottom-right) |
| autoFocusFrameSize | `string` | `large`, `medium`, `small`, `64x64` |
| batteryLevel | `BatteryLevel` | `50`, `100`, `'ac'`, `'low'` (Represented in range `0-100`) |
| burstInterval | `number` | |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"bim": "^1.3.3",
"date-format-parse": "^0.2.7",
"eventemitter3": "^4.0.7",
"linearly": "^0.17.0",
"lodash": "^4.17.21",
"p-timeout": "^6.1.2",
"promise-queue": "^2.2.5",
Expand All @@ -62,6 +61,7 @@
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-vue": "^9.17.0",
"file-saver": "^2.0.5",
"linearly": "^0.20.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"stylus": "^0.60.0",
Expand Down
6 changes: 3 additions & 3 deletions src/Tethr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventEmitter from 'eventemitter3'
import {Vec2} from 'linearly'
import {vec2} from 'linearly'
import sleep from 'sleep-promise'

import {
Expand Down Expand Up @@ -202,11 +202,11 @@ export abstract class Tethr

async setAutoFocusFrameCenter(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
value: Vec2
value: vec2
): Promise<OperationResult> {
return UnsupportedOperationResult
}
async getAutoFocusFrameCenterDesc(): Promise<ConfigDesc<Vec2>> {
async getAutoFocusFrameCenterDesc(): Promise<ConfigDesc<vec2>> {
return UnsupportedConfigDesc
}

Expand Down
12 changes: 6 additions & 6 deletions src/TethrPTPUSB/TethrSigma.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BiMap} from 'bim'
import {scalar, Vec2, vec2} from 'linearly'
import {scalar, vec2} from 'linearly'
import {isEqual, minBy} from 'lodash'
import sleep from 'sleep-promise'
import {MemoizeExpiring} from 'typescript-memoize'
Expand Down Expand Up @@ -245,7 +245,7 @@ export class TethrSigma extends TethrPTPUSB {
const [lvTop, lvBottom, lvLeft, lvRight] = focusValidArea

// Assume the margins are symmetrical
return [lvLeft + lvRight, lvTop + lvBottom] as Vec2
return [lvLeft + lvRight, lvTop + lvBottom] as vec2
}

async #enableSpotAutoFocus() {
Expand All @@ -268,7 +268,7 @@ export class TethrSigma extends TethrPTPUSB {
})
}

async getAutoFocusFrameCenterDesc(): Promise<ConfigDesc<Vec2>> {
async getAutoFocusFrameCenterDesc(): Promise<ConfigDesc<vec2>> {
if (!(await this.get('canRunAutoFocus'))) {
return {writable: false, value: null}
}
Expand All @@ -283,10 +283,10 @@ export class TethrSigma extends TethrPTPUSB {

const [lvY, lvX] = new Uint16Array(distanceMeasurementFramePosition)
const [lvStepY, lvStepX] = distanceMeasurementFrameMovementAmount
const lvSize: Vec2 = await this.#getLVCoordinateSize()
const lvSize: vec2 = await this.#getLVCoordinateSize()
const [lvTop, , lvLeft] = focusValidArea

const value: Vec2 = vec2.invlerp([0, 0], lvSize, [lvX, lvY])
const value: vec2 = vec2.invlerp([0, 0], lvSize, [lvX, lvY])
const step = vec2.div([lvStepX, lvStepY], lvSize)

// The value of focusValidArea includes the maximum 64x64 focus frame,
Expand All @@ -308,7 +308,7 @@ export class TethrSigma extends TethrPTPUSB {
}
}

async setAutoFocusFrameCenter(center: Vec2): Promise<OperationResult> {
async setAutoFocusFrameCenter(center: vec2): Promise<OperationResult> {
if (!(await this.get('canRunAutoFocus'))) {
return {status: 'invalid parameter'}
}
Expand Down
4 changes: 2 additions & 2 deletions src/configs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {BiMap} from 'bim'
import {Vec2} from 'linearly'
import {vec2} from 'linearly'

/**
* Aperture value. `'auto'` means auto aperture.
Expand Down Expand Up @@ -80,7 +80,7 @@ export type WhiteBalance =

export type ConfigType = {
aperture: Aperture // fNumber
autoFocusFrameCenter: Vec2
autoFocusFrameCenter: vec2
autoFocusFrameSize: string
batteryLevel: BatteryLevel
burstInterval: number
Expand Down

0 comments on commit 93c8750

Please sign in to comment.