ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
5.15k stars 1.23k forks source link

PTZ issue (fixed!) #3300

Closed alabamatoy closed 3 years ago

alabamatoy commented 3 years ago

Discovered a minor issue with the Amcrest PTZ...applies to file Amcrest_HTTP.pm I know this is not the right way to document this code change, so I apologize in advance. Currently, the diagonal Pan/Tilt movement commands are misinterpreted by the cameras.

Apparently if you send the camera an arg1 and/or arg2 values of zero for a diagonal movement, it just ignores the command. If you set the arg1 and arg2 values to 1, it works. According to the API documentation, arg1 is "Vertical speed, range is [1-8]" and arg 2 is "Horizontal speed, range is [1-8]" So....I guess it makes sense to ignore the vertical movement command, in effect the arg1=0 is telling it no vertical speed.

lines 223, 231, 239, and 247 need to be modified as follows:

Change &channel=0&arg1=0&arg2=1&arg3=0 to &channel=0&arg1=1&arg2=1&arg3=0

Working code:

sub moveConUpRight {
  my $self = shift;
  Debug('Move Diagonally Up Right');
  $$self{Monitor}->suspendMotionDetection() if !$self->{Monitor}->{ModectDuringPTZ};
  $$self{LastCmd} = 'code=RightUp&channel=0&arg1=1&arg2=1&arg3=0';
  $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
}

sub moveConDownRight {
  my $self = shift;
  Debug('Move Diagonally Down Right');
  $$self{LastCmd} = 'code=RightDown&channel=0&arg1=1&arg2=1&arg3=0';
  $$self{Monitor}->suspendMotionDetection() if !$self->{Monitor}->{ModectDuringPTZ};
  $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
}

sub moveConUpLeft {
  my $self = shift;
  Debug('Move Diagonally Up Left');
  $$self{Monitor}->suspendMotionDetection() if !$self->{Monitor}->{ModectDuringPTZ};
  $$self{LastCmd} = 'code=LeftUp&channel=0&arg1=1&arg2=1&arg3=0';
  $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
}

sub moveConDownLeft {
  my $self = shift;
  Debug('Move Diagonally Down Left');
  $$self{Monitor}->suspendMotionDetection() if !$self->{Monitor}->{ModectDuringPTZ};
  $$self{LastCmd} = 'code=LeftDown&channel=0&arg1=1&arg2=1&arg3=0';
  $self->sendCmd('cgi-bin/ptz.cgi?action=start&'.$$self{LastCmd});
}
alabamatoy commented 3 years ago

Respectfully request re-open. This fix did not make it into 1.36.5 latest update.

connortechnology commented 3 years ago

This made it in now though right? So we can close again?

alabamatoy commented 3 years ago

It is working in latest master. Recommend close.