Beispiel #1
0
 /**
  * Sets the current position to be the origin.
  *
  * @param devKey
  * @param dir
  * @param pos
  */
 public void setOrigin(Devices.Keys devKey, Joystick.Directions dir) {
   try {
     String mmDevice = devices_.getMMDeviceException(devKey);
     switch (dir) {
       case X:
         if (devices_.isXYStage(devKey)) {
           double ypos = getUpdatedPosition(devKey, Joystick.Directions.Y);
           core_.setAdapterOriginXY(
               mmDevice, 0.0, ypos); // so serial com, since adapter keeps own origin
         }
         break;
       case Y:
         if (devices_.isXYStage(devKey)) {
           double xpos = getUpdatedPosition(devKey, Joystick.Directions.X);
           core_.setAdapterOriginXY(
               mmDevice, xpos, 0.0); // so serial com, since adapter keeps own origin
         }
         break;
       case NONE:
       default:
         if (devices_.is1DStage(devKey)) {
           core_.setOrigin(mmDevice);
         }
         break;
     }
   } catch (Exception ex) {
     MyDialogUtils.showError(ex);
   }
 }