Update of /cvsroot/libphidget/libphidget/src/phidget++
In directory sc8-pr-cvs1:/tmp/cvs-serv20190/src/phidget++
Modified Files:
CPhidgetManager.cc CServoController.cc
Log Message:
Initial support for the 8 way advanced servo in phidget++, not fully tested yet.
Index: CPhidgetManager.cc
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CPhidgetManager.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** CPhidgetManager.cc 23 Dec 2002 04:38:40 -0000 1.16
--- CPhidgetManager.cc 24 Jun 2003 02:43:51 -0000 1.17
***************
*** 93,96 ****
--- 93,97 ----
if (tp==LP_SERVO_CONTROLLER && dc==LP_UNI_SERVO) devices.insert(temp_uid);
if (tp==LP_SERVO_CONTROLLER && dc==LP_QUAD_SERVO) devices.insert(temp_uid);
+ if (tp==LP_SERVO_CONTROLLER && dc==LP_8WAY_SERVO) devices.insert(temp_uid);
}
***************
*** 224,228 ****
case LP_UNI_SERVO:
case LP_QUAD_SERVO:
! //case LP_8WAY_SERVO:
{
CServoController *sc = new CServoController (uid);
--- 225,229 ----
case LP_UNI_SERVO:
case LP_QUAD_SERVO:
! case LP_8WAY_SERVO:
{
CServoController *sc = new CServoController (uid);
Index: CServoController.cc
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/phidget++/CServoController.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** CServoController.cc 23 Dec 2002 04:38:40 -0000 1.10
--- CServoController.cc 24 Jun 2003 02:43:51 -0000 1.11
***************
*** 35,43 ****
break;
}
! //case LP_8WAY_SERVO:
! //{
! //setServoCount(8);
! //break;
! //}
default:
throw runtime_error("Can't initialize a CServoController with a phidget that is not a servo controller");
--- 35,43 ----
break;
}
! case LP_8WAY_SERVO:
! {
! setServoCount(8);
! break;
! }
default:
throw runtime_error("Can't initialize a CServoController with a phidget that is not a servo controller");
***************
*** 189,192 ****
--- 189,231 ----
error(phidgetQuadServo(device(), p1, p2, p3, p4));
+ }
+ else
+ if (_servoCount==8)
+ {
+ float p1 = 0, p2 = 0, p3 = 0, p4 = 0;
+ float p5 = 0, p6 = 0, p7 = 0, p8 = 0;
+
+ if (_servoCount >= 1 && _servos[0].second != NULL)
+ p1 = _servos[0].second->position();
+
+ if (_servoCount >= 2 && _servos[1].second != NULL)
+ p2 = _servos[1].second->position();
+
+ if (_servoCount >= 3 && _servos[2].second != NULL)
+ p3 = _servos[2].second->position();
+
+ if (_servoCount >= 4 && _servos[3].second != NULL)
+ p4 = _servos[3].second->position();
+
+ if (_servoCount >= 5 && _servos[4].second != NULL)
+ p5 = _servos[4].second->position();
+
+ if (_servoCount >= 6 && _servos[5].second != NULL)
+ p6 = _servos[5].second->position();
+
+ if (_servoCount >= 7 && _servos[6].second != NULL)
+ p7 = _servos[6].second->position();
+
+ if (_servoCount >= 8 && _servos[7].second != NULL)
+ p8 = _servos[7].second->position();
+
+ phidget8Servo(device(),0,p1,0,0);
+ phidget8Servo(device(),1,p2,0,0);
+ phidget8Servo(device(),2,p3,0,0);
+ phidget8Servo(device(),3,p4,0,0);
+ phidget8Servo(device(),4,p5,0,0);
+ phidget8Servo(device(),5,p6,0,0);
+ phidget8Servo(device(),6,p7,0,0);
+ phidget8Servo(device(),7,p8,0,0);
}
METHOD_UNGUARD;
|