gcode->stream->printf("X:%g Y:%g Z:%g ", steps[0], steps[1], steps[2]);
gcode->add_nl = true;
return;
- case 114: gcode->stream->printf("C: X:%1.3f Y:%1.3f Z:%1.3f\n",
+ case 114: gcode->stream->printf("C: X:%1.3f Y:%1.3f Z:%1.3f ",
this->current_position[0],
this->current_position[1],
this->current_position[2]);
- return;
- }
+ gcode->add_nl = true;
+ return;
+ }
}
if( this->motion_mode < 0)
return;
* or the head moves, and the extruder moves plastic at a speed proportional to the movement of the head ( FOLLOW mode here ).
*/
-// extruder_acceleration_checksum
-
Extruder::Extruder() {
this->absolute_mode = true;
this->step_counter = 0;
// We work on the same Block as Stepper, so we need to know when it gets a new one and drops one
this->register_for_event(ON_BLOCK_BEGIN);
this->register_for_event(ON_BLOCK_END);
+ this->register_for_event(ON_GCODE_RECEIVED);
this->register_for_event(ON_GCODE_EXECUTE);
this->register_for_event(ON_PLAY);
this->register_for_event(ON_PAUSE);
this->stepper_motor->unpause();
}
-
+void Extruder::on_gcode_received(void *argument)
+{
+ Gcode *gcode = static_cast<Gcode*>(argument);
+ if (gcode->has_m)
+ {
+ if (gcode->m == 114)
+ {
+ gcode->stream->printf("E:%4.1f ", this->current_position);
+ gcode->add_nl = true;
+ }
+ }
+}
// Compute extrusion speed based on parameters and gcode distance of travel
void Extruder::on_gcode_execute(void* argument){
Extruder();
void on_module_loaded();
void on_config_reload(void* argument);
+ void on_gcode_received(void*);
void on_gcode_execute(void* argument);
void on_block_begin(void* argument);
void on_block_end(void* argument);