Skip to content

Improve first use experience for Upload before Port selected #7958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/processing/app/SketchController.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ private boolean upload(String suggestedClassName, boolean usingProgrammer) throw

UploaderUtils uploaderInstance = new UploaderUtils();
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
if (uploader == null) {
editor.statusError(tr("Please select a Port before Upload"));
return false;
}

EditorConsole.setCurrentEditorConsole(editor.console);

Expand Down
11 changes: 10 additions & 1 deletion arduino-core/src/cc/arduino/UploaderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ public Uploader getUploaderByPreferences(boolean noUploadPort) {

BoardPort boardPort = null;
if (!noUploadPort) {
boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port"));
String port = PreferencesData.get("serial.port");
if (port == null || port.isEmpty()) {
return null;
}
boardPort = BaseNoGui.getDiscoveryManager().find(port);
//if (boardPort == null) {
// Is there ever a reason to attempt upload when
// the Port is not found by DiscoveryManager?
//return null;
//}
}

return new UploaderFactory().newUploader(target.getBoards().get(board), boardPort, noUploadPort);
Expand Down