mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
boards.txt modified. java code updated
This commit is contained in:
parent
09f643972c
commit
0b8489d31e
@ -1661,7 +1661,7 @@ public class Sketch {
|
||||
TargetPlatform target = Base.getTargetPlatform();
|
||||
String board = Preferences.get("board");
|
||||
|
||||
Uploader uploader = new UploaderFactory().newUploader(target.getBoards().get(board));
|
||||
Uploader uploader = new UploaderFactory().newUploader(target.getBoards().get(board), Preferences.get("serial.port"));
|
||||
|
||||
boolean success = uploader.uploadUsingPreferences(buildPath, suggestedClassName, usingProgrammer);
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
package processing.app.debug;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.helpers.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class UploaderFactory {
|
||||
|
||||
public Uploader newUploader(Map<String, String> preferences) {
|
||||
if ("http".equals(preferences.get("upload.tool"))) {
|
||||
private static final Pattern IPV4_ADDRESS = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
|
||||
|
||||
public Uploader newUploader(Map<String, String> preferences, String port) {
|
||||
if ("true".equals(preferences.get("upload.via_http")) && IPV4_ADDRESS.matcher(port).find()) {
|
||||
return new HttpUploader();
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,24 @@ public class UploaderFactoryTest extends AbstractWithPreferencesTest {
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfHttpUploader() throws Exception {
|
||||
Map<String, String> prefs = new HashMap<String, String>();
|
||||
prefs.put("upload.tool", "http");
|
||||
Uploader uploader = new UploaderFactory().newUploader(prefs);
|
||||
prefs.put("upload.via_http", "true");
|
||||
Uploader uploader = new UploaderFactory().newUploader(prefs, "192.168.0.1 (mydogstick)");
|
||||
|
||||
assertTrue(uploader instanceof HttpUploader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfBasicUploader() throws Exception {
|
||||
public void shouldCreateAnInstanceOfBasicUploaderWhenHTTPIsUnsupported() throws Exception {
|
||||
Map<String, String> prefs = new HashMap<String, String>();
|
||||
prefs.put("upload.tool", "whatever");
|
||||
Uploader uploader = new UploaderFactory().newUploader(prefs);
|
||||
Uploader uploader = new UploaderFactory().newUploader(prefs, "192.168.0.1 (mydogstick)");
|
||||
|
||||
assertTrue(uploader instanceof BasicUploader);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateAnInstanceOfBasicUploaderWhenPortIsSerial() throws Exception {
|
||||
Map<String, String> prefs = new HashMap<String, String>();
|
||||
Uploader uploader = new UploaderFactory().newUploader(prefs, "/dev/ttyACM0 (Arduino Leonardo)");
|
||||
|
||||
assertTrue(uploader instanceof BasicUploader);
|
||||
}
|
||||
|
@ -4,14 +4,32 @@ menu.cpu=Processor
|
||||
|
||||
##############################################################
|
||||
|
||||
dogstick.name=Arduino Dogstick
|
||||
dogstick.upload.tool=http
|
||||
dogstick.name=Arduino DogStick
|
||||
dogstick.upload.via_http=true
|
||||
dogstick.upload.tool=avrdude
|
||||
dogstick.upload.protocol=avr109
|
||||
dogstick.upload.maximum_size=28672
|
||||
dogstick.upload.speed=57600
|
||||
dogstick.upload.disable_flushing=true
|
||||
dogstick.upload.use_1200bps_touch=true
|
||||
dogstick.upload.wait_for_upload_port=true
|
||||
|
||||
dogstick.build.mcu=atmega328p
|
||||
dogstick.bootloader.tool=avrdude
|
||||
dogstick.bootloader.low_fuses=0xff
|
||||
dogstick.bootloader.high_fuses=0xd8
|
||||
dogstick.bootloader.extended_fuses=0xcb
|
||||
dogstick.bootloader.file=caterina/Caterina-Leonardo.hex
|
||||
dogstick.bootloader.unlock_bits=0x3F
|
||||
dogstick.bootloader.lock_bits=0x2F
|
||||
|
||||
dogstick.build.mcu=atmega32u4
|
||||
dogstick.build.f_cpu=16000000L
|
||||
dogstick.build.board=ARDUINO_UNO
|
||||
dogstick.build.vid=0x2341
|
||||
dogstick.build.pid=0x8036
|
||||
dogstick.build.board=ARDUINO_DOGSTICK
|
||||
dogstick.build.core=arduino
|
||||
dogstick.build.variant=standard
|
||||
dogstick.build.variant=leonardo
|
||||
dogstick.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
||||
|
||||
##############################################################
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user