Welcome! Log In Create A New Profile

Advanced

Couple of ramps1.4 questions?

Posted by tm america 
Re: Couple of ramps1.4 questions?
November 02, 2014 03:17PM
Odd. () comments shouldn't exist at all with that patch in place. Can you post that section of your marlin_main.cpp?

On the F code issue, can you post a sample of the Gcode you want to run, and what its supposed to do?
Re: Couple of ramps1.4 questions?
November 02, 2014 03:30PM
Here is my code from line 583 to 696 same goes here i have tried them // commented out and not.same outcome here..


while( MYSERIAL.available() > 0 && buflen < BUFSIZE) {
serial_char = MYSERIAL.read();
if(serial_char == '\n' ||
serial_char == '\r' ||
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1) )
{
if(!serial_count) { //if empty line
comment_mode = false; //for new command
return;
}
cmdbuffer[bufindw][serial_count] = 0; //terminate string
if(!comment_mode){
comment_mode = false; //for new command
fromsd[bufindw] = false;
if(strchr(cmdbuffer[bufindw], 'N') != NULL)
{
strchr_pointer = strchr(cmdbuffer[bufindw], 'N');
gcode_N = (strtol(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL, 10));
if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer[bufindw], PSTR("M110")) == NULL) ) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_LINE_NO);
SERIAL_ERRORLN(gcode_LastN);
//Serial.println(gcode_N);
FlushSerialRequestResend();
serial_count = 0;
return;
}

if(strchr(cmdbuffer[bufindw], '*') != NULL)
{
byte checksum = 0;
byte count = 0;
while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++];
strchr_pointer = strchr(cmdbuffer[bufindw], '*');

if( (int)(strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)) != checksum) {
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH);
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
//if no errors, continue parsing
}
else
{
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_CHECKSUM);
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}

gcode_LastN = gcode_N;
//if no errors, continue parsing
}
else // if we don't receive 'N' but still see '*'
{
if((strchr(cmdbuffer[bufindw], '*') != NULL))
{
SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM);
SERIAL_ERRORLN(gcode_LastN);
serial_count = 0;
return;
}
}
if((strchr(cmdbuffer[bufindw], 'G') != NULL)){
strchr_pointer = strchr(cmdbuffer[bufindw], 'G');
switch((int)((strtod(&cmdbuffer[bufindw][strchr_pointer - cmdbuffer[bufindw] + 1], NULL)))){
case 0:
case 1:
case 2:
case 3:
if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored.
#ifdef SDSUPPORT
if(card.saving)
break;
#endif //SDSUPPORT
SERIAL_PROTOCOLLNPGM(MSG_OK);
}
else {
SERIAL_ERRORLNPGM(MSG_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
}
break;
default:
break;
}

}

//If command was e-stop process now
if(strcmp(cmdbuffer[bufindw], "M112") == 0)
kill();

