Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated PTZ preset functionality #16

Merged
merged 6 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ var SHUTTER = [
];

var PRESET = [];
for (var i = 0; i < 64; ++i) {
PRESET.push({ id: ('0' + i.toString(16)).substr(-2,2), label: 'Preset ' + i });
for (var i = 0; i < 256; ++i) {
PRESET.push({ id: ('0' + i.toString(16)).substr(-2,2), label: i });
}

var SPEED = [
Expand Down Expand Up @@ -754,13 +754,13 @@ instance.prototype.init_presets = function () {
];

var save;
for (save = 0; save < 63; save++) {
for (save = 0; save < 256; save++) {
presets.push({
category: 'Save Preset',
label: 'Save Preset '+ parseInt(save+1) ,
label: 'Save Preset '+ parseInt(save) ,
bank: {
style: 'text',
text: 'SAVE\\nPSET\\n' + parseInt(save+1) ,
text: 'SAVE\\nPSET\\n' + parseInt(save) ,
size: '14',
color: '16777215',
bgcolor: self.rgb(0,0,0),
Expand All @@ -769,21 +769,21 @@ for (save = 0; save < 63; save++) {
{
action: 'savePset',
options: {
val: ('0' + save.toString(16).toUpperCase()).substr(-2,2),
val: ('0' + save.toString(16)).substr(-2,2),
}
}
]
});
}

var recall;
for (recall = 0; recall < 63; recall++) {
for (recall = 0; recall < 256; recall++) {
presets.push({
category: 'Recall Preset',
label: 'Recall Preset '+ parseInt(recall+1) ,
label: 'Recall Preset '+ parseInt(recall) ,
bank: {
style: 'text',
text: 'Recall\\nPSET\\n' + parseInt(recall+1) ,
text: 'Recall\\nPSET\\n' + parseInt(recall) ,
size: '14',
color: '16777215',
bgcolor: self.rgb(0,0,0),
Expand All @@ -792,7 +792,7 @@ for (recall = 0; recall < 63; recall++) {
{
action: 'recallPset',
options: {
val: ('0' + recall.toString(16).toUpperCase()).substr(-2,2),
val: ('0' + recall.toString(16)).substr(-2,2),
}
}
]
Expand Down Expand Up @@ -1220,7 +1220,7 @@ instance.prototype.action = function(action) {
break;

case 'speedPset':
cmd ='\x81\x01\x7E\x01\x0B' + String.fromCharCode(parseInt(opt.val,16) & 0xFF) + String.fromCharCode(parseInt(opt.speed,16) & 0xFF) + '\xFF';
cmd ='\x81\x01\x06\x01' + String.fromCharCode(parseInt(opt.val,16) & 0xFF) + String.fromCharCode(parseInt(opt.speed,16) & 0xFF) + '\xFF';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this have to do with the rest of the changeset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it should have been added in a separate PR but it is the fix for bug #13 as mentioned in a comment above. It is the actual command to set the "Preset Recall Speed" in the PTZ camera, and it becomes relevant when using the preset functionality that is updated in this PR.

From the "PTZOptics VISCA over IP Commands" document:
bild

self.sendVISCACommand(cmd);
break;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ptzoptics-visca",
"version": "1.1.5",
"version": "1.1.6",
"api_version": "1.0.0",
"keywords": [
"Protocol",
Expand Down