Skip to content

Commit

Permalink
[Sigma] Try to set CamData multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Oct 7, 2023
1 parent 455f70e commit 0bbdfa5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Tethr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ export abstract class Tethr
const ai = WritableConfigNameList.indexOf(a as ConfigName)
const bi = WritableConfigNameList.indexOf(b as ConfigName)
return ai - bi
})
}) as [ConfigName, ConfigType[ConfigName]][]

for (const [name, value] of sortedConfigs) {
// NOTE: this might be converted to parallel execution in the future
await this.set(name as ConfigName, value)
await this.set(name, value)
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/TethrPTPUSB/TethrSigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,6 @@ export class TethrSigma extends TethrPTPUSB {
})
}

@MemoizeExpiring(SigmaExpirationMs)
private async setCamData(
opcode: number,
devicePropIndex: number,
Expand All @@ -1615,14 +1614,17 @@ export class TethrSigma extends TethrPTPUSB {

const data = this.encodeParameter(dataView.toBuffer())

try {
await this.device.sendData({
for (let i = 0; i < 10; i++) {
const {resCode} = await this.device.sendData({
label: 'SigmaFP SetCamDataGroup#',
opcode,
data,
expectedResCodes: [ResCode.OK, ResCode.DeviceBusy],
})
} catch (err) {
return {status: 'invalid parameter'}

if (resCode === ResCode.OK) break

await sleep(25)
}

await this.checkConfigChanged()
Expand Down

0 comments on commit 0bbdfa5

Please sign in to comment.