1 #ifndef EXTURDER_MODULE_H
2 #define EXTRUDER_MODULE_H
5 #include "libs/Module.h"
6 #include "libs/Kernel.h"
7 #include "modules/robot/Block.h"
9 #define microseconds_per_step_pulse_ckeckusm 42333
10 #define extruder_module_enable_checksum 6183
12 class Extruder
: public Module
{
14 Extruder(PinName stppin
);
15 void on_module_loaded();
16 void on_config_reload(void* argument
);
17 void on_gcode_execute(void* argument
);
18 void on_block_begin(void* argument
);
19 void on_block_end(void* argument
);
20 void acceleration_tick();
23 DigitalOut step_pin
; // Step pin for the stepper driver
24 unsigned int start_position
; // Start point ( in steps ) for the current move
25 unsigned int target_position
; // End point ( in steps ) for the current move
26 unsigned int current_position
; // Current point ( in steps ) for the current move, incremented every time a step is outputed
27 Ticker acceleration_ticker
; // Ticker responsible with updating the speed ( acceleration management ). Uses Timer3
28 Block
* current_block
; // Current block we are stepping, same as Stepper's one
29 int microseconds_per_step_pulse
; // Pulse duration for step pulses
33 double travel_distance
;