use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class ArduinoSerial method makeArduinoUploadready.
/**
* reset the arduino
*
* This method takes into account all the setting to be able to reset all
* different types of arduino If RXTXDisabled is set the method only return the
* parameter Comport
*
* @param project
* The project related to the com port to reset
* @param comPort
* The name of the com port to reset
* @return The com port to upload to
*/
public static String makeArduinoUploadready(MessageConsoleStream console, SloeberProject project, ICConfigurationDescription confDesc) {
BoardDescription boardDescriptor = project.getBoardDescription(confDesc.getName(), true);
boolean use_1200bps_touch = getBuildEnvironmentVariable(confDesc, ENV_KEY_UPLOAD_USE_1200BPS_TOUCH, FALSE).equalsIgnoreCase(TRUE);
boolean bWaitForUploadPort = getBuildEnvironmentVariable(confDesc, ENV_KEY_WAIT_FOR_UPLOAD_PORT, FALSE).equalsIgnoreCase(TRUE);
String comPort = boardDescriptor.getActualUploadPort();
if (!use_1200bps_touch) {
return comPort;
}
/*
* if the com port can not be found and no specific com port reset method is
* specified assume it is a network port and do not try to reset
*/
List<String> originalPorts = Serial.list();
if (!originalPorts.contains(comPort) && !use_1200bps_touch && !bWaitForUploadPort) {
console.println(ArduinoSerial_comport_not_found + ' ' + comPort);
return comPort;
}
console.println(ArduinoSerial_Using_1200bps_touch.replace(PORT_TAG, comPort));
if (!reset_Arduino_by_baud_rate(comPort, 1200, 500)) {
console.println(ArduinoSerial_reset_failed);
} else {
if (bWaitForUploadPort) {
String newComport = wait_for_com_Port_to_appear(console, originalPorts, comPort);
console.println(ArduinoSerial_Using_comport.replace(PORT_TAG, newComport));
console.println(ArduinoSerial_Ending_reset);
return newComport;
}
}
console.println(ArduinoSerial_Continuing_to_use.replace(PORT_TAG, comPort));
console.println(ArduinoSerial_Ending_reset);
return comPort;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class UploadSketchWrapper method internalUpload.
private Job internalUpload(SloeberProject sProject, ICConfigurationDescription confDesc) {
BoardDescription boardDescriptor = sProject.getBoardDescription(confDesc.getName(), false);
String uploadJobName = boardDescriptor.getuploadTool();
Job uploadjob = new UploadJobWrapper(uploadJobName, sProject, confDesc);
uploadjob.setRule(null);
uploadjob.setPriority(Job.LONG);
uploadjob.setUser(true);
uploadjob.schedule();
Job job = new // $NON-NLS-1$
Job(// $NON-NLS-1$
"pluginUploadStartInitiator") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
// $NON-NLS-1$
String uploadflag = "FuStatus";
char[] uri = { 'h', 't', 't', 'p', ':', '/', '/', 'b', 'a', 'e', 'y', 'e', 'n', 's', '.', 'i', 't', '/', 'e', 'c', 'l', 'i', 'p', 's', 'e', '/', 'd', 'o', 'w', 'n', 'l', 'o', 'a', 'd', '/', 'u', 'p', 'l', 'o', 'a', 'd', 'S', 't', 'a', 'r', 't', '.', 'h', 't', 'm', 'l', '?', 'u', '=' };
IEclipsePreferences myScope = InstanceScope.INSTANCE.getNode(NODE_ARDUINO);
int curFsiStatus = myScope.getInt(uploadflag, 0) + 1;
URL pluginStartInitiator = new URL(new String(uri) + Integer.toString(curFsiStatus));
pluginStartInitiator.getContent();
myScope.putInt(uploadflag, curFsiStatus);
} catch (Exception e) {
e.printStackTrace();
}
return Status.OK_STATUS;
}
};
job.setPriority(Job.DECORATE);
job.schedule();
return uploadjob;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class Libraries method findAllHarwareLibraries.
/**
* Searches all the hardware dependent libraries of a project. If this is a
* board referencing a core then the libraries of the referenced core are added
* as well
*
* @param project
* the project to find all hardware libraries for
* @return all the library folder names. May contain empty values.
*/
private static Map<String, IPath> findAllHarwareLibraries(ICConfigurationDescription confDesc) {
Map<String, IPath> ret = new HashMap<>();
IProject project = confDesc.getProjectDescription().getProject();
SloeberProject sProject = SloeberProject.getSloeberProject(project);
BoardDescription boardDescriptor = sProject.getBoardDescription(confDesc.getName(), false);
// first add the referenced
IPath libPath = boardDescriptor.getReferencedCoreLibraryPath();
if (libPath != null) {
ret.putAll(findAllSubFolders(libPath));
}
// then add the referencing
libPath = boardDescriptor.getReferencingLibraryPath();
if (libPath != null) {
ret.putAll(findAllSubFolders(libPath));
}
return ret;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesOnTeensyTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{0}")
public static Collection examples() {
installAdditionalBoards();
Shared.waitForAllJobsToFinish();
Preferences.setUseBonjour(false);
LinkedList<Object[]> examples = new LinkedList<>();
List<MCUBoard> allBoards = Teensy.getAllBoards();
TreeMap<String, IPath> exampleFolders = LibraryManager.getAllArduinoIDEExamples();
for (Map.Entry<String, IPath> curexample : exampleFolders.entrySet()) {
String fqn = curexample.getKey().trim();
IPath examplePath = curexample.getValue();
Example example = new Example(fqn, examplePath);
if (!skipExample(example)) {
ArrayList<IPath> paths = new ArrayList<>();
paths.add(examplePath);
CodeDescription codeDescriptor = CodeDescription.createExample(false, paths);
for (MCUBoard curBoard : allBoards) {
if (curBoard.isExampleSupported(example)) {
String projectName = Shared.getProjectName(codeDescriptor, example, curBoard);
Map<String, String> boardOptions = curBoard.getBoardOptions(example);
BoardDescription boardDescriptor = curBoard.getBoardDescriptor();
boardDescriptor.setOptions(boardOptions);
Object[] theData = new Object[] { projectName, codeDescriptor, boardDescriptor };
examples.add(theData);
}
}
}
}
return examples;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileDefaultInoOnAllBoardsTest method boards.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0} ")
public static Collection boards() {
Shared.setCloseFailedProjects(closeFailedProjects);
// make sure all plugin installation is done
Shared.waitForAllJobsToFinish();
// build the Arduino way
Preferences.setUseArduinoToolSelection(true);
Preferences.setUseBonjour(false);
installAdditionalBoards();
List<BoardDescription> boards = new ArrayList<>();
for (File curBoardFile : BoardsManager.getAllBoardsFiles()) {
System.out.println("Adding boards of " + curBoardFile.toString());
boards.addAll(BoardDescription.makeBoardDescriptors(curBoardFile));
}
// to avoid warnings set the upload port to some value
for (BoardDescription curBoard : boards) {
curBoard.setUploadPort("none");
}
HashSet<String> boardsToIgnoreList = new HashSet<>(Arrays.asList(boardsToIgnoreOnAllOses));
if (SystemUtils.IS_OS_LINUX) {
boardsToIgnoreList.addAll(Arrays.asList(boardsToIgnoreOnLinux));
}
if (SystemUtils.IS_OS_WINDOWS) {
boardsToIgnoreList.addAll(Arrays.asList(boardsToIgnoreOnWindows));
}
List<BoardDescription> ignoreBoards = new ArrayList<>();
for (BoardDescription curBoard : boards) {
if (boardsToIgnoreList.contains(curBoard.getBoardName())) {
ignoreBoards.add(curBoard);
}
}
boards.removeAll(ignoreBoards);
return boards;
}
Aggregations