Exemple #1
0
        private void ServoLedChange(object sender, EventArgs e)
        {
            uc.UcServo ucServo = (uc.UcServo)sender;
            byte       id      = ucServo.id;

            if ((id < 1) || (id > CONST.MAX_SERVO))
            {
                return;
            }
            byte mode = servo[id].led;

            switch (mode)
            {
            case CONST.LED.NO_CHANGE:
                mode = CONST.LED.TURN_ON;
                UBT.V2_SetLED(id, 0);
                break;

            case CONST.LED.TURN_ON:
                mode = CONST.LED.TURN_OFF;
                UBT.V2_SetLED(id, 1);
                break;

            default:
                mode = CONST.LED.NO_CHANGE;
                break;
            }
            servo[id].SetLED(mode);
            servo[id].Show();
            if (activeServo == id)
            {
                UpdateActiveServoInfo();
            }
        }
Exemple #2
0
 private void rbLed_Clicked(object sender, RoutedEventArgs e)
 {
     if (activeServo > 0)
     {
         byte mode = CONST.LED.NO_CHANGE;
         if (rbLedTurnOff.IsChecked == true)
         {
             mode = CONST.LED.TURN_OFF;
             UBT.V2_SetLED((byte)activeServo, 1);
         }
         else if (rbLedTurnOn.IsChecked == true)
         {
             mode = CONST.LED.TURN_ON;
             UBT.V2_SetLED((byte)activeServo, 0);
         }
         servo[activeServo].SetLED(mode);
         servo[activeServo].Show();
     }
 }
Exemple #3
0
 private void SetAllLed(byte mode)
 {
     UpdateInfo();
     for (int i = 1; i <= CONST.MAX_SERVO; i++)
     {
         servo[i].SetLED(mode);
         servo[i].Show();
     }
     if (mode == CONST.LED.TURN_ON)
     {
         UBT.V2_SetLED(0, 0);
     }
     else if (mode == CONST.LED.TURN_OFF)
     {
         UBT.V2_SetLED(0, 1);
     }
     if (activeServo > 0)
     {
         UpdateActiveServoInfo();
     }
 }