bufindw = (bufindw + 1)%BUFSIZE;
buflen += 1;
}
serial_count = 0; //clear buffer
}
else
{
if(serial_char == ';') comment_mode = true;
//if(serial_char == '()') comment_mode = true;
//if(serial_char == '(') comment_mode = true;
//if(serial_char == ')') comment_mode = false;
//if(serial_char == ':') comment_mode = true;
//if(serial_char == '#') comment_mode = true;
//if(serial_char == '/') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char;
Re: Couple of ramps1.4 questions?
November 02, 2014 03:38PM
This g code is for cutting a washer . m3 and m5 are for torch on-off.This code runs fine with my machines that run mach3 with a tb6560 controller..I realiz there are a couple places where the post processor dropped the z axis command down to the next line ..It worked fine even like that on the other machines i edited those areas and still would not read due to the comments giving errors like no line number with checksum line 137 and line number not last line number line 137 .resending line 138.it also kicks me out of repetier when it does it or it will just disconnect it
Attachments:
open | download - 1.2 x .75 washer gc (2.9 KB)
Re: Couple of ramps1.4 questions?
November 02, 2014 04:22PM
Any chance you can rewrite your post processor to not drop Z onto the next line. Fixing that would be a bit of a pain.

Taking F codes as their own command is doable, just add an 'if code_seen('F') clause amongst the G and M clauses that contain the switch statements. Something like:

if(code_seen('F')){
get_coordinates();
prepare_move();
}

The alternative is to rewrite your post processor to put lone feedrate statements into a G1 command.

As for the comments, the end of that section should look exactly like this:

if(serial_char == ';') comment_mode = true;
if(serial_char == '(') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char; 
if(serial_char == ')') comment_mode = false;

This idea is to go into comment_mode if we see a ; or a (, and drop back out of it if we see a ). While in comment mode, we skip characters, otherwise we put them into the cmdbuffer. So long as you never put a ) inside a ; comment, this should work perfectly, but your gcode doesn't seem to have ; comments so thats not an issue.
Re: Couple of ramps1.4 questions?
November 02, 2014 04:52PM
Quote
Andrew Smith
Any chance you can rewrite your post processor to not drop Z onto the next line. Fixing that would be a bit of a pain.

I did fix the post processor so it puts all the z axis moves in the same line at the other axis. just this was one of the shortest g codes i have for an axample...
Taking F codes as their own command is doable, just add an 'if code_seen('F') clause amongst the G and M clauses that contain the switch statements. Something like:

if(code_seen('F')){
get_coordinates();
prepare_move();
}

The alternative is to rewrite your post processor to put lone feedrate statements into a G1 command.

As for the comments, the end of that section should look exactly like this:
For this about what line would i ad this?And how does it know to use the value following the F?




if(serial_char == ';') comment_mode = true;
if(serial_char == '(') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw][serial_count++] = serial_char; 
if(serial_char == ')') comment_mode = false;

This idea is to go into comment_mode if we see a ; or a (, and drop back out of it if we see a ). While in comment mode, we skip characters, otherwise we put them into the cmdbuffer. So long as you never put a ) inside a ; comment, this should work perfectly, but your gcode doesn't seem to have ; comments so thats not an issue.
I just copy and pasted this in a it still does the same thing.I can even get it to mess up by typing the command (aste) into the command bar and sending..But if i put a ; in front of the same command it will not attempt to send it.. But it sends it and gets errors with the ( )
Re: Couple of ramps1.4 questions?
November 02, 2014 05:12PM
Around which line would i need to add the lines to make it accept the F code..And how does it know to use the value that follows the f?

Also is there a way to make it use a g20 and g21 to switch from metric to inch?My post processor writes them in..I'm not sure if that is causing an issue as well as the current version of marlin had no provisions for these codes
Re: Couple of ramps1.4 questions?
November 02, 2014 05:56PM
You can grab the marlin_main.cpp from this github:
[github.com]

Which supports G20 and G21. I don't think it will help anything unless you need to use imperial units. And you'd need to merge in the changes in your own marlin_main.cpp

On the F codes, the parser is already looking for them. I have no idea why its not working for you. Send me your marlin_main.cpp and Ill try and get it fixed tomorrow
Re: Couple of ramps1.4 questions?
November 02, 2014 06:34PM
ok i will message it to you ..Maybe you can include the part for the g20 and g21 while you are in there....since my luck seems to be limited to fixing only one or two things ..?
Re: Couple of ramps1.4 questions?
November 02, 2014 06:42PM
Marlin_main.cpp
Looks like i can't pm it on here so here it is
Re: Couple of ramps1.4 questions?
November 02, 2014 07:12PM
Here are the issues i am having that would probably be in the marlin main cpp.
1. g4 p--- makes the controller go to sleep according to the lcd.but it still runs commands
2. no g20 and g21.I would like to have the ability to run in inch mode as 99%of my over 1500 different g code files are in inches.
3. no F commands
4. Not going into comment_mode when seeing ( ) so it still sends the things located between the ( ) and gives error codes.....But works fine with the ;

