Update of /cvsroot/playerstage/code/player/server/drivers/ptz
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27174/server/drivers/ptz

Modified Files:
      Tag: release-2-0-patches
        sonyevid30.cc 
Log Message:
merged driver changes from HEAD

Index: sonyevid30.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/ptz/sonyevid30.cc,v
retrieving revision 1.24
retrieving revision 1.24.2.1
diff -C2 -d -r1.24 -r1.24.2.1
*** sonyevid30.cc       27 Feb 2006 18:19:03 -0000      1.24
--- sonyevid30.cc       24 Apr 2007 22:20:21 -0000      1.24.2.1
***************
*** 181,185 ****
    int pandemand;
    int tiltdemand;
! 
  public:
  
--- 181,186 ----
    int pandemand;
    int tiltdemand;
!   short zoomdemand;
!   
  public:
  
***************
*** 236,240 ****
    pandemand = 0;
    tiltdemand=0;
! 
    read_pfd.events = POLLIN;
  
--- 237,241 ----
    pandemand = 0;
    tiltdemand=0;
!   zoomdemand=0;
    read_pfd.events = POLLIN;
  
***************
*** 434,437 ****
--- 435,449 ----
    }
  
+   /*
+   int zz = 0;
+   printf( "Sending: " );
+   while( command[zz] != 0xFF )
+   {
+     printf( "%02x ", command[zz] );
+     zz++;
+   }
+   printf( "%02x\n", command[zz] );
+   */
+   
    //puts("Send(): calling Receive()");
    return(Receive(reply));
***************
*** 549,552 ****
--- 561,575 ----
    }
  
+   /*
+   int zz = 0;
+   printf( "Receiving: " );
+   while( reply[zz] != 0xFF )
+   {
+     printf( "%02x ", reply[zz] );
+     zz++;
+   }
+   printf( "%02x\n", reply[zz] );
+   */
+ 
    return(bufptr+1-i);
  }
***************
*** 664,668 ****
    short convpan,convtilt;
  
!   printf("Send abs pan/tilt: %d, %d\n", pan, tilt);
  
    if (abs(pan)>(short)PTZ_PAN_MAX) 
--- 687,691 ----
    short convpan,convtilt;
  
!   //printf("Send abs pan/tilt: %d, %d\n", pan, tilt);
  
    if (abs(pan)>(short)PTZ_PAN_MAX) 
***************
*** 687,691 ****
    convtilt = (short)(tilt*ptz_tilt_conv_factor);
  
!   printf("[Conv] Send abs pan/tilt: %d, %d\n", convpan, convtilt);
  
    command[0] = 0x01;  // absolute position command
--- 710,715 ----
    convtilt = (short)(tilt*ptz_tilt_conv_factor);
  
!   //printf("[Conv] Send abs pan/tilt: %d, %d\n", convpan, convtilt);
!   //printf("[Conv] Send abs pan/tilt: %04x, %04x\n", convpan, convtilt);
  
    command[0] = 0x01;  // absolute position command
***************
*** 787,790 ****
--- 811,816 ----
    int reply_len;
  
+   //printf( "set zoom: %d\n", zoom );
+   
    command[0] = 0x09;
    command[1] = 0x04;
***************
*** 846,849 ****
--- 872,877 ----
    }
  
+   //printf( "Send zoom: %d\n", zoom );
+   
    command[0] = 0x01;  // absolute position command
    command[1] = 0x04;  // absolute position command
***************
*** 855,859 ****
    command[5] = (unsigned char)((zoom & 0x00F0) >> 4);
    command[6] = (unsigned char)(zoom & 0x000F); 
! 
    return(SendCommand(command, 7));
  }
--- 883,887 ----
    command[5] = (unsigned char)((zoom & 0x00F0) >> 4);
    command[6] = (unsigned char)(zoom & 0x000F); 
!   
    return(SendCommand(command, 7));
  }
***************
*** 890,900 ****
    if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, PLAYER_PTZ_CMD_STATE, 
device_addr))
    {
!     short zoomdemand=0;
!     bool newpantilt=true, newzoom=true;
        
        assert (hdr->size == sizeof (player_ptz_cmd_t));
        player_ptz_cmd_t command = *reinterpret_cast<player_ptz_cmd_t *> (data);
!     if(pandemand != (int)rint(RTOD(command.pan)))
      {
        pandemand = (int)rint(RTOD(command.pan));
        newpantilt = true;
--- 918,928 ----
    if (Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, PLAYER_PTZ_CMD_STATE, 
device_addr))
    {
!     bool newpantilt=false, newzoom=false;
        
        assert (hdr->size == sizeof (player_ptz_cmd_t));
        player_ptz_cmd_t command = *reinterpret_cast<player_ptz_cmd_t *> (data);
!     if(-pandemand != (int)rint(RTOD(command.pan)))
      {
+  //     printf( "pandemand: %d command: %d\n", pandemand, (int)rint( 
RTOD(command.pan)) );
        pandemand = (int)rint(RTOD(command.pan));
        newpantilt = true;
***************
*** 905,918 ****
        newpantilt = true;
      }
      
!     zoomdemand = (1024 * (zoomdemand - this->maxfov)) / (this->minfov - 
this->maxfov);
!     
      if(newzoom)
      {
!         if(SendAbsZoom(zoomdemand))
!         {
!           fputs("SonyEVID30:Main():SendAbsZoom() errored. bailing.\n", 
stderr);
!           pthread_exit(NULL);
!         }
      }
      
--- 933,954 ----
        newpantilt = true;
      }
+      
+     short tzoomdemand = (1024 * ((int)rint(RTOD(command.zoom)) - 
this->maxfov)) / (this->minfov - this->maxfov);
+     if( zoomdemand != tzoomdemand)
+     {
+       zoomdemand = tzoomdemand;
+ 
+       newzoom = true;
+     }
      
! 
! 
      if(newzoom)
      {
!           if(SendAbsZoom(zoomdemand))
!           {
!             fputs("SonyEVID30:Main():SendAbsZoom() errored. bailing.\n", 
stderr);
!             pthread_exit(NULL);
!           }
      }
      


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to