Skip to content

Commit

Permalink
Merge pull request #1732 from xodio/fix-default-board-in-upload-popup
Browse files Browse the repository at this point in the history
Fix default board index value
  • Loading branch information
brusherru authored Mar 27, 2019
2 parents 1016474 + a4c23e0 commit bfdf445
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PopupUploadConfig extends React.Component {
}

onBoardChanged(event) {
this.changeBoard(event.target.value);
this.changeBoard(parseInt(event.target.value, 10) || 0);
}

onUploadClicked() {
Expand Down Expand Up @@ -94,8 +94,15 @@ class PopupUploadConfig extends React.Component {
isBoardSelected && boards[selectedBoard.index];

const defaultBoardIndex = R.compose(
R.defaultTo(0),
R.findIndex(R.propEq('fqbn', 'arduino:avr:uno'))
R.when(R.equals(-1), R.always(0)),
R.findIndex(
R.either(
// If arduino:avr is not installed yet:
R.propEq('name', 'Arduino/Genuino Uno'),
// If it already installed:
R.propEq('fqbn', 'arduino:avr:uno')
)
)
)(boards);

if (!isBoardSelected || !doesSelectedBoardExist) {
Expand Down

0 comments on commit bfdf445

Please sign in to comment.