Other things i am still working on..Still not able to get the cnc plugin working in repetier seems the person that wrote it needs an update so it will work-missing something.It doesn't give any error codes but it still doesn't open up.
Wondering if i could do some kind of wireless game controller right to the arduino-ramp1.4 to do manual jogging of the machine and maybe have the ability to start and stop the torch as well as an e stop on the game controller..?But this doesn't have to happen i really could use the arrow keys and page up-page down to work for jogging on the keyboard.Then i could just use my mini wireless keyboard..
The next thing i need to make is a board to go between the ramps1.4 and the pololu driver so i could be able to tie into the step and dir pins coming from the ramps as well as going back to the pololu driver..This would give me a nice solid way to tap into the step and dir wires while still having the step driver mounted to the ramps
.
Re: Couple of ramps1.4 questions?
November 03, 2014 10:11PM
I got to mess around with it today and got a few things fixed-figured out..i ran a couple files i did with the ;semicolon in front of the comments.and they ran but it would not reconize the f codes unless i jogged the machine manually before runing the program.. if i did this it would accept the feedrate changes from the g code..So my revised list of things i need to fix is #1 make it where it will ignore comments inside of ( )..#2 add the g20 and g21 commands to switch from inches to mm...#3 figure out why it has to be jogged first in order for it to see the f code for feedrate? #4 the g4 command still is making the lcd screen show sleep at the bottom?
But on the positive side i did get to see it moving on its own today one of the files i was running it at 211mm per second and it was super smooth and quite..Without loosing steps..very impressed ..Especially since this is a larger machine 4ft x 4ft.
Re: Couple of ramps1.4 questions?
November 04, 2014 01:30AM
I did some more playing with it and found if i run from repetier without first manually jogging or if i run from the sd card it will not do any of the f codes for feedrate ..?if i don't jog first in repetier it will run really slow same goes for running from the sd card..Running from the sd card does not change by manually jogging ..
Re: Couple of ramps1.4 questions?
November 04, 2014 12:38PM
I tried to add the g20 and g21 from the marlin_main.cpp on the github but when i copy and pasted the case 20 and 21 it gives me an error when i compile..It says 'Global_unit_modifier not declared in this scope.the error is like this Marlin_main.cpp: in function 'void process_commands();':
Marlin_main.cpp:1228:error: 'global_unit_modifier' was not declared in this scope...seems it needs a few more commands to make this work?
Re: Couple of ramps1.4 questions?
November 04, 2014 01:47PM
g20 needs to change a variable that doesn't exist in stock marlin, so you'll need to copy a few more lines over. It might be as simple as all the lines that reference global_unit_modifier. Somewhere in github you can display all the lines that changed on that commit.

I'll try and get a working version of all this up tonight, but real life has become a bit hectic so no promises.
Re: Couple of ramps1.4 questions?
November 04, 2014 05:22PM
Ya i have been looking thru the different things all day really looking to get the comments ( ) and the feedrate thing fixed i figured i would see something that might be an easy fix but the best i can come up with is that the ( ) must be getting used for something else which is causing a conflict.??Then the g20 and g21 would be a great feature to have .. You would think there would be a pre compiled version of marlin that has at least at the standard g and m codes and feedrate working?..i have been reading up about using 13.8 volt psu and think i might try one out the extra power would be nice for the extruders and heated bed..The steppers would probably be alot happier to I bet the pololu drivers would run cooler as well...
Re: Couple of ramps1.4 questions?
November 04, 2014 08:32PM
I found the problem with () comments. The firmware is stripping them if it sees them, but the host isn't sending the line as written, because it isn't a dumb terminal like I'd assumed. If I'm reading this right, its parsing each line and building an idealized gcode line from it, fixing capitalization, removing redundant spacing and so on. That line then gets sent to the printer, insulating the firmware from any simple in the gcode. Trouble is, it doesn't know to remove everything between the () because that isn't part of the reprap gcode standard. Send gcode from a plain terminal, like the serial monitor in the arduino IDE, and it'll work perfectly.

