Skip to content

Commit

Permalink
[Sigma] Refactor DPC getter/setter
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Sep 28, 2023
1 parent 621ee0e commit ce67904
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/TethrPTPUSB/TethrSigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ export class TethrSigma extends TethrPTPUSB {
}

async getApertureDesc(): Promise<ConfigDesc<Aperture>> {
const fValue = (await this.getCamCanSetInfo5()).fValue
const {fValue: range} = await this.getCamCanSetInfo5()
const value = await this.getAperture()

if (fValue.length === 0) {
if (range.length === 0) {
// Should be auto aperture
return {
writable: false,
value,
}
}

const [svMin, svMax, step] = fValue
const [svMin, svMax, step] = range

const isStepOneThird = Math.abs(step - 1 / 3) < Math.abs(step - 1 / 2)
const table = isStepOneThird
Expand Down Expand Up @@ -299,18 +299,18 @@ export class TethrSigma extends TethrPTPUSB {
}

async getColorTemperatureDesc(): Promise<ConfigDesc<number>> {
const {colorTemerature} = await this.getCamCanSetInfo5()
const {colorTemerature: range} = await this.getCamCanSetInfo5()
const value = await this.getColorTemperature()

if (colorTemerature.length !== 3) {
if (range.length !== 3) {
// When WB is not set to 'manual'
return {
writable: false,
value,
}
}

const [min, max, step] = colorTemerature
const [min, max, step] = range

return {
writable: true,
Expand Down Expand Up @@ -390,17 +390,17 @@ export class TethrSigma extends TethrPTPUSB {
}

async getExposureCompDesc(): Promise<ConfigDesc<string>> {
const {exposureComp} = await this.getCamCanSetInfo5()
const {exposureComp: range} = await this.getCamCanSetInfo5()
const value = await this.getExposureComp()

if (exposureComp.length < 3) {
if (range.length < 3) {
return {
writable: false,
value: null,
value,
}
}

const [min, max] = exposureComp
const [min, max] = range

if (min === 0 && max === 0) {
return {
Expand All @@ -417,7 +417,7 @@ export class TethrSigma extends TethrPTPUSB {
.map(([v]) => v)

return {
writable: exposureComp.length > 0,
writable: true,
value,
option: {
type: 'enum',
Expand Down Expand Up @@ -900,7 +900,7 @@ export class TethrSigma extends TethrPTPUSB {
type: 'enum',
values,
},
} as ConfigDesc<string>
}
}

async getShutterSoundDesc(): Promise<ConfigDesc<number>> {
Expand Down

0 comments on commit ce67904

Please sign in to comment.