1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Merge remote-tracking branch 'arduino/ide-1.5.x' into ide-1.5.x-discovery

This commit is contained in:
Federico Fissore
2013-05-13 16:58:10 +02:00
36 changed files with 171 additions and 139 deletions

View File

@ -31,6 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
import javax.jmdns.ServiceEvent;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.apache.commons.logging.impl.LogFactoryImpl;
import org.apache.commons.logging.impl.NoOpLog;
@ -42,7 +43,6 @@ import processing.app.helpers.FileUtils;
import processing.app.helpers.PreferencesMap;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
import processing.app.packages.Library;
import processing.app.packages.LibraryList;
import processing.app.tools.ZipDeflater;
@ -1112,6 +1112,7 @@ public class Base {
}
});
importMenu.add(addLibraryMenuItem);
importMenu.addSeparator();
// Split between user supplied libraries and IDE libraries
TargetPlatform targetPlatform = getTargetPlatform();

View File

@ -131,8 +131,7 @@ public class EditorListener {
// The char is not control code when CTRL key pressed? It should be a shortcut.
if (!Character.isISOControl(c)) {
event.consume();
return true;
return false;
}
}

View File

@ -27,6 +27,9 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.datatransfer.*;
import static processing.app.I18n._;
/**
* Panel just below the editing area that contains status messages.
@ -68,6 +71,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
JButton okButton;
JTextField editField;
JProgressBar progressBar;
JButton copyErrorButton;
//Thread promptThread;
int response;
@ -109,6 +113,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void notice(String message) {
mode = NOTICE;
this.message = message;
copyErrorButton.setVisible(false);
//update();
repaint();
}
@ -121,6 +126,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void error(String message) {
mode = ERR;
this.message = message;
copyErrorButton.setVisible(true);
repaint();
}
@ -178,6 +184,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
this.message = message;
progressBar.setIndeterminate(false);
progressBar.setVisible(true);
copyErrorButton.setVisible(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
@ -190,6 +197,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
progressBar.setIndeterminate(true);
progressBar.setValue(50);
progressBar.setVisible(true);
copyErrorButton.setVisible(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
repaint();
}
@ -208,6 +216,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
if (Preferences.getBoolean("editor.beep.compile")) {
Toolkit.getDefaultToolkit().beep();
}
if (progressBar == null) return;
progressBar.setVisible(false);
progressBar.setValue(0);
setCursor(null);
@ -217,6 +226,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
public void progressUpdate(int value)
{
if (progressBar == null) return;
progressBar.setValue(value);
repaint();
}
@ -442,6 +452,32 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
add(progressBar);
progressBar.setVisible(false);
copyErrorButton = new JButton(
"<html>" + _("Copy error") + "<br>" + _("to clipboard") + "</html>");
Font font = copyErrorButton.getFont();
font = new Font(font.getName(), font.getStyle(), (int) (font.getSize()*0.7));
copyErrorButton.setFont(font);
copyErrorButton.setHorizontalAlignment(JLabel.CENTER);
add(copyErrorButton);
copyErrorButton.setVisible(false);
copyErrorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String message="";
if ((Preferences.getBoolean("build.verbose")) == false) {
message = " " + _("This report would have more information with") + "\n";
message += " \"" + _("Show verbose output during compilation") + "\"\n";
message += " " + _("enabled in File > Preferences.") + "\n";
}
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n";
message += editor.console.consoleTextPane.getText().trim();
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection data = new StringSelection(message);
clipboard.setContents(data, null);
Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
if (unixclipboard != null) unixclipboard.setContents(data, null);
}
});
}
}
@ -474,6 +510,10 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
editWidth, editHeight);
progressBar.setBounds(noLeft, editTop, editWidth, editHeight);
Dimension copyErrorButtonSize = copyErrorButton.getPreferredSize();
copyErrorButton.setLocation(sizeW - copyErrorButtonSize.width - 5, top);
copyErrorButton.setSize(copyErrorButtonSize.width, Preferences.BUTTON_HEIGHT);
}

View File

@ -1191,6 +1191,16 @@ public class JEditTextArea extends JComponent
selectionEndLine = newEndLine;
biasLeft = newBias;
if (newStart != newEnd) {
Clipboard unixclipboard = getToolkit().getSystemSelection();
if (unixclipboard != null) {
String selection = getSelectedText();
if (selection != null) {
unixclipboard.setContents(new StringSelection(selection), null);
}
}
}
fireCaretEvent();
}
@ -1653,7 +1663,11 @@ public class JEditTextArea extends JComponent
for(int i = 0; i < repeatCount; i++)
buf.append(selection);
clipboard.setContents(new StringSelection(buf.toString()),null);
Transferable t = new StringSelection(buf.toString());
clipboard.setContents(t, null);
Clipboard unixclipboard = getToolkit().getSystemSelection();
if (unixclipboard != null) unixclipboard.setContents(t, null);
}
}
@ -2210,6 +2224,25 @@ public class JEditTextArea extends JComponent
return;
}
// on Linux, middle button pastes selected text
if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {
Clipboard unixclipboard = getToolkit().getSystemSelection();
if (unixclipboard != null) {
Transferable t = unixclipboard.getContents(null);
if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
try {
String s = (String)t.getTransferData(DataFlavor.stringFlavor);
s = s.replace('\u00A0', ' ');
if (editable) setSelectedText(s);
} catch (Exception e) {
System.err.println(e);
e.printStackTrace();
}
}
return;
}
}
int line = yToLine(evt.getY());
int offset = xToOffset(line,evt.getX());
int dot = getLineStartOffset(line) + offset;

View File

@ -108,6 +108,8 @@ public class DiscourseFormat {
// i don't care about ownership
}
});
Clipboard unixclipboard = Toolkit.getDefaultToolkit().getSystemSelection();
if (unixclipboard != null) unixclipboard.setContents(formatted, null);
editor.statusNotice("Code formatted for " +
(html ? "HTML" : "the Arduino forum ") +

View File

@ -19,6 +19,8 @@
by David A. Mellis
modified 30 Aug 2011
by Limor Fried
modified 28 Dec 2012
by Mike Walters
This example code is in the public domain.
@ -43,6 +45,9 @@ long debounceDelay = 50; // the debounce time; increase if the output flicker
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
// set initial LED state
digitalWrite(ledPin, ledState);
}
void loop() {
@ -62,11 +67,20 @@ void loop() {
if ((millis() - lastDebounceTime) > debounceDelay) {
// whatever the reading is at, it's been there for longer
// than the debounce delay, so take it as the actual current state:
// if the button state has changed:
if (reading != buttonState) {
buttonState = reading;
// only toggle the LED if the new button state is HIGH
if (buttonState == HIGH) {
ledState = !ledState;
}
}
}
// set the LED using the state of the button:
digitalWrite(ledPin, buttonState);
// set the LED:
digitalWrite(ledPin, ledState);
// save the reading. Next time through the loop,
// it'll be the lastButtonState:

View File

@ -19,7 +19,7 @@
http://www.arduino.cc/en/Tutorial/KeyboardButton
*/
const int buttonPin = 2; // input pin for pushbutton
const int buttonPin = 4; // input pin for pushbutton
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter

