cleaned up unused members, added a few comments
[clinton/Smoothieware.git] / src / modules / tools / extruder / Extruder.h
1 /*
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/>.
6 */
7
8
9
10 #ifndef EXTURDER_MODULE_H
11 #define EXTRUDER_MODULE_H
12
13 #include "libs/Module.h"
14 #include "libs/Kernel.h"
15 #include "modules/robot/Block.h"
16
17 #define extruder_module_enable_checksum CHECKSUM("extruder_module_enable")
18 #define extruder_steps_per_mm_checksum CHECKSUM("extruder_steps_per_mm")
19 #define extruder_acceleration_checksum CHECKSUM("extruder_acceleration")
20 #define extruder_step_pin_checksum CHECKSUM("extruder_step_pin")
21 #define extruder_dir_pin_checksum CHECKSUM("extruder_dir_pin")
22 #define extruder_en_pin_checksum CHECKSUM("extruder_en_pin")
23 #define extruder_max_speed_checksum CHECKSUM("extruder_max_speed")
24
25 // default_feed_rate_checksum defined by Robot.h
26
27 #define OFF 0
28 #define SOLO 1
29 #define FOLLOW 2
30
31 class Extruder : public Module{
32 public:
33 Extruder();
34 void on_module_loaded();
35 void on_config_reload(void* argument);
36 void on_gcode_received(void*);
37 void on_gcode_execute(void* argument);
38 void on_block_begin(void* argument);
39 void on_block_end(void* argument);
40 void on_play(void* argument);
41 void on_pause(void* argument);
42 void on_speed_change(void* argument);
43 uint32_t acceleration_tick(uint32_t dummy);
44 uint32_t stepper_motor_finished_move(uint32_t dummy);
45 Block* append_empty_block();
46
47 Pin step_pin; // Step pin for the stepper driver
48 Pin dir_pin; // Dir pin for the stepper driver
49 Pin en_pin;
50
51 double target_position; // End point ( in mm ) for the current move
52 double current_position; // Current point ( in mm ) for the current move, incremented every time a move is executed
53 double unstepped_distance; // overflow buffer for requested moves that are less than 1 step
54 Block* current_block; // Current block we are stepping, same as Stepper's one
55 double steps_per_millimeter; // Steps to travel one millimeter
56 double feed_rate; //
57 double acceleration; //
58 double max_speed;
59
60 double travel_ratio;
61 double travel_distance;
62 bool absolute_mode; // absolute/relative coordinate mode switch
63
64 char mode; // extruder motion mode, OFF, SOLO, or FOLLOW
65
66 bool paused;
67
68 StepperMotor* stepper_motor;
69
70 };
71
72 #endif