G0 default speed in CNC mode

Hi! I'm using mi 3D printer to mill PCBs and soft materials. I've found that G0 moves (fast non-work movements) are very slow. In CNC machines G0 speed is a parameter defined by the manufacturer so gcode generators don't specify speed.

I've checked that, in firmware, G0 moves are treated as G1 moves so adding F parameter to Gcode makes the movements faster, but for complex gcodes is a pain to manually add the F parameter to each G0 movement.

Is there any option to assign a faster default speed to G0 moves in CNC mode?


  • No, it is not. Of course you can catch the case G0 and set feedrate if not given and set it back afterwards. It is just a small modification of the case G0/G1 you already found.
  • edited February 2018
    I had the same problem. It really looks easy to change it. Add new lines in code "Commands.cpp", function processGCode... for G0 speed i use X max feedrate. I hope it helps. I check it now on my miling machine.

    void Commands::processGCode(GCode *com) {
        uint32_t codenum; //throw away variable
        switch(com->G) {
            case 0: // G0 -> G1
            case 1: // G1
                    // disable laser for G0 moves
                    bool laserOn = LaserDriver::laserOn;
                    if(com->G == 0 && Printer::mode == PRINTER_MODE_LASER) {
                        LaserDriver::laserOn = false;
    #endif // defined
                    if(com->hasS()) Printer::setNoDestinationCheck(com->S != 0);
                    if(Printer::setDestinationStepsFromGCode(com)) // For X Y Z E F
                        if (!PrintLine::queueNonlinearMove(ALWAYS_CHECK_ENDSTOPS, true, true)) {
                            Com::printWarningFLN(PSTR("executeGCode / queueDeltaMove returns error"));
                       //added changed speed to max feedrate for G0 function
                       if (com->G == 0)
                       {   //----memorize speed----
                             float feedrate_mem = Printer::feedrate;
                             Printer::feedrate = MAX_FEEDRATE_X;
                             PrintLine::queueCartesianMove(ALWAYS_CHECK_ENDSTOPS, true);
                             //----G1 speed back------
                             Printer::feedrate = feedrate_mem;
                             PrintLine::queueCartesianMove(ALWAYS_CHECK_ENDSTOPS, true);
    #if UI_HAS_KEYS
                    // ui can only execute motion commands if we are not waiting inside a move for an
                    // old move to finish. For normal response times, we always leave one free after
                    // sending a line. Drawback: 1 buffer line less for limited time. Since input cache
                    // gets filled while waiting, the lost is neglectible.
                    PrintLine::waitForXFreeLines(1, true);
    #endif // UI_HAS_KEYS

                        InterruptProtectedBlock noInts;
                        int lc = (int)PrintLine::linesCount;
                        int lp = (int)PrintLine::linesPos;
                        int wp = (int)PrintLine::linesWritePos;
                        int n = (wp - lp);
                        if(n < 0) n += PRINTLINE_CACHE_SIZE;
                        if(n != lc)
                            Com::printFLN(PSTR("Buffer corrupted"));
                    LaserDriver::laserOn = laserOn;
    #endif // defined
Sign In or Register to comment.