Show Posts
Pages: 1 ... 14 15 [16] 17
226  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Occasional "Couldn't determine program size on: April 10, 2009, 01:51:18 pm
Almost certainly a race condition, when I look at the offending code.

I never saw this on an iMac, but with a multi-core Mac Pro I get it every single time.  An annoyance, for sure.

I'll try to look at this one this week-end.


Ok, try this patch (for Arduino-0015):

How you patch an installed Arduino IDE is platform dependent.  I can't figure out how to tweak the classpath on OS X, but I suspect it involves hacking the Info.plist in the .app.  If someone figures this out, please reply back with instructions.

Windows users can probably unzip this into the directory (you may have to create it) referred to in the run.bat (this same directory is also known to the Arduino.exe.)

I don't know where you put it for Linux.

In a nutshell: unzip this file into a location that is before any of the Arduinbo jarfiles on the CLASSPATH, making sure to preserve the path.  Restart Arduino.

I'll post the code back to the right place once I convince myself my approach is sane.  I'm essentially using Thread.join() to force the IDE to wait for the stdout/stderr threads to be setup until trying to start the avr-size process.  Under the right circumstances the MessageSiphon threads would not even be near complete by the time the avr-exit command has exited.

We really ought to switch to Java 5 and ProcessBuilder for this smiley
227  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: remove confusing Processing UI elements on: May 03, 2009, 11:57:16 am
I didn't know Google Code had a bug tracker.  I thought it was a repository only.

Well, there you go.  Why are we encouraged to post patches here, then?  Other than the fact that, in my humble opinion, Google Code is a terrible interface, it should be sufficient for the purposes of maintaining a proper fork.
228  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: remove confusing Processing UI elements on: May 02, 2009, 09:33:44 am
It is not exactly clear to me the relationship between the Arduino IDE (it really needs a name to distinguish it form the hardware) and Processing.  If this is a true fork of Processing, then I agree that some sort of ownership with respect to bug tracking and development milestones would probably help.

Like many open source projects, though, I gather there is a small core group of people who actively maintain the project, and even the most famous open-source projects have a hard time harnessing the crowd.  Typically, there tends toward an 80/20 split for involvement with projects like this.  And even small projects take a lot of management by dedicated individuals.

That being said, I remain guilty of not being able to commit to my own ad hoc patches.  Of course, I'm less inclined to participate without this framework in place.

It is not without irony that I point out that we are using the bug report/patch forum for discussion about the best way to co-ordinate bug reporting and patching.  Perhaps this conversation could be shifted over to one of the other forums in order to attract more input and attention.
229  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: remove confusing Processing UI elements on: May 01, 2009, 07:13:35 pm
There is a bit of a disconnect here with the UI controls.  What Processing does is not /exactly/ what Arduino does.
230  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Other Serial Devices than ttyUSBx and ttySx on: April 12, 2009, 02:15:30 pm
Unfortunately, all we get is what the RXTX libs return when we ask for an enumeration of all the com ports. I haven't tried what we get with the more modern javax.comm libs instead of the used in Arduino.

It wouldn't be too hard to tweak the IDE so that you could enter your own port if you knew what it was. Of course, the same result can be had simply by setting the com port in the config that Arduino reads on startup.

That being said, what is returned on a particular system or platform is going to highly specific to that system or platform. For example, without the FTDI device attached to my Mac, all I see are the Bluetooth TTY devices:

clvrmnky@thor:~ $ java -cp .:/Users/clvrmnky/Developer/arduino-0015/Arduino\ \
  -Djava.library.path=/Users/clvrmnky/Developer/arduino-0015/Arduino\ \
Experimental:  JNI_OnLoad called.
Stable Library
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Found comport: /dev/tty.Bluetooth-PDA-Sync
Found comport: /dev/cu.Bluetooth-PDA-Sync
Found comport: /dev/tty.Bluetooth-Modem
Found comport: /dev/cu.Bluetooth-Modem
clvrmnky@thor:~ $
231  Forum 2005-2010 (read only) / Bugs & Suggestions / RuntimeException in Preferences on startup on: April 02, 2009, 11:24:16 pm
This was reported in another part of this forum by a Windows user.  A slightly different version of this patch was provided to them for testing.

There is the possibility that a StringIndexOutOfBoundsException can be thrown from Preferences.setColor() on startup, halting the app.

The problem is that the method assumes that the String it creates (based on the hexadecimal representation of the RGB colours for UI controls it retrieves from AWT) will always be at least two characters long.  Clearly, for any RGB values less than 16 decimal this will not be the case.

While building up the "#rrggbb" String value from these RGB component Strings, this assumption means we can pass -1 to String.substring(), leading to the StringIndexOutOfBoundsException.

Ideally, we'd like to use something like java.util.Formatter to build up this string in a normalized manner, but this is only available in Java 5 or higher.  It might also be a little heavyweight for the purpose.

I propose the following change to address this (sorry for the white space changes -- Xcode seems to want to do this):

