Topics

user-gcode.h help

Scott Goldthwaite
 

I want to modify the 

FILE_END[ALL] = "(End of every file)\n";  

gcode so my spindle moves to a specific spot.  I know I could do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z1\n";

But for the z position, I want to use whatever is entered in the "Z high" field from the setup screen.  The name of this variable is DEFAULT_Z_HIGH.   Is there a way I can do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z" + DEFAULT_Z_HIGH + "\n";


  




Art Eckstein
 

Looks like it should work, give it a try and see what happens.
I know I tried a bunch of different things in my iterations of making a custom post.

Art
Country Bubba


At 08:50 AM 6/5/2015, you wrote:


I want to modify the

FILE_END[ALL] = "(End of every file)\n"; 

gcode so my spindle moves to a specific spot.  I know I could do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z1\n";

But for the z position, I want to use whatever is entered in the "Z high" field from the setup screen.  The name of this variable is DEFAULT_Z_HIGH.   Is there a way I can do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z" + DEFAULT_Z_HIGH + "\n";

 







Posted by: scott@...

Scott Goldthwaite
 

I tried it and got an error when I ran the ULP.  I'm not sure what other variations to try.

Art Eckstein
 

Still looks good to me, what is the error message??

Country


At 11:42 AM 6/5/2015, you wrote:


I tried it and got an error when I ran the ULP.  I'm not sure what other variations to try.



Posted by: scott@...

John J <john6060842@...>
 

This may fail due to dependencies, but give this a try:
FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 " + fr(MOVE_Z, DEFAULT_Z_HIGH) + "\n";
The functon fr stands for format real. There are other functions in source/string.h that you might find helpful, such as fi to format an integer, etc.

If that fails, try:
FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z" + real_to_string(DEFAULT_Z_HIGH) + "\n";

The first method is preferable, as the second uses a global variable and could affect other things (not one of my proudest moments, but working around something in EAGLE, I'm sure).

Regards,
JJ


On Fri, Jun 5, 2015 at 8:50 AM, scott@... [pcb-gcode] <pcb-gcode@...> wrote:
 

I want to modify the 

FILE_END[ALL] = "(End of every file)\n";  

gcode so my spindle moves to a specific spot.  I know I could do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z1\n";

But for the z position, I want to use whatever is entered in the "Z high" field from the setup screen.  The name of this variable is DEFAULT_Z_HIGH.   Is there a way I can do something like this:

FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 Z" + DEFAULT_Z_HIGH + "\n";


  






--
Sent from a MacBook Pro

Scott Goldthwaite
 

This one worked:
FILE_END[ALL] = "(End of every file)\nG0 X1 Y1 " + fr(MOVE_Z, DEFAULT_Z_HIGH) + "\n"; 

Thanks!!  I didn't try the other.