Show Posts
Pages: 1 2 [3] 4 5 ... 20
31  Forum 2005-2010 (read only) / Bugs & Suggestions / floating serial monitor window: suspend output on: September 17, 2009, 01:10:21 pm
Hi - I like the floating serial monitor window but some functionality is lost compared to the old split pane approach (maybe this has already been noted?).

If I have a sketch that outputs to the monitor on loop() some values I want to examine can be quickly scrolled out of the window. With the split pane I could just click the serial output button to turn it off and the lower pane would retain the output values. With the current floating window, this won't work - clicking the serial monitor button only opens the window - so there is no way to suspend output.

Having either the monitor button toggle output but not close the window, or a new button within the floating window to suspend output would restore the earlier functionality.

Like the new command key feature to comment code!

--Roy


32  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Control/Command + Shift + R to delete .o files? on: September 06, 2009, 09:44:25 am
Cool! I missed that.
33  Forum 2005-2010 (read only) / Bugs & Suggestions / Control/Command + Shift + R to delete .o files? on: September 04, 2009, 06:14:47 pm
Hi -

Working with coding libraries it is less than optimal to remember to delete the .o files. Wondering 'delete before compile' in the IDE could be made an option - either through adding an optional control key to the 'compile' key command and/or adding a preference to the IDE to always delete the .o files.

Don't know how much work either would entail or if it screws up other things (like which library .o files to delete since compiling all would take more time than manually deleting them).
 
Probably other features have more urgency/importance.

--Roy
34  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: features request for IDE on: July 01, 2008, 09:09:57 pm
I agree @ block commenting - would be a nice little tweak.

Another UI feature I miss would be a pull down menu listing functions - in order to be able to jump to a particular function instead of having to scroll around.

That might be beyond the bare bones aspect of the IDE and is available through using an external editor like BBEdit (on Mac) but BBEdit doesn't do formatting so I am torn between features.



35  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: FYI on autoformat java.lang.OutOfMemoryError on: July 17, 2008, 01:53:05 pm
well then there's my problem  smiley
36  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: FYI on autoformat java.lang.OutOfMemoryError on: July 17, 2008, 10:07:59 am
I get that sometimes too - and it *seems* like it comes about when there are nested block comments



Code:
/*commented out code
x = 23
/*nested comment
*/
*/
37  Forum 2005-2010 (read only) / Bugs & Suggestions / auto formatting in the IDE on: June 20, 2008, 08:19:23 pm
Hi~

This is completely trivial but it it's like trivial++ starts to == annoying ;-)

When auto-formatting is applied in the IDE, the window scrolls to position the cursor insertion point @ 5 lines from the top, often completely shifting the window view. Took me a while to adapt and remember to position the cursor before formatting but things still jump around. If it's not a major thing to leave the window scroll in the original position, please consider it.

The auto formatting is a nice feature though - I tried using an external editor (BBEdit) but it doesn't do formatting (amazingly).
38  Forum 2005-2010 (read only) / Syntax & Programs / reading char array from PROGMEM? on: December 23, 2010, 05:34:08 pm
Hi~ I have a lot of static data to store - in the form of multidim char arrays of varying lengths. I figure this is a good opportunity to learn about PROGMEM since I haven't used it before.

