Fixed two issues with PTZ control

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
cenzo188
Posts: 1
Joined: Wed Aug 17, 2016 5:05 pm

Fixed two issues with PTZ control

Post by cenzo188 » Sun Sep 04, 2016 3:38 pm

I noticed a couple of problems with control of PTZ cameras. I have an Axis 213 running using the Axis API v2 script that came with ZM.
The diagonal arrows didn't work even though diagonal movement is supported by the script.
This I fixed in /usr/share/zoneminder/www/include/control_functions.php line 12:

Code: Select all

-if ( preg_match( '/^([a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)+$/', $_REQUEST['control'], $matches ) )
+if ( preg_match( '/^([a-z]+)([A-Z][a-z]+)([A-Za-z]+)+$/', $_REQUEST['control'], $matches ) )
The regex is intended to match the different parts of the movement command. For example if the command is "moveRelUpLeft", it should match the command "move", the mode "Rel", and the direction "UpLeft" in order to break that command up into pansteps and tiltsteps. Instead, the regex only matched "move", "Rel", and "Left", resulting in a missing mandatory --tiltstep argument.
The new regex matches "UpLeft" (and the other directions) as it should.

Also, the left arrow worked backwards. Clicking near the base of the arrow produced a large movement, while clicking near the tip produced a small movement. This problem was in /usr/share/zoneminder/www/skins/classic/includes/control_functions.php line 256:

Code: Select all

-<div class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveLeft'] ?>',event,1,0)"></div>
+<div class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveLeft'] ?>',event,-1,0)"></div>
Just a 1 where there should have been a -1.

I hope these fixes are of use to somebody.

I would also like to get mapped movement working. I've seen multiple references that suggest that when mapped movement is supported, the camera can moved by clicking on the image. However, clicking on the image just zooms it in. I have "can move mapped" checked. I looked through my config and couldn't find a relevant option.
Has that feature been removed from ZM?

alabamatoy
Posts: 79
Joined: Sun Jun 05, 2016 2:53 pm

Re: Fixed two issues with PTZ control

Post by alabamatoy » Fri Dec 16, 2016 11:12 pm

cenzo188 wrote:However, clicking on the image just zooms it in. I have "can move mapped" checked. I looked through my config and couldn't find a relevant option. Has that feature been removed from ZM?
The issue likely will be in the control script. Look in the axis script for a subroutine or function movemap. That appears to be what is called by the image map click. In ubuntu, the control script should be in usr/share/perl5/zoneminder/control. That functionality is in V1.3 for sure. Also know that the image map is implemented through javascript, so if you are blocking that in your browser, it wont work.

User avatar
iconnor
Posts: 337
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Fixed two issues with PTZ control

Post by iconnor » Wed Jan 11, 2017 2:14 pm

Those two fixes have been merged to master and will be in the 1.30.1 release.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests