Can I add a feature to the firmware to send a message when motors have stopped?

I am using your firmware in a cartesian configuration on an Arduino Mega to move a camera to collect images.

I would like to modify the firmware so that when all motors reach their commanded position after a G code move command, the firmware will send a "done" message, then I will know I can capture an image.

I cannot quite figure out where in your code to put this.

I am communicating to your firmware from a custom python script.

Thank you,
John

Comments

  • That is easy.
    M400
    will wait for end of moves. So send M400 followed by
    M118 Snapshot

    M118 will print message on communication channel. As you see no firmware modification needed to achieve this.
  • I have added this command, M380 to Commands.cpp which prints "done" when a move is completed.
    I would appreciate any comments regarding if this might create unexpected problems?

        case 380: // M380 Print done at end of all moves
            Commands::waitUntilEndOfAllMoves();
            Com::print("done");
            Com::println();
            break;
  • Great, thank you for your advice.

  • Your M380 does exactly the same as M400/M118 in combination.
    Only thing to consider is that if you then start sending new commands camera will move again so either make it wait for done before moving again or add a delay to make the snapshot.
Sign In or Register to comment.