BIN
build/shared/lib/arduino_icon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

View File

@ -184,6 +184,8 @@ parseInt KEYWORD2
parseFloat KEYWORD2
readBytes KEYWORD2
readBytesUntil KEYWORD2
readString KEYWORD2
readStringUntil KEYWORD2
# USB-related keywords

View File

@ -98,22 +98,32 @@ ARDUINO 1.5 BETA - 2012.10.22
* For more info refer to this press release:
http://arduino.cc/blog/2012/10/22/arduino-1-5-support-for-the-due-and-other-processors-easier-library-installation-simplified-board-menu-etc/
ARDUINO 1.0.5 - 2013.03.29
ARDUINO 1.0.5 - 2013.05.15
[core]
* [avr] malloc bug: backported avr-libc 1.8.0 implementation
* [avr] removed deprecated interrupt handlers causing compiler issues
with newer avr-gcc.
* [avr] added c_str() method to String
* [avr] Stream "_timeout" field and related methods are now protected
[libraries]
* Upgrades to WiFi library
* Fixed a bunch of examples
[firmwares]
* Upgrades to WiFi firmwares
[ide]
* Backport from 1.5: install Library from .zip file or folder
* Added button "Copy error to clipboard" (Paul Stoffregen)
* Updated windows drivers
* Added Windows installer
ARDUINO 1.0.4 - 2013.03.11
[core]

Binary file not shown.

View File

@ -1,7 +1,7 @@
; Copyright 2012 Blacklabel Development, Inc.
[Strings]
DriverPackageDisplayName="Arduino Boards"
DriverPackageDisplayName="Arduino USB Driver"
ManufacturerName="Arduino LLC (www.arduino.cc)"
ServiceName="USB RS-232 Emulation Driver"
due.bossa.name="Bossa Program Port"

BIN
build/windows/dist/drivers/dpinst-amd64.exe vendored Executable file

Binary file not shown.

BIN
build/windows/dist/drivers/dpinst-x86.exe vendored Executable file

Binary file not shown.

View File

@ -48,7 +48,7 @@ void yield(void);
#define EXTERNAL 1
#define INTERNAL 2
#else
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#else

