Skip to content

Bug in SoftwareSerial when using inverse logic #1362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 127 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
bb9ba54
Bug in SoftwareSerial when using inverse logic
jenscski Apr 12, 2013
e061a04
Fix Debounce example to work as described
miek Dec 28, 2012
2937bce
Added support for all variants of Sanguino
Lauszus Apr 4, 2013
ecb774c
added driver install utility (dpinst 32- and 64-bit) and Arduino icon…
zeveland Apr 12, 2013
ae7f92f
small changes to the Debounce example
Fede85 Apr 16, 2013
ea990f6
Moved refresh client from html meta tag to http header
Fede85 Apr 16, 2013
c6544f6
WifiWebServer example: Moved the autorefresh feature inside the http …
Fede85 Apr 17, 2013
ed9be1e
WebServer example: Added comments
Fede85 Apr 17, 2013
ee1eeec
Support select-paste on Linux (Paul Stoffregen)
PaulStoffregen Apr 22, 2013
03201e6
Add "Copy To Clipboard" button for compile errors (Paul Stoffregen)
PaulStoffregen Apr 22, 2013
efe03b1
Corrected the return type of the digitalPotWrite in the SPI/DigitalPo…
Fede85 Apr 24, 2013
8cccafa
changed the pin where to connect the button from 2 to 4 to be complia…
Fede85 Apr 30, 2013
199f216
updated driver description string to "Arduino USB Driver". includes …
zeveland May 1, 2013
35e1601
Nicer button for 'Copy error to clipboard'
cmaglie May 3, 2013
2e28ab2
Stream "_timeout" field and related methods are now protected instead…
cmaglie May 6, 2013
898e163
Added c_str() method to String class.
cmaglie May 6, 2013
d720d5e
Added const modifier to String.c_str()
cmaglie May 6, 2013
af725a2
added colored keywords readString and readStringUntil
Fede85 May 9, 2013
7d8c681
Revert ""Add library" moved into "Import library" menu"
cmaglie May 10, 2013
5a9bc14
keep included folder name as top level folder name, delete MAC folder…
cmaglie May 10, 2013
c7d7a67
import library also import folder (already expanded libraries)
ffissore Oct 18, 2012
e777bdc
"Add library" moved into "Import library" menu
cmaglie Apr 6, 2013
e5f7d97
improved import library: complains if invalid zip or folders are sele…
ffissore Oct 19, 2012
5d0a0f0
also rebuild examples menu after library import
ffissore Oct 19, 2012
3415081
better error message when library names clash
ffissore Oct 19, 2012
7e42ba3
Disabled 'fat' (multiplatform) library check.
cmaglie Oct 24, 2012
02d9a60
removed check on .h file existence
ffissore Dec 4, 2012
76ccc74
Backported OnlyDirs.class
cmaglie May 11, 2013
73694fa
Fixed disappearing 'Import library' menu
cmaglie May 11, 2013
1031755
Updated revision log
cmaglie May 11, 2013
6e793fe
Added robot hardware
cmaglie May 13, 2013
8e6cc7b
Added support to INT6 on Leonardo.
Fede85 May 13, 2013
049455b
Updated drivers for robot
cmaglie May 14, 2013
3c25a35
Added Arduino Robot libraries
cmaglie May 15, 2013
9baa8cd
Reverted 'copy error' button for 1.0.5, waiting for a better UI design
cmaglie May 15, 2013
8877c57
Updated revision log
cmaglie May 15, 2013
b154670
Robot has its own core
cmaglie May 17, 2013
ea63bc1
fixed order in how the commands were executed
May 16, 2013
126c2af
fixed glitch with the screen when starting the process
May 16, 2013
80fda92
fixed the classic fix vs stroke issue after migrating to the TFT library
May 16, 2013
3aa4ae9
added the TFT display library
Fede85 May 17, 2013
2b9f455
added a better configurarion string for the line following example
May 17, 2013
90a2bd2
Added notification about the need of the IR-Remote library
May 17, 2013
3b08cdc
added a better configurarion string for the line following example
May 17, 2013
6a4f458
Fixed upload for robot boards
cmaglie May 17, 2013
f261317
Fixed upload for robot boards
cmaglie May 17, 2013
c333554
Fixed spelling error in Horizon example
shfitz May 18, 2013
4dfdab1
Reintroduced copy error button.
cmaglie May 22, 2013
e23a191
Fixes #1432
Fede85 May 23, 2013
c30f7a7
keywords syntax highlighting corrected in SoftwareSerial library
Fede85 May 24, 2013
587daf8
Use analogPinToChannel if it's defined
Lauszus Apr 17, 2013
41d92fc
Removed call to analogPinToChannel for Leonardo
Lauszus Apr 17, 2013
7ed2df7
Check if ATmega32u4 is defined
Lauszus Apr 17, 2013
ddf05ad
Fix for #814, Memory Leak
bjelojac Apr 25, 2013
dd3efb7
Removed double instance of the same code
Lauszus May 1, 2013
db995ef
Added remove methods to WString
snargledorf Jun 5, 2013
6f7f6ef
add String.toFloat
tevino May 29, 2013
472bf52
Minor typo correction
mikalhart Jun 8, 2013
29c055c
Update incorrect docs in tonePitchFollower example
mcoms Jun 11, 2013
1524985
Fixed a typo in the WebServer example.
Jul 29, 2013
9435ac7
Fixed robot libraries and examples for unified Arduino core
Aug 21, 2013
7dc7938
USB serial baud arg type
pbrook Sep 2, 2013
8c00bad
USB CDC two argument begin()
pbrook Sep 2, 2013
86a2a49
Latest Adafruit_GFX fixes + moved GFX lib to utility folder
PaintYourDragon Sep 3, 2013
2dfe77a
Fix indentation (cosmetic)
supcik Oct 6, 2013
dd7ec12
It was still using jdk FileNameExtensionFilter
Oct 14, 2013
953827f
Added missing class FileNameExtensionFilter
Oct 14, 2013
bbfdc60
Removed destructor from File.cpp and SD.h as it leads to unexpected c…
cmaglie Oct 17, 2013
9d9ccda
Update readme.txt
cmaglie Oct 23, 2013
4f6af5a
Display line numbers for the file being edited
Oct 28, 2013
4944b2a
add preference to enable/disable line numbers
Oct 29, 2013
c8142b0
Render line numbers using TextAreaPainter
Nov 3, 2013
20c662e
Added Arduino Ethernet variant.
cmaglie Nov 3, 2013
2b0770e
Added LED_BUILTIN constant to Leonardo board
cmaglie Nov 3, 2013
de73eb4
Changed LED_BUILTIN to a macro to better support boards that do not h…
cmaglie Nov 3, 2013
fdec60a
Help 3rd party installers find the hardware path
PaulStoffregen Jul 27, 2013
53e529f
Fix robot problems regarding new version of Arduino
Nov 4, 2013
ed2c83c
Updates to a number of Examples
shfitz Nov 8, 2013
1c9b7d6
Added SERIAL metadata into variant files.
cmaglie Nov 11, 2013
256ca19
Updated listfiles SD example
shfitz Nov 11, 2013
754921c
Updated Blink without delay example
shfitz Nov 11, 2013
4f59363
Modified LCD custom character example
shfitz Nov 11, 2013
52304d8
Updated KeyboardMessage example
shfitz Nov 11, 2013
a973513
Fix SERIAL_* metadata in Arduino Ethernet variant
cmaglie Nov 11, 2013
446fcec
add operator==, remoteIP and remotePort to EthernetClient
ntruchsess Nov 25, 2013
366a85a
add localPort to EthernetClient, simplify operator==
ntruchsess Nov 27, 2013
65d6ed6
add some lines of comment to ChatServer.ino, remove redundant assignm…
ntruchsess Nov 27, 2013
a825624
revert Chatserver example, create new AdvancedChatServer based on it
ntruchsess Nov 28, 2013
f769cb2
apply AdvancedChatServer.ino changes to renamed ChatServer.ino
ntruchsess Nov 28, 2013
01d6b53
remove all Changes besides operator==
ntruchsess Dec 6, 2013
ee2c603
update AdvancedChatServer.ino, add operator!=
ntruchsess Dec 6, 2013
eb9cafe
Changed pins definition in variants from constants to #defines.
cmaglie Dec 13, 2013
58bc646
Updated drivers signature for Windows
cmaglie Jan 7, 2014
695d712
Updated revisions log
cmaglie Jan 8, 2014
b58785d
Signed drivers for Windows 8.1
cmaglie Jan 8, 2014
7dd4753
Compile with -x assembler-with-cpp instead of -assembler-with-cpp.
Jan 21, 2014
a24ae39
Minor changes to Communication Examples
shfitz Jan 29, 2014
8d7262d
Update readme.txt
KonradIT Jan 29, 2014
fad6226
Update and rename readme.txt to README.mkdn
KonradIT Jan 29, 2014
85daa2c
Rename README.mkdn to README.md
KonradIT Jan 29, 2014
6474abf
Updated Listfiles SD example
shfitz Feb 2, 2014
409554e
WiFi Shield examples: added the firmware version check
Fede85 Feb 6, 2014
cfe24c7
If 2 libs have same .h file, use the lib with same dir name
PaulStoffregen Feb 10, 2014
fb50563
Fixed issue #1478, #1599, #1709, motors being opposite, updated turni…
X-Y Feb 12, 2014
abe0cfb
Revert "Changed pins definition in variants from constants to #defines."
cmaglie Feb 11, 2014
c467b8a
Added some friendly messages for Arduino Robot include errors on old …
cmaglie Feb 12, 2014
966959d
Added license for Arduino.h, binary.h and main.cpp (master branch)
cmaglie Feb 10, 2014
34be368
Added license for Client, IPAddressm and Server (master branch)
cmaglie Feb 7, 2014
ac2a9ea
Update README.md
felixphew Feb 16, 2014
0679694
Local (user installed) libraries have priority over system libraries
cmaglie Feb 17, 2014
8d2a6a5
Removed unused code, fixed indentation.
cmaglie Feb 17, 2014
e64cfa4
Corrected repeated 'less' in checkName's message
h2g2guy Feb 19, 2014
4dce78a
Added copyright license for WiFi shield library
cmaglie Feb 27, 2014
bae0f01
Windows: arduino_debug.exe. Backport of ad2ff737bb871ebf9a1374924a580…
Feb 27, 2014
e9b8ff2
added support for '-' and '.' but both not as the first as first char…
oni303 Feb 27, 2014
7f506c1
cut the filename at the last '.' not at the first in tab-names of the…
oni303 Feb 27, 2014
87d6509
Esplora: added reading form Tinkerkit inputs
egueli Mar 3, 2014
3fd2320
Windows: launch4j gets downloaded at build time
Mar 4, 2014
5b69564
Update to Esplora example
shfitz Mar 8, 2014
f399d28
Added compatibity for 1.5 libraries layout on IDE 1.0.x
cmaglie Mar 20, 2014
bc2ee29
Update README.md
Ramoonus Mar 24, 2014
5cf12b0
Fixed string constructor overloading bug
majenkotech Apr 1, 2014
8f4c11a
Import WString from 1.5.6
majenkotech Apr 1, 2014
1c896a4
Fixed example StringStartsWithEndsWith.ino
cmaglie Apr 7, 2014
8ddee77
fix comments on spaceship example
jaimeiniesta May 1, 2014
187b5c6
Modified Keyboard Reprogram example
shfitz May 3, 2014
7f414a4
Updated Blink
shfitz May 8, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ build/linux/dist/*.tar.gz
build/linux/*.tgz
test-bin
*.iml
build/windows/launch4j-*
build/windows/launcher/launch4j
build/windows/WinAVR-*.zip
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Arduino
========

* Arduino is an open-source physical computing platform based on a simple i/o
board and a development environment that implements the Processing/Wiring
language. Arduino can be used to develop stand-alone interactive objects or
can be connected to software on your computer (e.g. Flash, Processing, MaxMSP).
The boards can be assembled by hand or purchased preassembled; the open-source
IDE can be downloaded for free.

* For more information, see the website at: http://www.arduino.cc/
or the forums at: http://arduino.cc/forum/

* To report a *bug* in the software or to request *a simple enhancement* go to:
http://github.com/arduino/Arduino/issues

* More complex requests and technical discussion should go on the Arduino Developers
mailing list:
https://groups.google.com/a/arduino.cc/forum/#!forum/developers

* If you're interested in modifying or extending the Arduino software, we strongly
suggest discussing your ideas on the Developers mailing list *before* starting
to work on them. That way you can coordinate with the Arduino Team and others,
giving your work a higher chance of being integrated into the official release
https://groups.google.com/a/arduino.cc/forum/#!forum/developers

Installation
------------
Detailed instructions are in reference/Guide_Windows.html and
reference/Guide_MacOSX.html. For Linux, see the Arduino playground:
http://www.arduino.cc/playground/Learning/Linux

Credits
--------
Arduino is an open source project, supported by many.

The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe,
Gianluca Martino, Daniela Antonietti, and David A. Mellis.

Arduino uses the [GNU avr-gcc toolchain](http://gcc.gnu.org/wiki/avr-gcc), [avrdude](http://www.nongnu.org/avrdude/), [avr-libc](http://www.nongnu.org/avr-libc/), and code from
[Processing](http://www.processing.org) and [Wiring](http://wiring.org.co).

Icon and about image designed by [ToDo](http://www.todo.to.it/)

173 changes: 108 additions & 65 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

import processing.app.debug.Compiler;
import processing.app.debug.Target;
import processing.app.helpers.FileUtils;
import processing.app.helpers.filefilters.OnlyDirs;
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
import processing.app.tools.ZipDeflater;
import processing.core.*;
import static processing.app.I18n._;
Expand Down Expand Up @@ -117,7 +120,7 @@ static public void main(String args[]) {
File versionFile = getContentFile("lib/version.txt");
if (versionFile.exists()) {
String version = PApplet.loadStrings(versionFile)[0];
if (!version.equals(VERSION_NAME)) {
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
VERSION_NAME = version;
RELEASE = true;
}
Expand All @@ -126,6 +129,10 @@ static public void main(String args[]) {
e.printStackTrace();
}

// help 3rd party installers find the correct hardware path
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);

// if (System.getProperty("mrj.version") != null) {
// //String jv = System.getProperty("java.version");
// String ov = System.getProperty("os.version");
Expand Down Expand Up @@ -949,9 +956,10 @@ public void rebuildImportMenu(JMenu importMenu, final Editor editor) {
JMenuItem addLibraryMenuItem = new JMenuItem(_("Add Library..."));
addLibraryMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.this.handleAddZipLibrary(editor);
Base.this.handleAddLibrary(editor);
Base.this.onBoardOrPortChange();
Base.this.rebuildImportMenu(Editor.importMenu, editor);
Base.this.rebuildExamplesMenu(Editor.examplesMenu);
}
});
importMenu.add(addLibraryMenuItem);
Expand Down Expand Up @@ -1203,62 +1211,51 @@ public void actionPerformed(ActionEvent event) {
boolean ifound = false;

for (String potentialName : list) {
File subfolder = new File(folder, potentialName);
// File libraryFolder = new File(subfolder, "library");
// File libraryJar = new File(libraryFolder, potentialName + ".jar");
// // If a .jar file of the same prefix as the folder exists
// // inside the 'library' subfolder of the sketch
// if (libraryJar.exists()) {
String sanityCheck = Sketch.sanitizeName(potentialName);
if (!sanityCheck.equals(potentialName)) {
String mess = I18n.format(
_("The library \"{0}\" cannot be used.\n" +
"Library names must contain only basic letters and numbers.\n" +
"(ASCII only and no spaces, and it cannot start with a number)"),
potentialName
);
Base.showMessage(_("Ignoring bad library name"), mess);
continue;
}
File libFolder = new File(folder, potentialName);
String sanityCheck = Sketch.sanitizeName(potentialName);
if (!sanityCheck.equals(potentialName)) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
potentialName);
Base.showMessage(_("Ignoring bad library name"), mess);
continue;
}

String libraryName = potentialName;
// // get the path for all .jar files in this code folder
// String libraryClassPath =
// Compiler.contentsToClassPath(libraryFolder);
// // grab all jars and classes from this folder,
// // and append them to the library classpath
// librariesClassPath +=
// File.pathSeparatorChar + libraryClassPath;
// // need to associate each import with a library folder
// String packages[] =
// Compiler.packageListFromClassPath(libraryClassPath);
libraries.add(subfolder);
String libraryName = potentialName;
libraries.add(libFolder);
String libFolderPath = libFolder.getAbsolutePath();
try {
String packages[] =
Compiler.headerListFromIncludePath(subfolder.getAbsolutePath());
for (String pkg : packages) {
importToLibraryTable.put(pkg, subfolder);
String headers[] = Compiler.headerListFromIncludePath(libFolderPath);
for (String header : headers) {
// Extract file name (without extension ".h")
String name = header.substring(0, header.length() - 2);

// If the header name equals to the current library folder use it
if (libFolderPath.endsWith(name)) {
importToLibraryTable.put(header, libFolder);
continue;
}

// If a library was already found with this header, keep it if
// the library's directory name matches the header name.
File old = importToLibraryTable.get(header);
if (old != null) {
if (old.getPath().endsWith(name))
continue;
}
importToLibraryTable.put(header, libFolder);
}
} catch (IOException e) {
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
showWarning(_("Error"), I18n.format(
"Unable to list header files in {0}", libFolder), e);
}

JMenuItem item = new JMenuItem(libraryName);
item.addActionListener(listener);
item.setActionCommand(subfolder.getAbsolutePath());
menu.add(item);
ifound = true;

// XXX: DAM: should recurse here so that library folders can be nested
// } else { // not a library, but is still a folder, so recurse
// JMenu submenu = new JMenu(libraryName);
// // needs to be separate var, otherwise would set ifound to false
// boolean found = addLibraries(submenu, subfolder);
// if (found) {
// menu.add(submenu);
// ifound = true;
// }
// }
JMenuItem item = new JMenuItem(libraryName);
item.addActionListener(listener);
item.setActionCommand(libFolderPath);
menu.add(item);
ifound = true;
}
return ifound;
}
Expand Down Expand Up @@ -2374,24 +2371,70 @@ static protected void listFiles(String basePath,
}
}

public void handleAddLibrary(Editor editor) {
JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home"));
fileChooser.setDialogTitle(_("Select a zip file or a folder containing the library you'd like to add"));
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter(_("ZIP files or folders"), "zip"));

public void handleAddZipLibrary(Editor editor) {
String prompt = _("Select a zip file containing the library you'd like to add");
FileDialog fd = new FileDialog(editor, prompt, FileDialog.LOAD);
fd.setDirectory(System.getProperty("user.home"));
fd.setVisible(true);
Dimension preferredSize = fileChooser.getPreferredSize();
fileChooser.setPreferredSize(new Dimension(preferredSize.width + 200, preferredSize.height + 200));

String directory = fd.getDirectory();
String filename = fd.getFile();
if (filename == null) return;
int returnVal = fileChooser.showOpenDialog(editor);

if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}

File sourceFile = fileChooser.getSelectedFile();
File tmpFolder = null;

File sourceFile = new File(directory, filename);
try {
ZipDeflater zipDeflater = new ZipDeflater(sourceFile, getSketchbookLibrariesFolder());
zipDeflater.deflate();
// unpack ZIP
if (!sourceFile.isDirectory()) {
try {
tmpFolder = FileUtils.createTempFolder();
ZipDeflater zipDeflater = new ZipDeflater(sourceFile, tmpFolder);
zipDeflater.deflate();
File[] foldersInTmpFolder = tmpFolder.listFiles(new OnlyDirs());
if (foldersInTmpFolder.length != 1) {
throw new IOException(_("Zip doesn't contain a library"));
}
sourceFile = foldersInTmpFolder[0];
} catch (IOException e) {
editor.statusError(e);
return;
}
}

// is there a valid library?
File libFolder = sourceFile;
String libName = libFolder.getName();
if (!Sketch.isSanitaryName(libName)) {
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
+ "Library names must contain only basic letters and numbers.\n"
+ "(ASCII only and no spaces, and it cannot start with a number)"),
libName);
editor.statusError(mess);
return;
}

// copy folder
File destinationFolder = new File(getSketchbookLibrariesFolder(), sourceFile.getName());
if (!destinationFolder.mkdir()) {
editor.statusError(I18n.format(_("A library named {0} already exists"), sourceFile.getName()));
return;
}
try {
FileUtils.copy(sourceFile, destinationFolder);
} catch (IOException e) {
editor.statusError(e);
return;
}
editor.statusNotice(_("Library added to your libraries. Check \"Import library\" menu"));
} catch (IOException e) {
editor.statusError(e);
} finally {
// delete zip created temp folder, if exists
FileUtils.recursiveDelete(tmpFolder);
}
}
}
6 changes: 4 additions & 2 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void windowActivated(WindowEvent e) {
// re-add the sub-menus that are shared by all windows
fileMenu.insert(sketchbookMenu, 2);
fileMenu.insert(examplesMenu, 3);
//sketchMenu.insert(importMenu, 4);
sketchMenu.insert(importMenu, 4);
toolsMenu.insert(boardsMenu, numTools);
toolsMenu.insert(serialMenu, numTools + 1);
}
Expand All @@ -188,7 +188,7 @@ public void windowDeactivated(WindowEvent e) {
// System.err.println("deactivate"); // not coming through
fileMenu.remove(sketchbookMenu);
fileMenu.remove(examplesMenu);
//sketchMenu.remove(importMenu);
sketchMenu.remove(importMenu);
toolsMenu.remove(boardsMenu);
toolsMenu.remove(serialMenu);
}
Expand Down Expand Up @@ -430,6 +430,8 @@ protected void applyPreferences() {
textarea.setEditable(!external);
saveMenuItem.setEnabled(!external);
saveAsMenuItem.setEnabled(!external);

textarea.setDisplayLineNumbers(Preferences.getBoolean("editor.linenumbers"));

TextAreaPainter painter = textarea.getPainter();
if (external) {
Expand Down
Loading