I had a go at patching marlin_main.cpp, but I can't really test it since my printer is in bits right now, so I make no promises beyond that it compiles, it strips () comments, it has an M3 and M5 that should activate and kill the torch, and M3 should then wait for a signal on the Z MIN endstop, and it has a G20 and G21 that might correctly switch between millimeters and inches but its possible that someone has added another point in the code that needs to be multiplied by global_unit_multiplier, so keep a close eye on your machine when operating in imperial mode.

[www.dropbox.com]
Re: Couple of ramps1.4 questions?
November 04, 2014 09:34PM
Ok so basically the problem with the ( ) comments is not in the marlin firmware but instead in repetier with how it tries to fix the codes before sending them which then is changing things so the marlin doesn't know how to block it?I had the m3 and m5 working properly.. I will test it out tonight..So other than those i am having a issue with the f codes not being seen when running from the sd card or running from repetier without first doing a manual jog?Pretty much from here if i have the feedrate and g20-g21 working i can get by and work on the others if i got some free time..
Re: Couple of ramps1.4 questions?
November 04, 2014 11:21PM
Ok so i must be doing something really stupid i deleted my my marli_main.cpp and the copy and pasted the one you did to the file for that and when i open it in arduino it doesnt show it being there and gives me a list of errors a mile long ?What am i missing?
Re: Couple of ramps1.4 questions?
November 05, 2014 12:40AM
I finally just ended up copy and paste then delete the old stuff that was in marlin_main.cpp but then when i compiled it gives me all kind of errors saying there are undefined references to configurationstore.cpp:282: add homeing ,configurationstore.0: in function 'config-resetdefault()';
Re: Couple of ramps1.4 questions?
November 05, 2014 05:11AM
Make sure the rest of your copy of marlin is the latest version.
Re: Couple of ramps1.4 questions?
November 05, 2014 12:28PM
What is the release date or version of the latest marlin firmware?There are soo many out there just wanna make sure i get the right one.
Re: Couple of ramps1.4 questions?
November 05, 2014 12:46PM
Current one is two days old. The latest official Marlin is always here:

[github.com]
Re: Couple of ramps1.4 questions?
November 05, 2014 05:24PM
ok i got the new version of marlin installed with the marlin-main.cpp with the g20 and g21 i then added the m3 and m5 to it as well as the part for it to ignore the comments in ( ) Seems anytime it tries to run the g20-g21 or f codes in the g code file it will not do them but if you type them in manually in repetier it will do them and the comments inside ( ) still doesn't work in repetier .. i tried pronterface and had the same issues..I have yet to try them from the sd to see if it see's the g20-g21 and the f codes..That will be my next step.but it does see the m3 and m5 when running the g code file?seems to not make much sense why it works with some changes but not others?I am pretty sure it is as you said the problem is in the way repetier is trying to fix the commands before sending them..Guess i will have to start looking into that next.this really sucks as i like the layout of repetier i hate to have to use a generic g code sender ..Not being able to maunually jog the machine easily makes repetier nice
Re: Couple of ramps1.4 questions?
November 12, 2014 12:02AM
Ok i have been making good progress on this the last few days.. Just a couple issues i am still fighting with..One of them is when i do a g20 the feedrate is still in mm per minute not inches per minute.I have pretty much given up on getting it to ignore things inside of ( ) marks as comments.But i noticed it didn't do arcs properly on some of my files which is not a huge deal i can just output in polylines and not have this issue but it would be nice to figure this out as well.Other than these couple hiccups things seem to be working good..
Sorry, only registered users may post in this forum.

Click here to login