View File

@ -37,7 +37,7 @@ readBytesBetween( pre_string, terminator, buffer, length)
class Stream : public Print
{
private:
protected:
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
unsigned long _startMillis; // used for timeout measurement
int timedRead(); // private method to read stream with timeout

View File

@ -45,7 +45,7 @@ int analogRead(uint8_t pin)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega32U4__)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#elif defined(analogPinToChannel) && (defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__))
pin = analogPinToChannel(pin);

View File

@ -54,7 +54,7 @@ extern "C"{
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define EXTERNAL_NUM_INTERRUPTS 3
#elif defined(__AVR_ATmega32U4__)
#define EXTERNAL_NUM_INTERRUPTS 4

View File

@ -1,81 +0,0 @@
/*
DNS and DHCP-based Web client
This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen
*/
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.google.com";
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
while(true);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(serverName, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
while(true);
}
}

View File

@ -127,6 +127,7 @@ void connectToServer() {
// make HTTP GET request to twitter:
client.println("GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1");
client.println("HOST: api.twitter.com");
client.println("Connection: close");
client.println();
}
// note the time of this connect attempt:

View File

@ -8,8 +8,9 @@
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
modified 9 Apr 2012
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen
*/
@ -19,7 +20,13 @@
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(173,194,33,104); // Google
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
char server[] = "www.google.com"; // name address for Google (using DNS)
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192,168,0,177);
// Initialize the Ethernet client library
// with the IP address and port of the server
@ -37,8 +44,8 @@ void setup() {
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
@ -48,7 +55,9 @@ void setup() {
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.0");
client.println("GET /search?q=arduino HTTP/1.1");
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
else {
@ -73,8 +82,7 @@ void loop()
client.stop();
// do nothing forevermore:
for(;;)
;
while(true);
}
}

View File

@ -63,12 +63,11 @@ void loop() {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);

View File

@ -126,7 +126,7 @@ void sendData(int thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
client.print("Host: api.pachube.com\n");
client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@ -139,7 +139,7 @@ void sendData(int thisData)
client.println(thisLength);
// last pieces of the HTTP PUT request:
client.print("Content-Type: text/csv\n");
client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();

View File

@ -138,7 +138,7 @@ void sendData(String thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
client.print("Host: api.pachube.com\n");
client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@ -147,8 +147,8 @@ void sendData(String thisData)
client.println(thisData.length());
// last pieces of the HTTP PUT request
client.print("Content-Type: text/csv\n");
client.println("Connection: close\n");
client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();
// here's the actual content of the PUT request

View File

@ -2,8 +2,8 @@
Web client
This sketch connects to a website through a GSM shield. Specifically,
this example downloads the URL "http://arduino.cc/" and prints it
to the Serial monitor.
this example downloads the URL "http://arduino.cc/asciilogo.txt" and
prints it to the Serial monitor.
Circuit:
* GSM shield attached to an Arduino
@ -34,7 +34,7 @@ GSM gsmAccess;
// URL, path & port (for example: arduino.cc)
char server[] = "arduino.cc";
char path[] = "/";
char path[] = "/asciilogo.txt";
int port = 80; // port 80 is the default for HTTP
void setup()
@ -72,7 +72,10 @@ void setup()
// Make a HTTP request:
client.print("GET ");
client.print(path);
client.println(" HTTP/1.0");
client.println(" HTTP/1.1");
client.print("Host: ");
client.println(server);
client.println("Connection: close");
client.println();
}
else

View File

@ -60,7 +60,7 @@ void loop() {
}
int digitalPotWrite(int address, int value) {
void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:

View File

@ -31,8 +31,8 @@ int keyIndex = 0; // your network key Index number (needed only for W
int status = WL_IDLE_STATUS;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
IPAddress server(173,194,73,105); // numeric IP for Google (no DNS)
//char server[] = "www.google.com"; // name address for Google (using DNS)
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
char server[] = "www.google.com"; // name address for Google (using DNS)
// Initialize the Ethernet client library
// with the IP address and port of the server

View File

@ -78,12 +78,11 @@ void loop() {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
@ -108,6 +107,7 @@ void loop() {
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");

View File

@ -37,7 +37,7 @@ readBytesBetween( pre_string, terminator, buffer, length)
class Stream : public Print
{
private:
protected:
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
unsigned long _startMillis; // used for timeout measurement
int timedRead(); // private method to read stream with timeout

View File

@ -146,6 +146,7 @@ public:
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const;
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
{getBytes((unsigned char *)buf, bufsize, index);}
const char * c_str() const { return buffer; }
// search
int indexOf( char ch ) const;