---    (revision 567)
+++    (working copy)
@@ -789,11 +789,21 @@
   static public void setColor(String attr, Color what) {
-    String r = Integer.toHexString(what.getRed());
-    String g = Integer.toHexString(what.getGreen());
-    String b = Integer.toHexString(what.getBlue());
-    set(attr, "#" + r.substring(r.length() - 2) +
-        g.substring(g.length() - 2) + b.substring(b.length() - 2));
+       String r = Integer.toHexString(what.getRed());
+       String g = Integer.toHexString(what.getGreen());
+       String b = Integer.toHexString(what.getBlue());
+       // Massage each RGB component so that it conforms to a reasonable
+       // "#rrggbb" format. Ideally we'd Like use something like
+       // java.util.Formatter from Java 5 for this.
+       if (r.length() < 2)
+               r = "0" + r;
+       if (g.length() < 2)
+               g = "0" + g;
+       if (r.length() < 2)
+               b = "0" + b;
+       set(attr, "#" + r + g + b);

We simply ensure that single character strings (I don't think these strings can't be zero-length under any circumstances where the VM would continue) are prepended with a '0'.  This ensures that any hex R, G or B value we compute will be of the form "00" to "ff" and nothing else.

My rationale for removing the belt-and-suspenders substring munging is that I think we can go ahead and trust that Color.getRed() and friends will return a number between 0 and 255.  There is little reason to not trust that the resulting String of hexadecimal digits we get from this int will not be at least one character long, and at most two.

Certainly the existing code doesn't really guard against the extremely unlikely event that these Strings can have a length > 2 anyway.  So, if we /really/ want to be belt-and-suspenders for some reason, we should change this to something like:

r = r.substring(0, 2);
g = g.substring(0, 2);
b = b.substring(0, 2);

(Or we bracket the decimal values we get from AWT to the range 0-255, and only then compute the hexadecimal values we use to build the format string.)

However, I see no compelling reason to do so.
232  Forum 2005-2010 (read only) / Troubleshooting / Re: Typical Output Voltage on Digital Pins? on: May 16, 2009, 11:05:03 am
Is the pin actually driving a load?  Is it this high when driving a LED through a resistor, for example?
233  Forum 2005-2010 (read only) / Troubleshooting / Re: "Uncaught exeption..." Arduino 15 MacOS 10.5.6 on: May 16, 2009, 12:44:33 pm
Probably the flag on the that you can set when you do a "Show info" on it.
234  Forum 2005-2010 (read only) / Troubleshooting / Re: Spot the Bug?  Not so random numbers. on: May 15, 2009, 09:53:23 am
There is random, and there is random.

Or, more correctly, there is more pseudo-random.

On most modern computers a series of random numbers is actually a long series of numbers that is different only for different seeds.  See the random() docs:

If it is important for a sequence of values generated by random() to differ, on subsequent executions of a sketch, use randomSeed() to initialize the random number generator with a fairly random input, such as analogRead() on an unconnected pin.

Conversely, it can occasionally be useful to use pseudo-random sequences that repeat exactly. This can be accomplished by calling randomSeed() with a fixed number, before starting the random sequence.

There is a whole science of increasing the apparent randomness for pseudo-random numbers generating by computers.  For cryptography it can be very important to generate strong random sequences.

In the code you show here all we see is the call to random().  This implies that the same series of numbers could be fetched over and over again.
235  Forum 2005-2010 (read only) / Troubleshooting / Re: Duemilanove – on: May 11, 2009, 02:22:13 pm
The message contains part of the answer to your question: " /Applications/arduino-0015/examples/Digital/Blink/applet/Blink.cpp"

Does this file exist?  Is this maybe a permissions issue?
236  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino GUI Works but not Command Line on: May 02, 2009, 10:06:36 am
Do you see any TX/RX activity on the device when you try to upload via avrdude?  Is something else using ttyusb0?  Looks to me that avrdude can't get a serial connection, or the stk500 protocol it is expecting is not correct.
237  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino GUI Works but not Command Line on: April 29, 2009, 05:09:43 pm
Take a look in the Makefile shipped with Arduino package.  It has all the options it passes to avrdude.  The one I started with is hardware/cores/arduino/Makefile.

I posted elsewhere on this forum how I build sketches from the command line (i.e., have the Makefile create a proper C++ file from the stub of the sketch.)

This is a bit of hack, though.  Once you start adding libraries you have to tweak the Makefile so it can find headers and such.  And a Makefile won't automagically make any third-party libs you drop into the Arduino dev tools tree like the IDE does.

But if you are familiar with Make, then you should be able to figure this out.
238  Forum 2005-2010 (read only) / Troubleshooting / Re: Can't upload to I/O on: April 29, 2009, 05:11:51 pm
Identify what you have based on this:

Is there an Arduino not based on an ATmega?
239  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial Port In Use in OSX 10.5.6 on: April 29, 2009, 05:05:10 pm
That is almost certainly not the right serial port.  That looks like a Samsung mobile modem connection or something.

It should be something like /dev/tty.usbserial-XXXXXXXX

I'd recommend against using the "cu" device anyway.
240  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Mac IDE Annoyance on: June 05, 2009, 04:16:05 pm
BTW, even Safari failing to shutdown cleanly will cause OS X to abandon a restart or shutdown.  I bet the arduino is throwing up a modal dialog (or the whole IDE is behaving like one.)
Pages: 1 ... 14 15 [16] 17