G28 with laserOn

That sounds a little bit strange, but I use the lasermode for a plotter and laseron=PenUP.
So G28 with penDown is not so good :-)
I changed in commands.cpp:
        case 28: { //G28 Home all Axis one at a time
                bool oldLaser = LaserDriver::laserOn;
               //+++  original              LaserDriver::laserOn = false;
              LaserDriver::laserOn = true;  //home ohne pen
              oldLaser= true;  //alten zustand setzen
It starts G28 with penUP, but soon penDown (= Laser off)  is back.
What else should change?
Or is there a better way to do it? (eg change the homeaxis command with laserOn=true)


  • edited July 2017

    regarding homing just invert the laser Signal.

    Laser is switched off by Firmware for  moves except G1 so it seems you have configured Signal wrong.

    In that case go to configuration.h

    and Change :

    #define LASER_ON_HIGH 1 to #define LASER_ON_HIGH 0 or opposite depending your actual Settings

    if you Change commands etc. you should use Event System, makes life easier

  • good idea! just checked it.
    The disadvantage is now tht the basic configuration is magnet=on.
    So when it moves from G1 to G1 (which would be a continous line) the pen moves shortly up and then comes down again. So on a print the pen jumps back and forth ...
    I think I have to stay with LASER_ON_HIGH 1 and better change the G28 command.
  • edited July 2017

    Problem you have  is that laser is switched off at end of move , what is absolutely correct and wanted by Firmware.

    (i guess you just sent single lines for test)

    in a flow of several moves you will not have that issue(just write a litte gcode file to see).

    to Change this behaviour is a Little more work , but as it´s safety relevant and may be misused by other users

     i´ll not support that.

    For you i´ll  suggest to switch over to cnc mode.

    you can handle the pen up/down by M3 /M5 comands and there is nothing changed by Firmware caused by moves.

  • makes sense:
    in CNC mode the spindle always runs.
    So my gcode must change: before a penUP comes I add M3 S255 and the first pendown needs M5 (or M3 S0)
  • exact.

    if you are familiar with HPGL commands  the M3 is PD    and the M5 is PU

    I would not use the M3 S0 , shure it works but not usual in CNC/ Plotter programming.

  • Right I convert from HPGL.
    In my case Power on moves the pen up so that magnet=on means spindle=on means PU=M3 S255.
    or did I miss something?
    Thanks for your help!
  • OOps I am wrong: I must inverse it otherwise G28 has again spindle on!
    So your are right!
    High signal enables spindle (CNC_ENABLE_WITH) that is set 0 then:
    pen up: magnet=on means spindle=off(D10 on) means PU=M5
    pend down: magnet=off means spindle=on(D10 off) means PU=M3 S255
  • edited July 2017


    M3 Enables which means pen down , M5 disables which means Pen up.

    set cnc_enable_with to match that.´

    if spindle is on when homing send M5 before G28

  • Penup (not drawing) means in my case Magnet on (Power on D10) ...
  • you should match g-code standards with your machine , thats why  CNC_ENABLE_WITH i s implemented.

    set it to 0 or 1 , so that M3 (without S...)  makes your pen go down  and M5 makes it go up.

    otherwise you can never run a gcode file generated by a standardized software.

    (just meet worldwide used standards  )
  • You are right ... that would be the best way.
    On the other hand, in my design I need the magnet for PenUp ...
    Thanks for your CNC-hint - now it works!
    (I wrote my own HPGL-converter, based on that, I came around that M3/M5 issue)
    My left issue is to use M3 Sxxx (because the magnet would prefer to get reduced power when the plunger ist in), but this is part of a separate discussion!
    Thanks again - your tip was a big help.
Sign In or Register to comment.