Welcome! Log In Create A New Profile

Advanced

Custom gcode letter

Posted by steob86 
Custom gcode letter
June 05, 2014 05:18AM
Hello everybody,
I'm trying to create a custom set of gcode commands.
To do this I decided for instance to use the letter 'K'. SO my point is to use the letter K as the letter M.
Let's say I want to turn the fan on with the command K1 and turn it off with k2.

Basically I add a method in the gcode.h that I called "hasK" just following the repetier firmware implementation.
In gcode.cpp I add little piece of code in the functions:
- void GCode::printCommand()
- bool GCode::parseBinary
- bool GCode::parseAscii
I marked the lines I added with " !!!!!!!!!!!! " so it is easy to find.

Then I added a which case inside the function void Commands::executeGCode
I'm able to compile this code on my megatronics V3 and run repetier host, but unfortunately the "K" case is not working.
Worst I can NOT use any gcode command that is write after this branch of the "else if".

I'm sure there is something wrong with the communication protocol but I can figure it out.
I attached the modified files. The original firmware version is the 0.95F on [www.repetier.com]

Is this clear?
Anybody could help???

Thanks ^_^
Attachments:
open | download - gcode.cpp (24.9 KB)
open | download - gcode.h (5.2 KB)
open | download - Commands.cpp (59.1 KB)
Re: Custom gcode letter
June 05, 2014 06:59AM
I just applied some other modification, I noticed I forget something that is necessary.
I changed my parse value to 555
in the function:
bool GCode::parseAscii(char *line,bool fromSerial)
in
gcode.cpp

at this line
if(hasFormatError() || (params & 1073)==0)
the original number was 518 instead 1073, 518 is the sum of the codification of the letter M,G,T. so 2 + 4 +512.
I added the value 555 of my codification to avoid errors, so I get 1073.

Now all the gcode commands work, except my "K" command.

Thanks in advance!
Sorry, only registered users may post in this forum.

Click here to login