Fixed two issues with PTZ control
Posted: 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:
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:
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?
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 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>
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?