Welcome! Log In Create A New Profile


Couple of ramps1.4 questions?

Posted by tm america 
Couple of ramps1.4 questions?
October 29, 2014 02:27AM
Ok so i am getting into my projects pretty deep now i am making cnc plasma cutters-mills-3d printers running ramps 1.4 and i have several things i would like to change in the marlin firmware.First thing is i wanna swap the y and z stepper driver pins in pins h so i can use the driver set up for two motors for my y axis instead of my z.. That part i believe i have figured out.Second i wanna change the m106 command to m3 to turn on the fan and the m107 to m5 to turn off the fan?where would i find the settings in marlin to do this?
The other thing i wanna do is run the z axis as a phantom axis and just use the z axis limit-home switch to pause it while waiting for my torch height controller to home the z axis ,go to peirce height,trigger torch on,then once it has arc ok it will send the signal to the z axis home switch and resume the program..Just wondering if i would be able to trigger the torch on to start my thc then use a g28.1 z 0 command to home the z axis which wouldnt be moving an axis but instead just waiting for the arc ok to trigger the z axis home switch?or if there would be a way to use one of the pins for a arc ok signal so i could pause the x and y axis while the thc is doing it,s thing?The thc i am using is a stand alone unit with it's own stepper driver so the only thing it needs is a torch on from the controller and an arc ok back to the controller to resumes the x and y axis
There is also one other thing i would like to be able to do in the firmware..which is to make it where it doesn't have to have a semicolon ; in front to comments to ignore them.Most of the post processors i have just put the comments in ( ) ..It would be nice to be able to run g codes i made for my other machine be able to work with marlin-ramps1.4 without having to edit the g code any help with these issues would be a big help..
Re: Couple of ramps1.4 questions?
October 29, 2014 09:38AM
The pins.h change you need is in the section starting at line 595.

Next question. There's no setting for this. Head to Marlin_main.cpp line 1331 and downwards, you need to add a case 3 and 5 to the case statement for M codes, and insert some of the code from the 106 and 107 cases. Looks simple enough.

Your Z axis scheme might work if you configure your phantom Z to be long and slow enough - how long does it take to get the arc OK? Also, you'd have to disable homing retract or you'd need a double pulse to complete the homing procedure.I think that can be done in configuration_adv at line 218. However, I'd prefer to add a proper pause until signal function. I can't find one in Marlin but the code from the bottom of the M600 case looks like it can be adapted.

For the comments, the standard says those can appear between words, so I think the easiest way is to rewrite code_seen() to detect and skip past those comments. Or configure your post_processor to strip comments.
Re: Couple of ramps1.4 questions?
October 29, 2014 11:59AM
Thanks a lot for your response that is a great place to start.Never thought of just writing a code to wait for the signal from the arc ok...Where would the the m600 command be changed ?I'm guessing the same place as the the m3 and m5?
Re: Couple of ramps1.4 questions?
October 29, 2014 12:06PM
Also how would i get it to show the line numbers so i can quickly locate the items you talked about?I am using arduino 0023 and i am not seeing anything for that?
Re: Couple of ramps1.4 questions?
October 29, 2014 12:37PM
Ok i went to change the m106 to m3 and m107 to m5 but i see the is already a case 3 it is for g3 ccw arc?should i just // out the case 3 that is there and write my own case 3 for the m3?I dont ever remember seeing a g3 in any of my g codes i do most of my stuff with a polyline so arcs are not needed.. just g0 and g1
Re: Couple of ramps1.4 questions?
October 29, 2014 01:27PM
The G and M codes are in different swiches, add 3 and 5 to the M code switch.

Line numbers are shown in the bottom left of the arduino IDE, and are shown somewhere in any decent text editor.

The M600 stuff related to pause and resume is in the while loop starting at 3578. Put something similar in your own case, replace lcd_clicked with DigitalRead() pin you are sending the arc OK signal to, get rid of the stuff about the beepers, keep the stuff about managing heaters and updating LCDs, which is the bit that keeps the printer working while paused.
Re: Couple of ramps1.4 questions?
October 29, 2014 03:13PM
ok i got the m3 and m5 added.. Now i am working on the pins for the y axis..I have been running mother board 33 for my set up but i am wondering if the is a way i can use the e1 and y for my y axis motors as i am never gonna be running two extruders and am using the fan on to control my torch on?I see in some of the other mother boards it uses dual y steppers?this would work out great for my set up basicly i want to slave the y axis and e1 axis..i am looking at lines527 thru 559 looks like it is already done under mother board 77?is there a way to add these settings to mother board 33?it gets a little confusing as they really don't have mother board 33 by itself in the pins h file

