reolink: use abs movement

This commit is contained in:
Koushik Dutta
2024-10-05 09:55:00 -07:00
parent 26eb69b08a
commit 700856bc2e
3 changed files with 8 additions and 5 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/reolink",
"version": "0.0.95",
"version": "0.0.96",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/reolink",
"version": "0.0.95",
"version": "0.0.96",
"license": "Apache",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/reolink",
"version": "0.0.95",
"version": "0.0.96",
"description": "Reolink Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -249,6 +249,9 @@ export class ReolinkCameraClient {
}
async ptz(command: PanTiltZoomCommand) {
// reolink doesnt accept signed values to ptz
// in favor of explicit direction.
// so we need to convert the signed values to abs explicit direction.
let op = '';
if (command.pan < 0)
op += 'Left';
@@ -260,7 +263,7 @@ export class ReolinkCameraClient {
op += 'Up';
if (op) {
await this.ptzOp(op, Math.round((command?.pan || command?.tilt || 1) * 10));
await this.ptzOp(op, Math.round(Math.abs(command?.pan || command?.tilt || 1) * 10));
}
op = undefined;
@@ -270,7 +273,7 @@ export class ReolinkCameraClient {
op = 'ZoomInc';
if (op) {
await this.ptzOp(op, Math.round((command?.zoom || 1) * 10));
await this.ptzOp(op, Math.round(Math.abs(command?.zoom || 1) * 10));
}
}