Exemple #1
0
        private void setupClearButtons()
        {
            if (Pk2.isPK3)             // PICkit 3
            {
                buttonBack.Enabled = false;
                buttonBack.Visible = false;
                buttonNext.Enabled = false;
                buttonNext.Visible = false;

                if (Pk2.UnitIDRead().Length > 0)
                {
                    buttonClearUnitID_PK3.Enabled = true;
                    buttonClearUnitID_PK3.Visible = true;
                    buttonSetUnitID.Enabled       = false;
                    buttonSetUnitID.Visible       = false;
                }
                else
                {
                    buttonClearUnitID_PK3.Enabled = false;
                    buttonClearUnitID_PK3.Visible = false;
                    buttonSetUnitID.Enabled       = true;
                    buttonSetUnitID.Visible       = true;
                }
            }
            else             // PICkit 2
            {
                buttonClearUnitID_PK3.Enabled = false;
                buttonClearUnitID_PK3.Visible = false;
                buttonClearUnitID_PK3.Text    = "";

                if (Pk2.isCalibrated())
                {
                    buttonClearCal.Enabled = true;
                    buttonClearCal.Text    = "Clear Calibration";
                }
                else
                {
                    buttonClearCal.Enabled = false;
                    buttonClearCal.Text    = "Unit Not Calibrated";
                }

                if (Pk2.UnitIDRead().Length > 0)
                {
                    buttonClearUnitID.Enabled = true;
                    buttonClearUnitID.Text    = "Clear Unit ID";
                }
                else
                {
                    buttonClearUnitID.Enabled = false;
                    buttonClearUnitID.Text    = "No Assigned ID";
                }
            }
        }
Exemple #2
0
        public DialogCalibrate()
        {
            InitializeComponent();
            Pk2.VddOff();
            Pk2.ForcePICkitPowered();
            setupClearButtons();

            if (Pk2.isPK3)
            {
                panelIntro.Visible  = false;
                panelSetup.Visible  = false;
                panelCal.Visible    = false;
                panelUnitID.Visible = true;
                textBoxUnitID.Text  = Pk2.UnitIDRead();
            }
        }
Exemple #3
0
 private void setupClearButtons()
 {
     if (Pk2.isCalibrated())
     {
         buttonClearCal.Enabled = true;
         buttonClearCal.Text    = "Clear Calibration";
     }
     else
     {
         buttonClearCal.Enabled = false;
         buttonClearCal.Text    = "Unit Not Calibrated";
     }
     if (Pk2.UnitIDRead().Length > 0)
     {
         buttonClearUnitID.Enabled = true;
         buttonClearUnitID.Text    = "Clear Unit ID";
     }
     else
     {
         buttonClearUnitID.Enabled = false;
         buttonClearUnitID.Text    = "No Assigned ID";
     }
 }
Exemple #4
0
 private void buttonNext_Click(object sender, EventArgs e)
 {
     if (panelIntro.Visible)
     {
         panelIntro.Visible = false;
         panelSetup.Visible = true;
         buttonBack.Enabled = true;
     }
     else if (panelSetup.Visible)
     {
         panelSetup.Visible      = false;
         panelCal.Visible        = true;
         buttonCalibrate.Enabled = true;
         labelGoodCal.Visible    = false;
         labelBadCal.Visible     = false;
         textBoxVDD.Text         = "4.000";
         textBoxVDD.Focus();
         textBoxVDD.SelectAll();
         Pk2.SetVoltageCals(0x0100, 0x00, 0x80); // set to defaults.
         Pk2.SetVDDVoltage(4.0F, 3.4F);
         Pk2.VddOn();
     }
     else if (panelCal.Visible)
     {
         panelCal.Visible        = false;
         panelUnitID.Visible     = true;
         buttonSetUnitID.Enabled = true;
         labelAssignedID.Visible = false;
         textBoxUnitID.Text      = Pk2.UnitIDRead();
         textBoxUnitID.Focus();
         textBoxVDD.SelectAll();
         buttonNext.Enabled = false;
         buttonCancel.Text  = "Finished";
         Pk2.VddOff();
     }
 }