folpindo / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Provide friendly error messages for board-specific limitations #917

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are several board-specific functions and libraries, and it would be good 
to provide error messages that address them.  For example:

If you use an I/O pin number higher than 19 (say, 34), the IDE should tell you: 
 "The board you've selected (Arduino Uno) doesn't have a digital pin 34.  The 
Arduino Mega does.  Please make sure you've chosen the right board in the Tools 
-> board menu"

If you're using a Leonardo, a similar message might pop up if you're using USB 
functions:  "The board you've selected (Arduino Uno) doesn't support the USB 
libraries. The Arduino Leonardo does. Please make sure you've chosen the right 
board in the Tools -> board menu"

The generic formula I'm imagining is this:

"The board you've selected (CURRENT_BOARD) doesn't support 
FUNCTION_IN_QUESTION. The BOARD_THAT_SUPPORTS_IT does. Please make sure you've 
chosen the right board in the Tools -> board menu"

This includes things like:
* Libraries that are board-specific
* I/O ranges outside the selected board's range
* misc other limitations

Perhaps the board file for each board could contain its I/O ranges, supported 
libraries, and so forth?

Original issue reported on code.google.com by tom.i...@gmail.com on 19 May 2012 at 3:15

GoogleCodeExporter commented 9 years ago
Paul Stoffregen reports that much of this is already in compiler.java, solved 
around line 461. Just needs implementation

Original comment by tom.i...@gmail.com on 19 May 2012 at 11:14

GoogleCodeExporter commented 9 years ago
I'd separate these errors / messages into two main groupings.  On the hand, 
there are things that already cause compile-time (compiler) errors that we can 
trap and rephrase.  That includes things like using a library that's not 
supported for your board.  In fact, we already provide custom error messages if 
you try to use the Keyboard or Mouse libraries on a non-Leonardo board.  Are 
there other libraries that need these custom messages?  Or changes you'd like 
to make to that one?

I'd also include the generic "avrdude: stk500_recv(): programmer is not 
responding" message in this category.  I agree with out that it would be great 
to improve the message we give in this case, so I opened issue 923 for it.

On the other hand, there are things that don't cause an error at compile-time 
but don't behave as expected when you run the program on the board.  These are 
much harder to identify.  For example, I would include using out-of-range pin 
values in this category.  Detecting that would require parsing the code, which 
is messy and complicated to do and hard to implement.  

Can we maybe split this issue into more specific to do items?  (Or limit it to 
something more specific?)  I agree that it's a good overall goal, but more 
specific tasks would make it easier to get them implemented and checked off.

Original comment by dmel...@gmail.com on 27 May 2012 at 4:05

GoogleCodeExporter commented 9 years ago
Seems a good idea to split it into separate issues, I agree.

Original comment by tom.i...@gmail.com on 27 May 2012 at 4:13

GoogleCodeExporter commented 9 years ago
Okay, I opened issue 924 for range checking of pin numbers, etc.  If there are 
other specific things to do at the moment, please open issues for them.  

Original comment by dmel...@gmail.com on 27 May 2012 at 4:49