Skip to content

Commit 602236b

Browse files
authored
Merge pull request #744 from Sloeber/release_4.1
Release 4.1
2 parents 7266d5d + 6a45b81 commit 602236b

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

io.sloeber.core/src/io/sloeber/core/common/ConfigurationPreferences.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,25 @@ public class ConfigurationPreferences {
4040
private static final String PRE_PROCESSING_BOARDS_TXT = "pre_processing_boards.txt"; //$NON-NLS-1$
4141
private static final String POST_PROCESSING_BOARDS_TXT = "post_processing_boards.txt"; //$NON-NLS-1$
4242
private static final String KEY_UPDATE_JASONS = "Update jsons files"; //$NON-NLS-1$
43-
private static final String KEY_MANAGER_JSON_URLS = "Arduino Manager board Urls"; //$NON-NLS-1$
43+
private static final String KEY_MANAGER_JSON_URLS_V3 = "Arduino Manager board Urls"; //$NON-NLS-1$
44+
private static final String KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL = "http://downloads.arduino.cc/libraries/library_index.json"; //$NON-NLS-1$
45+
private static final String KEY_MANAGER_JSON_URLS = "Manager jsons"; //$NON-NLS-1$
4446
private static final String DEFAULT_JSON_URLS = "http://downloads.arduino.cc/packages/package_index.json" //$NON-NLS-1$
45-
+ System.lineSeparator() + "http://arduino.esp8266.com/stable/package_esp8266com_index.json" //$NON-NLS-1$
46-
+ System.lineSeparator() + "http://downloads.arduino.cc/libraries/library_index.json"; //$NON-NLS-1$
47+
// + System.lineSeparator() +
48+
// "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
49+
// //$NON-NLS-1$
50+
+ System.lineSeparator() + KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL;
4751
// preference nodes
4852
public static final String NODE_ARDUINO = Activator.NODE_ARDUINO;
4953

5054
private ConfigurationPreferences() {
5155
}
5256

57+
private static void removeKey(String key) {
58+
IEclipsePreferences myScope = ConfigurationScope.INSTANCE.getNode(NODE_ARDUINO);
59+
myScope.remove(key);
60+
}
61+
5362
private static String getString(String key, String defaultValue) {
5463
IEclipsePreferences myScope = ConfigurationScope.INSTANCE.getNode(NODE_ARDUINO);
5564
return myScope.get(key, defaultValue);
@@ -144,7 +153,24 @@ public static File getPostProcessingBoardsFile() {
144153
}
145154

146155
public static String getJsonURLs() {
147-
return getString(KEY_MANAGER_JSON_URLS, DEFAULT_JSON_URLS);
156+
// TODO I added some code here to get easier from V3 to V4
157+
// the library json url is now managed as the boards url's so it also
158+
// needs to be added to the json url's
159+
// this is doen in the default but people who have installed other
160+
// boards or do not move to the default (which is by default)
161+
// wil not see libraries
162+
// to fix this I changed the storage name and if the new storage name is
163+
// empty I read the ol one and add the lib
164+
String ret = getString(KEY_MANAGER_JSON_URLS, DEFAULT_JSON_URLS);
165+
if (DEFAULT_JSON_URLS.equals(ret)) {
166+
ret = getString(KEY_MANAGER_JSON_URLS_V3, DEFAULT_JSON_URLS);
167+
if (!DEFAULT_JSON_URLS.equals(ret)) {
168+
ret += System.lineSeparator() + KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL;
169+
setString(KEY_MANAGER_JSON_URLS, ret);
170+
removeKey(KEY_MANAGER_JSON_URLS_V3);
171+
}
172+
}
173+
return ret;
148174
}
149175

150176
public static String getDefaultJsonURLs() {

io.sloeber.core/src/io/sloeber/core/tools/uploaders/arduinoUploader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public boolean uploadUsingPreferences(IFile hexFile, boolean usingProgrammer, IP
5252
.getValue().equalsIgnoreCase(Const.TRUE);
5353
} catch (Exception e) {// ignore all errors
5454
}
55-
String NewSerialPort = MComPort;
55+
String NewSerialPort = boardDescriptor.getUploadPort();
5656
if (!usingProgrammer) {
5757
NewSerialPort = ArduinoSerial.makeArduinoUploadready(this.myConsole.newMessageStream(), this.myProject,
5858
this.mycConf, boardDescriptor);

0 commit comments

Comments
 (0)