Example #1
0
        /// <summary>
        /// コンストラクタ(言語指定なし)
        /// </summary>
        /// <param name="svoff">オフセット情報</param>
        /// <param name="io">入出力状態</param>
        public ServoCalib(ServoOffset svoff, stRobotIOStatus io)
        {
            InitializeComponent();

            this.svoff   = svoff;
            nudD9.Value  = svoff.getValue(0);
            nudD10.Value = svoff.getValue(1);
            nudD11.Value = svoff.getValue(2);
            nudD12.Value = svoff.getValue(3);
            nudD2.Value  = svoff.getValue(4);
            nudD4.Value  = svoff.getValue(5);
            nudD7.Value  = svoff.getValue(6);
            nudD8.Value  = svoff.getValue(7);

            nudD9.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD10.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD11.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD12.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD2.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD4.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD7.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD8.ValueChanged  += new EventHandler(nud_ValueChanged);

            this.io        = io;
            nudD9.Enabled  = io.fSvMotor1Used;
            nudD10.Enabled = io.fSvMotor2Used;
            nudD11.Enabled = io.fSvMotor3Used;
            nudD12.Enabled = io.fSvMotor4Used;
            nudD2.Enabled  = io.fSvMotor5Used;
            nudD4.Enabled  = io.fSvMotor6Used;
            nudD7.Enabled  = io.fSvMotor7Used;
            nudD8.Enabled  = io.fSvMotor8Used;

            // DCモーター校正メニュー初期化
            byte m1Rate = svoff.getDCCalibInfo().calibM1Rate;
            byte m2Rate = svoff.getDCCalibInfo().calibM2Rate;

            Debug.Write("Pin: " + m1Rate);
            tbM1.Value       = (int)(255 * m1Rate / 100.0);
            lbDCM1Value.Text = tbM1.Value.ToString();
            tbM2.Value       = (int)(255 * m2Rate / 100.0);
            lbDCM2Value.Text = tbM2.Value.ToString();

            // 初期化完了後にイベント登録
            this.tbM1.ValueChanged += new System.EventHandler(this.tbDC_ValueChanged);
            this.tbM2.ValueChanged += new System.EventHandler(this.tbDC_ValueChanged);

            // M1/M2どちらかが未使用の場合は機能をオフにする
            if (!(io.fDCMotor1Used && io.fDCMotor2Used))
            {
                gbDC.Enabled = false;
            }
        }
Example #2
0
        public ServoCalib(ServoOffset svoff, stRobotIOStatus io, int lang)
            : this()
        {
            switch (lang)
            {
            case ENGLISH:
                tsmiEnglish_Click();
                break;

            case JAPAN:
                tsmiJapanese_Click();
                break;

            case CHINESE:
                tsmiChinese_Click();
                break;

            case HIRAGANA:
                tsmiJapanese_Click();
                convToHiragana();
                break;

            default:
                break;
            }


            this.svoff   = svoff;
            nudD9.Value  = svoff.getValue(0);
            nudD10.Value = svoff.getValue(1);
            nudD11.Value = svoff.getValue(2);
            nudD12.Value = svoff.getValue(3);
            nudD2.Value  = svoff.getValue(4);
            nudD4.Value  = svoff.getValue(5);
            nudD7.Value  = svoff.getValue(6);
            nudD8.Value  = svoff.getValue(7);

            nudD9.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD10.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD11.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD12.ValueChanged += new EventHandler(nud_ValueChanged);
            nudD2.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD4.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD7.ValueChanged  += new EventHandler(nud_ValueChanged);
            nudD8.ValueChanged  += new EventHandler(nud_ValueChanged);

            this.io        = io;
            nudD9.Enabled  = io.fSvMotor1Used;
            nudD10.Enabled = io.fSvMotor2Used;
            nudD11.Enabled = io.fSvMotor3Used;
            nudD12.Enabled = io.fSvMotor4Used;
            nudD2.Enabled  = io.fSvMotor5Used;
            nudD4.Enabled  = io.fSvMotor6Used;
            nudD7.Enabled  = io.fSvMotor7Used;
            nudD8.Enabled  = io.fSvMotor8Used;

            // DCモーター校正メニュー初期化
            byte m1Rate = svoff.getDCCalibInfo().calibM1Rate;
            byte m2Rate = svoff.getDCCalibInfo().calibM2Rate;

            Debug.Write("Pin: " + m1Rate);
            tbM1.Value       = (int)(255 * m1Rate / 100.0);
            lbDCM1Value.Text = tbM1.Value.ToString();
            tbM2.Value       = (int)(255 * m2Rate / 100.0);
            lbDCM2Value.Text = tbM2.Value.ToString();

            // 初期化完了後にイベント登録
            this.tbM1.ValueChanged += new System.EventHandler(this.tbDC_ValueChanged);
            this.tbM2.ValueChanged += new System.EventHandler(this.tbDC_ValueChanged);

            // M1/M2どちらかが未使用の場合は機能をオフにする
            if (!(io.fDCMotor1Used && io.fDCMotor2Used))
            {
                gbDC.Enabled = false;
            }
        }