private void btnAutoFixAngle_Click(object sender, RoutedEventArgs e)
        {
            int angle = 0;

            try
            {
                angle = int.Parse(txtFixAngle.Text.Trim());
                if ((angle < 0) || (angle > 180))
                {
                    UpdateInfo("輸入角度不正確", MyUtil.UTIL.InfoType.error);
                    return;
                }
            }
            catch (Exception)
            {
                UpdateInfo("輸入角度不正確", MyUtil.UTIL.InfoType.error);
                return;
            }

            byte id = (byte)activeServo;

            if (UBT.V2_SetAngle(id, (byte)angle, 0))
            {
                UBT.V2_MoveServo(id, (byte)angle, 50);
            }
            UBT.LockServo(id, true);
            UpdateActiveServo();
        }
Пример #2
0
 private void cbxActiveLocked_Changed(object sender, RoutedEventArgs e)
 {
     if ((!updating_servo_info) && (activeServo > 0))
     {
         bool goLock = (this.cbxActiveLocked.IsChecked == true);
         List <data.ServoInfo> lsi = new List <data.ServoInfo>();
         lsi.Add(new data.ServoInfo((byte)activeServo));
         UBT.LockServo(lsi, goLock);
         UpdateActiveServoInfo();
     }
 }
Пример #3
0
        private void SetSelectedServoLock(bool goLock)
        {
            List <data.ServoInfo> lsi = new List <data.ServoInfo>();

            for (byte i = 1; i <= CONST.MAX_SERVO; i++)
            {
                if (servo[i].isSelected)
                {
                    lsi.Add(new data.ServoInfo(i));
                }
            }
            UBT.LockServo(lsi, goLock);
            UpdateActiveServoInfo();
        }
Пример #4
0
        private void ServoLockChange(object sender, EventArgs e)
        {
            uc.UcServo ucServo = (uc.UcServo)sender;
            byte       id      = ucServo.id;

            if ((id < 1) || (id > CONST.MAX_SERVO))
            {
                return;
            }

            bool goLock = !servo[id].locked;
            List <data.ServoInfo> lsi = new List <data.ServoInfo>();

            lsi.Add(new data.ServoInfo(id));
            UBT.LockServo(lsi, goLock);
            //            servo[id].Show();
            if (activeServo == id)
            {
                UpdateActiveServoInfo();
            }
        }
Пример #5
0
 private void btnLockAll_Click(object sender, RoutedEventArgs e)
 {
     UpdateInfo();
     UBT.LockServo(0, true);
 }