Skip to content

Commit

Permalink
zoom speed fix
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Aug 23, 2024
1 parent fd725c6 commit 21cc065
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canon-ptz",
"version": "2.2.2",
"version": "2.2.3",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
18 changes: 9 additions & 9 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,22 +648,22 @@ module.exports = {
label: 'Zoom Speed Setting',
id: 'speed',
default: 8,
choices: c.CHOICES_ZOOM_SPEED,
choices: c.CHOICES_ZOOM_SPEED(),
},
],
callback: async (action) => {
self.zSpeed = action.options.speed
var idx = -1
for (var i = 0; i < c.CHOICES_ZOOM_SPEED.length; ++i) {
if (c.CHOICES_ZOOM_SPEED[i].id == self.zSpeed) {
for (var i = 0; i < c.CHOICES_ZOOM_SPEED().length; ++i) {
if (c.CHOICES_ZOOM_SPEED()[i].id == self.zSpeed) {
idx = i
break
}
}
if (idx > -1) {
self.zSpeedIndex = idx
}
self.zSpeed = c.CHOICES_ZOOM_SPEED[self.zSpeedIndex].id
self.zSpeed = c.CHOICES_ZOOM_SPEED()[self.zSpeedIndex].id
self.data.zoomSpeed = self.zSpeed;
self.getCameraInformation_Delayed();
}
Expand All @@ -678,7 +678,7 @@ module.exports = {
} else if (self.zSpeedIndex > 0) {
self.zSpeedIndex--
}
self.zSpeed = c.CHOICES_ZOOM_SPEED[self.zSpeedIndex].id
self.zSpeed = c.CHOICES_ZOOM_SPEED()[self.zSpeedIndex].id
self.data.zoomSpeed = self.zSpeed;
self.getCameraInformation_Delayed();
}
Expand All @@ -688,12 +688,12 @@ module.exports = {
name: 'Lens - Zoom Speed Down',
options: [],
callback: async (action) => {
if (self.zSpeedIndex == c.CHOICES_ZOOM_SPEED.length) {
self.zSpeedIndex = c.CHOICES_ZOOM_SPEED.length
} else if (self.zSpeedIndex < c.CHOICES_ZOOM_SPEED.length) {
if (self.zSpeedIndex == c.CHOICES_ZOOM_SPEED().length) {
self.zSpeedIndex = c.CHOICES_ZOOM_SPEED().length
} else if (self.zSpeedIndex < c.CHOICES_ZOOM_SPEED().length) {
self.zSpeedIndex++
}
self.zSpeed = c.CHOICES_ZOOM_SPEED[self.zSpeedIndex].id
self.zSpeed = c.CHOICES_ZOOM_SPEED()[self.zSpeedIndex].id
self.data.zoomSpeed = self.zSpeed;
self.getCameraInformation_Delayed();
}
Expand Down
2 changes: 1 addition & 1 deletion src/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {

CHOICES_ZOOM_SPEED: function () {
var p = []
for (var i = 0; i <= 127; ++i) {
for (var i = 0; i <= 127; i++) {
p.push({ id: i, label: 'Speed ' + i })
}
return p
Expand Down
4 changes: 2 additions & 2 deletions src/presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ module.exports = {
{
actionId: 'zSpeedS',
options: {
speed: 15
speed: 127
}
}
],
Expand All @@ -970,7 +970,7 @@ module.exports = {
{
actionId: 'zSpeedS',
options: {
speed: 8
speed: 63
}
}
],
Expand Down

0 comments on commit 21cc065

Please sign in to comment.