Skip to content

Commit 4c1d5f6

Browse files
author
jantje
committed
2 parents 3f8aa88 + ccae5ff commit 4c1d5f6

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

io.sloeber.core/src/jUnit/CreateAndCompile.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,11 @@ public static Collection boards() {
407407
{ "package_sparkfun_index.json", "SparkFun", "SparkFun AVR Boards", "atmega128rfa1", "" }, //
408408

409409
// Teensy
410-
{ "local", Shared.teensyBoards_txt, "", "teensy31", "usb=serial\nspeed=96\nkeys=en-us" }, //
411-
{ "local", Shared.teensyBoards_txt, "", "teensy30", "usb=serial\nspeed=96\nkeys=en-us" }, //
412-
{ "local", Shared.teensyBoards_txt, "", "teensyLC", "usb=serial\nl\nspeed=48\nkeys=en-us" }, //
413-
{ "local", Shared.teensyBoards_txt, "", "teensypp2", "usb=serial\nspeed=16\nkeys=en-us" }, //
414-
{ "local", Shared.teensyBoards_txt, "", "teensy2", "usb=serial\nspeed=16\nkeys=en-us" }, //
410+
{ "local", Shared.getTeensyBoard_txt(), "", "teensy31", "usb=serial\nspeed=96\nkeys=en-us" }, //
411+
{ "local", Shared.getTeensyBoard_txt(), "", "teensy30", "usb=serial\nspeed=96\nkeys=en-us" }, //
412+
{ "local", Shared.getTeensyBoard_txt(), "", "teensyLC", "usb=serial\nl\nspeed=48\nkeys=en-us" }, //
413+
{ "local", Shared.getTeensyBoard_txt(), "", "teensypp2", "usb=serial\nspeed=16\nkeys=en-us" }, //
414+
{ "local", Shared.getTeensyBoard_txt(), "", "teensy2", "usb=serial\nspeed=16\nkeys=en-us" }, //
415415

416416
// TeeOnArdu avr
417417
{ "package_adafruit_index.json", "TeeOnArdu", "Adafruit TeeOnArdu", "TeeOnArdu",
@@ -516,7 +516,7 @@ public static void installAdditionalBoards() {
516516
"https://udooboard.github.io/arduino-board-package/package_udoo_index.json" };
517517
BoardsManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), true);
518518
BoardsManager.installAllLatestPlatforms();
519-
BoardsManager.referenceLocallInstallation(Shared.teensyInstall);
519+
BoardsManager.referenceLocallInstallation(Shared.getTeensyPlatform());
520520
}
521521

522522
@Test

io.sloeber.core/src/jUnit/Regression.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static void WaitForInstallerToFinish() {
4141
public static void installAdditionalBoards() {
4242
String[] packageUrlsToAdd = { "http://talk2arduino.wisen.com.au/master/package_talk2.wisen.com_index.json" };
4343
BoardsManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), true);
44+
BoardsManager.referenceLocallInstallation(Shared.getTeensyPlatform());
4445
}
4546

4647
/**
@@ -76,7 +77,7 @@ public void issue555() {
7677
teensyOptions.put("usb", "serial");
7778
teensyOptions.put("speed", "96");
7879
teensyOptions.put("keys", "en-us");
79-
BoardDescriptor teensyBoardid = BoardsManager.getBoardID("local", Shared.teensyBoards_txt, "", "teensy31",
80+
BoardDescriptor teensyBoardid = BoardsManager.getBoardID("local", Shared.getTeensyBoard_txt(), "", "teensy31",
8081
teensyOptions);
8182
IProject theTestProject = null;
8283
CodeDescriptor codeDescriptor = CodeDescriptor.createDefaultIno();

io.sloeber.core/src/jUnit/Shared.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,23 @@
1515

1616
@SuppressWarnings("nls")
1717
public class Shared {
18-
public static String teensyInstall = "D:/arduino/arduino-1.6.9 - Teensy 1.29/hardware";
19-
public static String teensyBoards_txt = teensyInstall + "/teensy/avr/boards.txt";
18+
private static String teensyInstall = "D:/arduino/arduino-1.6.9 - Teensy 1.29/hardware/teensy";
19+
private static String teensyInstallLinux = "/home/jantje/programs/arduino-1.8.0/hardware/teensy";
20+
21+
public static String getTeensyPlatform(){
22+
switch (Platform.getOS()){
23+
case Platform.OS_WIN32:
24+
return teensyInstall;
25+
case Platform.OS_LINUX:
26+
return teensyInstallLinux ;
27+
}
28+
return null;
29+
}
30+
31+
32+
public static String getTeensyBoard_txt(){
33+
return getTeensyPlatform() + "/avr/boards.txt";
34+
}
2035

2136
public static boolean hasBuildErrors(IProject project) throws CoreException {
2237
IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);

io.sloeber.ui/src/io/sloeber/ui/wizard/newsketch/NewSketchWizardCodeSelectionPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void handleEvent(Event event) {
136136
* Checkbox settings
137137
*/
138138
protected void SetControls() {
139-
switch (CodeTypes.values()[this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex()]) {
139+
switch (CodeTypes.values()[Math.max(0,this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex())]) {
140140
case defaultIno:
141141
this.mTemplateFolderEditor.setEnabled(false, this.mParentComposite);
142142
this.mExampleEditor.setEnabled(false);
@@ -170,7 +170,7 @@ protected void validatePage() {
170170
if (this.mCodeSourceOptionsCombo == null) {
171171
return;
172172
}
173-
switch (CodeTypes.values()[this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex()]) {
173+
switch (CodeTypes.values()[Math.max(0, this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex())]) {
174174
case defaultIno:
175175
case defaultCPP:
176176
setPageComplete(true);// default always works

0 commit comments

Comments
 (0)