Example #1
0
        private void btUpload_Click(object sender, EventArgs e)
        {
            var path  = GetTargetPath();
            var port  = cbComPorts.SelectedValue?.ToString();
            var board = cbBoards.SelectedValue?.ToString();

            if (Path.GetExtension(path) != ".ino")
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(port))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(board))
            {
                return;
            }

            txOutput.Text = $"--- Uploading {Path.GetFileName(path)} ---";
            serialPortDisconnect();
            var    options = GetCompileOptions();
            string rst     = ArduinoCLI_API.UploadSketch(port, board, Path.GetDirectoryName(path), options);

            txOutput.Text += '\n' + rst + '\n';
        }
Example #2
0
        private void LoadBoardDetails(Board board)
        {
            if (board == null)
            {
                return;
            }

            BoardDetail             = ArduinoCLI_API.GetBoardDetails(board.Fqbn);
            gvProperties.DataSource = BoardDetail.Options;

            foreach (DataGridViewRow row in gvProperties.Rows)
            {
                var option = row.DataBoundItem as BoardOption;
                var cell   = row.Cells["Value"] as DataGridViewComboBoxCell;
                cell.DataSource = option.Values;
                cell.Value      = option.Values.First(v => v.Selected).Value;
            }
        }
Example #3
0
 private void LoadBoards()
 {
     Boards.Clear();
     Boards.AddRange(ArduinoCLI_API.GetInstalledBoards().OrderBy(b => b.Fqbn));
     ((BindingSource)(cbBoards.DataSource)).ResetBindings(false);
 }
Example #4
0
 private void LoadPorts()
 {
     Ports.Clear();
     Ports.AddRange(ArduinoCLI_API.GetPorts());
     ((BindingSource)(cbComPorts.DataSource)).ResetBindings(false);
 }