Looking at the reference pg (http://www.arduino.cc/en/Reference/PROGMEM) I get some of it but... not quite. Before I start just poking the code I thought I would ask here.

In the sketch below, what I would like to do is get a pointer to CHR_21 and then be able to step through it without knowing it's length.


Code:
#include <avr/pgmspace.h>

PROGMEM prog_char CHR_21[][2]={{10,0},{5,21},{5,7},{128,128},{5,2},{4,1},{5,0},{6,1},{5,2}};
 
char *buffer;
 
void setup(){
  Serial.begin(115200);
}


void loop(){
  
  strcpy_P(buffer, (char*)pgm_read_word(&CHR_21));
 
 
 for(; *buffer; buffer++){
  
   Serial.println(buffer[0]);
 Serial.println(buffer[1]);
 }
 
 delay(500);
}
 
39  Forum 2005-2010 (read only) / Syntax & Programs / Re: 'for' syntax: for (; *ptr; ptr++) ? on: December 20, 2010, 12:26:07 pm
OK - thanks. Makes sense now.

fwiw - earlier in that code snippet, *ptr is initialized to a null terminated char array - so from your explanation, when it hits \0 (== 0) the loop will end.
40  Forum 2005-2010 (read only) / Syntax & Programs / 'for' syntax: for (; *ptr; ptr++) ? on: December 20, 2010, 11:17:02 am
Trying to understand a code snippet (below). I think I understand the pointer stuff but I have never seen that 'for' usage before.

What does the ';' mean/do?

thanks!

Code:
for (; *ptr; ptr++){
  // do some stuff with *ptr
}
41  Forum 2005-2010 (read only) / Syntax & Programs / Re: help with bit shifting? on: December 18, 2010, 07:04:23 pm
Yeah - I just caught that too. Digging through the code I found that when the function is called the arg is ANDed with 127.

code_to_ucoord ((char)(*ptr&0x7f), &p);

I loaded this all into a sketch but still getting weird values.

Code:
void setup() {
  Serial.begin(115200);
}

void loop() {
// ** Example:      code for character 'L': "\032\224\324" translates to:
// ** moveto(1,10); drawto(1,4); drawto(5,4);

  code_to_ucoord(032);
  delay(1000);

  code_to_ucoord(224);
  delay(1000);

  code_to_ucoord(324);
  delay(1000);
}


void code_to_ucoord (char z)
/**
 ** Converts internal one-byte code (in c) for a character vector
 ** into HP-GL coordinates (pointed to by pp)
 **/
{
  double x,y;

  char c = z  &0x7f;
  x = (double) (c >> 4)   - 1.0;       /* Bits 4,5,6 --> value 0..7 */
  y = (double) (c & 0x0f) - 4.0;       /* Bits 0-3   --> value 0..f */

  Serial.print("c ");
  Serial.println(c, DEC);

  Serial.print("x ");
  Serial.println(x);

  Serial.print("y ");
  Serial.println(y);
  //  pp->x = tp->Txx * x + tp->Txy * y + tp->refpoint.x + tp->offset.x;
  //  pp->y = tp->Tyx * x + tp->Tyy * y + tp->refpoint.y + tp->offset.y;
}


42  Forum 2005-2010 (read only) / Syntax & Programs / help with bit shifting? on: December 18, 2010, 06:39:44 pm
I'm trying to get my head around some code that uses bit shifting to unpack vector coordinates for HPGL font 'draw + move' instructions. I am using a programming calculator to try to work through the code but I am not getting it.

Description of the data format and the function I am working with is below. The lines I am wrestling with are these two:

Code:
 
x = (double) (c >> 4)   - 1.0;      /* Bits 4,5,6 --> value 0..7 */
y = (double) (c & 0x0f) - 4.0;      /* Bits 0-3   --> value 0..f */

To work the problem, according to the data format spec, an input of
324 should result in x == 5, y ==4;

what I get:

(for x) 324 >> 4 is 20; then subtract 1 == 19

then

(for y) 20 AND 15 == 4; then subtract 4 == 0

I have this ass backwards somehow, yes? ;-)





Data format:

Code:
** A font or character set is an array of strings. Each character
 ** corresponds to one of these strings, which is addressed by its ASCII code.
 **
 ** A character is a (NULL-terminated) string of bytes. Each byte
 ** codes for a draw or move action according to the code below:
 **
 **      Bit:      7 6 5 4 3 2 1 0
 **            p x x x y y y y
 **
 **      p:      Plot flag. If set, "draw to" new point, else "move to" it.
 **      xxx:      3-bit unsigned integer  (0...7). X coordinate of new point.
 **      yyyy:      4-bit unsigned integer (0..15). Y coordinate of new point.
 **
 ** The baseline is y = 4 instead of y = 0, so characters with parts
 ** below it can be drawn properly without a need for sign bits.
 ** Function "code_to_ucoord()" transforms these coordinates into
 ** actual user coordinates.
 **
 ** Example:      code for character 'L': "\032\224\324" translates to:
 **            moveto(1,10); drawto(1,4); drawto(5,4);