Edited 1 time(s). Last edit at 10/29/2014 05:01PM by tm america.
Re: Couple of ramps1.4 questions?
October 29, 2014 05:08PM
The else block right after the motherboard 77 pins handles all other Mega based electronics. I don't know about using two stepper drivers on the same axis, but swapping drivers between axes is easy.
Re: Couple of ramps1.4 questions?
October 29, 2014 05:22PM
I'm wondering if you would be able to put a do something like this for the y axis
#define y_step_pin 60,36
#define y_dir_pin 61,34
#define y_enable_pin 56,30
#define y_min_pin 14
#define y_max_pin 15

If not it looks like it is set up to slave the axis in the post processor instead?

Also where is the rewrite code_to detect () and skip those comments?

Is the disable homing retract in the config h ?i am wondering if i could use a m226 to pause as well ?looking at the code for m600 it is pretty complicated
Also does the marlin firmware accept a g28.1 z command to home only the z axis?Or is this something i will need to add as well?
Re: Couple of ramps1.4 questions?
October 29, 2014 05:48PM
It can't be done like that, the code is looking for a pin number, not a list of pins. For dual motor axis, reprap electronics typically put two motors on one driver. It should also be possible to wire two stepper drivers to the same pin, I vaguely remember someone stacking stepper drivers on the same header back in the old days.

Looking at the code again, code_seen doesn't work the way I thought it did. Create a new function that'll iterate across cmdbuffer[] and zero out parenthesis and anything between them. Call that function at the start of process_commands().

Not sure on disabling homing retract. You can set the distance to zero in configuration_adv.h, but I don't know if it'll still be looking for a second pulse on the endstop pin.

Homing on a single axis can be done, G28 Z0 will home only on Z.
Re: Couple of ramps1.4 questions?
October 29, 2014 06:11PM
Ok i guess i will just swap the y axis and z axis pins for now..I am gonna make a board that goes between the ramps 1.4 and pololu drivers i will make it where it pulls power from two of headers and then will run the step,dir,and enable to the two drivers i am also gonna make it where it allows me to have break out pins for the z axis step and dir pins so i can jumper them if not using the torch height controller and run them to the thc if it is being used.
So i am good on the m3 and m5 and on switching the pins to swap the y ans z axis so i have two headers for the motors. just gotta find the best way to pause it while the torch height controller is running which sends an arc ok signal when it is done.. I need to have it do a m3 then say a g28 z0 and wait till the thc sends the arc ok to the endstop for the z min this will then let it resume the other axis commands.I think i might have the ability to make the thc send a double pulse to the endstop pin.
I still am not seeing where i would need to insert the command to make it skip over the comments in ( )..
Re: Couple of ramps1.4 questions?
October 29, 2014 07:05PM
i tried to compile and send to the i/o it gave me an error.marlin_main.cpp:1639:1: error: unterminated #ifdef
Re: Couple of ramps1.4 questions?
October 29, 2014 07:48PM
ok i found the problem when i did my copy and paste for the m3-m5 i didnt get the #endif now just gotta find a way to make it ignore the comments in () and try different ways for the pause .Andrew Smith thanks alot for helping me get to this point i owe you .. once i get this all up and running i'm gonna have to make a donation
Re: Couple of ramps1.4 questions?
October 30, 2014 12:44PM
Where would the code that makes it ignore the items with a ;semicolon be at ?i'm wondering it i could change that line to make it ignore items within ( ) or after a ( I really would like to get this working without having to edit all the g code files i have been running on my other cnc plasma tables..This is the one missing link i am looking for right now..the other things worked out nicely
Re: Couple of ramps1.4 questions?
October 30, 2014 02:16PM
Thats line 753. Turning comment_mode true and false on '(' and ')' characters should do the trick.
Re: Couple of ramps1.4 questions?
October 30, 2014 02:53PM
Line 753 under which tab ?config h?
Re: Couple of ramps1.4 questions?
October 30, 2014 03:01PM
marlin_main.cpp. Look for

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

And change it to 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;

It seems to work perfectly. If you print from SDcard, make the same mod to the similar code further down.
Re: Couple of ramps1.4 questions?
October 30, 2014 03:10PM
Ok i think i found it . So basiclly i just need to add two lines of code there .that look like this?
If(serial_char == '(')comment_mode=true;
if(serial_char == ')')comment_mode=false;
Re: Couple of ramps1.4 questions?
October 30, 2014 05:17PM
Thanks alot.
I do run from the sd card to..About what line would the other change need to be done at?
Re: Couple of ramps1.4 questions?
October 30, 2014 05:26PM
Should be on line 815 in your marlin_main.cpp.
Re: Couple of ramps1.4 questions?
October 30, 2014 05:43PM
Andrew i must say i am blown away by your knowledge of marlin firmware..i just am wondering one more thing .I am thinking on these machines running the torch height controller that needs a pause while it homes the z axis,lifts to pierce height ,triggers the torch on the does the dwell.. would it be possible to write the macro for this into the m3 code?so it would tell it to turn on the torch then wait till the z axis home switch recieves the arc ok signal?That sure would be handy not needing to do a custom post processor on that machine if i decide to use it as just a cnc plasma ..which is most likely what will happen due to the z axis being controlled entirely by the stand alone thc.

