This is a list of all the events that a Module can register for in Smoothie :

Name Called from Description How to cast the argument
on_main_loop /main.cpp Called in a loop in main(), all G/M commands must be executed or issued in this event. Note this event blocks when the queue is full no argument
on_console_line_received /modules/communication/SerialConsole.cpp Called every time a new line is received on the default Serial Console, with the line as a parameter SerialMessage new_message = *static_cast<SerialMessage*>(argument); string received = new_message.message;
on_gcode_received /modules/communication/GcodeDispatch.cpp Called every time a new G code is received, with the Gcode object as a parameter Gcode* gcode = static_cast<Gcode*>(argument);
on_gcode_execute /modules/robot/Block.cpp Called when a G code actually gets executed ( as opposed to received ), with the G code as a parameter Gcode* gcode = static_cast<Gcode*>(argument);
on_speed_change /modules/robot/Stepper.cpp Called whenever the Stepper module changes the stepping speed, with the Stepper as a parameter Stepper* stepper = static_cast<Stepper*>(argument);
on_block_begin /modules/robot/Stepper.cpp Called when the stepper pops a new block from the queue and starts stepping it Block* block = static_cast<Block*>(argument);
on_block_end /modules/robot/Stepper.cpp Called when the stepper is done with a block, and is about to delete it and pop the next Block* block = static_cast<Block*>(argument);