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
11 class Extruder
: public Module
{
13 Extruder(PinName stppin
);
14 void on_module_loaded();
15 void on_block_begin(void* argument
);
16 void on_block_end(void* argument
);
17 void acceleration_tick();
20 DigitalOut step_pin
; // Step pin for the stepper driver
21 unsigned int start_position
; // Start point ( in steps ) for the current move
22 unsigned int target_position
; // End point ( in steps ) for the current move
23 unsigned int current_position
; // Current point ( in steps ) for the current move, incremented every time a step is outputed
24 Ticker acceleration_ticker
; // Ticker responsible with updating the speed ( acceleration management ). Uses Timer3
25 Block
* current_block
; // Current block we are stepping, same as Stepper's one
26 int microseconds_per_step_pulse
; // Pulse duration for step pulses