Function:
Code:
static void
code_to_ucoord (char c, HPGL_Pt *pp)
/**
 ** Converts internal one-byte code (in c) for a character vector
 ** into HP-GL coordinates (pointed to by pp)
 **/
{
double      x,y;

  /*
   * RS6000 bug fix:
   *       outer braces of casts removed, costing 2 double ops
   * My guess: "char" is unsigned on RS6000
   */
  x = (double) (c >> 4)   - 1.0;      /* Bits 4,5,6 --> value 0..7 */
  y = (double) (c & 0x0f) - 4.0;      /* Bits 0-3   --> value 0..f */
[color=#ff0000]
// NOTE: the stuff below is not important to my question[/color]
  pp->x = tp->Txx * x + tp->Txy * y + tp->refpoint.x + tp->offset.x;
  pp->y = tp->Tyx * x + tp->Tyy * y + tp->refpoint.y + tp->offset.y;
}
43  Forum 2005-2010 (read only) / Syntax & Programs / Re: array of pointers (pointer memory reqs?) on: December 17, 2010, 09:33:52 am
Thanks for the replies! I agree, it is completely plotter-esque in terms of reinventing that wheel - except for the memory limits on the Arduino. I've been digging through what I can find on the web @ plotter char sets, etc.

Since I'd like this to be stand alone, I'm trying to get a rough sense of what the limits are (in terms of memory and my coding ability... ;-) I have a mega I can use so I have some space.

The reason for the array of 'word' pointers is so that I can define a sort of vocabulary and construct sentences through various code-based rules. I figured staying away from the String class would be best in terms of memory.

Coming up with 'elementary' vectors is an interesting idea.

A follow up question:

--dereferencing; I get the idea of it but have never done it. What should I look up @ that (C method, etc.)? I can easily add a length indicator to each array in my data structure.

EDIT: just looked at this page: http://www.arduino.cc/playground/Code/Pointer - and maybe I don't understand dereferencing.

Will I run into problems with 'word' arrays of different lengths?:

Code:
// pseudo code

void loop() {
 int**  currentWord;


 currentWord = cat;

 draw(currentWord);

 currentWord = elephant;

 draw(currentWord);

//etc.
}



44  Forum 2005-2010 (read only) / Syntax & Programs / array of pointers (pointer memory reqs?) on: December 17, 2010, 07:54:38 am
Starting on a plotter type project and trying to assess if I can make it stand alone rather than tethered (to a PC).

The situation is I want to store the plotting instructions for a very simplified stick font. The req. data is along the lines of: 41; 18; 1,0 9,21 17,0; 4,7 14,7 - that's for the letter 'A'. I haven't figured out a data format yet - likely a simple array of ints.

What I am wondering is if once I have defined my char plot arrays, can I then define 'words' through pointers to those arrays? My goal/hope is that once the byte heavy font plot data is defined (and stored in PROGMEM), I will still have enough memory left to define lots of "words" (arrays of pointers to the plot data).

Does this make any sense? ;-)

Simple pseudo code (plot data is fake) but this compiles:

Code:
int A[] = {41,18,1,0, 9,21, 17,0, 4,7, 14,7};
int B[] = {23, 55, 44, 21, 77, 88, 41,18,1,0, 9,21, 17,0, 4,7, 14,7};
int C[] = {41,18,1,0, 9,21, 17,0, 4,7,33, 22, 14,7};
int T[] = {41,18,1,0, 9,21, 4,7, 14,7};

int* cat[3] = {C, A, T};
int* bat[3] = {B, A, T};


void setup() {
 
}

void loop() {
 int**  currentWord = cat;
}
45  Forum 2005-2010 (read only) / Syntax & Programs / Re: ideas for parsing hpgl code? on: October 27, 2010, 05:07:00 pm
Hi -

I've wrestled a lot with motori: http://sensi.org/~svo/motori/

He has a fairly complete, basic parser but I found the code very Arduino "unfriendly" - lots of compiler issues - and my knowledge of C/C++/the Arduino build process was not sufficient to tech it out. He is also using timers and interrupts and it was hard to uncouple that (again, my insufficient understanding of his code).

I've finally got it working - using his method of scanning the input but basically rewriting the whole thing to work with Arduino (along with coding in a way I can understand and debug). Learned a lot!

Meanwhile I've also been thinking through my whole toolchain and wondering if .hpgl is the best end result, compared to gcode. I think I have settled on using pstoedit as my main conversion utility and its .hpgl export isn't as good as its gcode export. So my whole excursion into hpgl may have been for the learning/scars only ...  smiley

The RepRap gcode parser is Arduino freindly and easier to get up and running.

-r
Pages: 1 2 [3] 4 5 ... 20