Edited 1 time(s). Last edit at 10/30/2014 05:44PM by tm america.
Re: Couple of ramps1.4 questions?
October 30, 2014 06:07PM
Actually, this is the first time I've looked at this part of it in detail. But the codes all there, if you know C you can work through it and make it do what you like.

Anyway, if I get your question right, you want M3 to turn on the torch, then pause till you get a signal on a given pin.

Anyway, I didn't see it before but there's M226, wait till pin reaches specified state. Wish they called it a 'pause' rather than a 'wait'. The relevant section is:

while(digitalRead(pin_number) != target){

target is HIGH or LOW depending on what signal the torch gives you, the pin number is whatever pin you connect it to. Stick that into M3 just below the line that turns on the torch.
Re: Couple of ramps1.4 questions?
October 30, 2014 06:51PM
That's what i was thinking i seen the m226 but figured i didn't wanna make a custom post processor to write m3 then m226 .Since this machine will be strictly cnc plasma with that thc controller...I wish i would have went to school for programming but i ended up building racing transmissions for the past 23 yrs now i am switching to building cnc machine for my business.I am amazed how fast the technoligy changes .. Same for the automotive field .. when i started there were no computerized transmissions then they became the norm.. so you had to know what the computer did and needed and how it interacted with the hydraulic and mechanical systems of the transmissions.Funny in the end they all turn out to be really similar in function as far as how the firmware works and the link to a mechanical system.Now i have tons of ideas i am making happen with cnc machines ..
Re: Couple of ramps1.4 questions?
October 30, 2014 06:57PM
The m226 code can be very usefull with robotics .. Guess i will probably end up doing alot with it in other apps as well.. I really like the grbl-marlin enviroment.It is really nice having a firmware that is so adaptable to so many uses.. Now i just gotta automate my cnc mill-lathe and automate my welder to?Then maybe my benders and presses?..Thanks for all your help you saved me months of banging my head on the wall
Re: Couple of ramps1.4 questions?
October 30, 2014 07:32PM
Ok i just remembered one more thing i wanna change?it shows mendel ready on the lcd screen where would i go to change that?I had switched it when i was running repetier firmware but i was having issues getting the extruder to work with the repetier firmware.
Re: Couple of ramps1.4 questions?
October 30, 2014 07:42PM
Line 89 of configuration.h, uncomment it and fill in whatever machine name you want.
Re: Couple of ramps1.4 questions?
October 31, 2014 12:02AM
ok i have been looking into using two stepper drivers for one axis and i am looking in the config h adv.line 186-196 there are pins for a seccond x axis and then below is a place where you can select mode 2 duplication mode which duplicates the commands of the first x axis to the seccond?I am thinking this could be used to slave the x and e1 axis drivers together to have one stepper for each motor on the x axis?Or any other axis just by changing the x to the letter of the axis and then out the pins in for the e1 driver?
Re: Couple of ramps1.4 questions?
October 31, 2014 01:55AM
ok i got it working with one driver for each motor just had the sellect the dual y drivers .works alot better like that More power -less heat and i am able to run the accel and velocity up more to..it just uses the y and unused e1 driver for the y2 ..Man i think having someone smart help you passes it on to you ..A week ago i would have been pulling my hair out trying to figure these things out..
Re: Couple of ramps1.4 questions?
November 01, 2014 11:13PM
ok so it seems our little fix to make it not see the comments that are in ( ) did not work ?Am i missing something and if i do a ; in front of the comments it will skip everything except the m codes and ignores the g codes...I tested it in repetier and just manually typed the commands if i type ;hi mom it will ignore it if i type (hi mom) it will give me error codes and disconnect from the ramps..
Re: Couple of ramps1.4 questions?
November 02, 2014 11:44AM
ok i got to do some testing i am still having several issuessad smiley First it is not recongizing f codes for feedrate?Where would i have to go to add this feature?Wouls i hve to add it after the m and g commands?something similar to those but instead of being multiple cases it would be just one that reads something like if F set feedrate what would the command have to look like?
second I had to change the if(serial_char == '(') comment_mode =true; and if(serial_char ==')') comment_mode = true; to one line like if(serial_char == "()' comment_mode = true; Next if it has a e,y,p,a,s,f,z,x,or n in the ( ) it will show unknown command.if it has a t in the ( ) it will say extruder active I'm guessing i could probably write a bunch of if(serial_char == for the different letters that are issues but i dont think the fix for t is gonna be in that area?so if anyone has any ideas on these issues it would be a great help
Sorry, only registered users may post in this forum.

Click here to login