2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
10 #ifndef EXTURDER_MODULE_H
11 #define EXTRUDER_MODULE_H
13 #include "libs/Module.h"
14 #include "libs/Kernel.h"
15 #include "modules/robot/Block.h"
17 #define microseconds_per_step_pulse_checksum 42333
18 #define extruder_module_enable_checksum 6183
19 #define extruder_steps_per_mm_checksum 58088
20 #define default_feed_rate_checksum 53183
21 #define extruder_acceleration_checksum 60356
27 class Extruder
: public Module
{
30 void on_module_loaded();
31 void on_config_reload(void* argument
);
32 void on_gcode_execute(void* argument
);
33 void on_block_begin(void* argument
);
34 void on_block_end(void* argument
);
35 void on_play(void* argument
);
36 void on_pause(void* argument
);
37 void on_speed_change(void* argument
);
38 uint32_t acceleration_tick(uint32_t dummy
);
39 uint32_t stepper_motor_finished_move(uint32_t dummy
);
41 Pin
* step_pin
; // Step pin for the stepper driver
42 Pin
* dir_pin
; // Dir pin for the stepper driver
45 double target_position
; // End point ( in steps ) for the current move
46 double current_position
; // Current point ( in steps ) for the current move, incremented every time a step is outputed
48 Block
* current_block
; // Current block we are stepping, same as Stepper's one
49 int microseconds_per_step_pulse
; // Pulse duration for step pulses
50 double steps_per_millimeter
; // Steps to travel one millimeter
52 double acceleration
; //
54 int counter_increment
;
59 double travel_distance
;
69 StepperMotor
* stepper_motor
;