Commit | Line | Data |
---|---|---|
ca037905 | 1 | /* |
cd011f58 AW |
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. | |
ca037905 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
cd011f58 AW |
6 | */ |
7 | ||
8 | ||
9 | ||
4cff3ded AW |
10 | #ifndef EXTURDER_MODULE_H |
11 | #define EXTRUDER_MODULE_H | |
12 | ||
4cff3ded AW |
13 | #include "libs/Module.h" |
14 | #include "libs/Kernel.h" | |
15 | #include "modules/robot/Block.h" | |
16 | ||
d4f93cf4 AG |
17 | #define microseconds_per_step_pulse_checksum CHECKSUM("microseconds_per_step_pulse") |
18 | #define extruder_module_enable_checksum CHECKSUM("extruder_module_enable") | |
19 | #define extruder_steps_per_mm_checksum CHECKSUM("extruder_steps_per_mm") | |
20 | #define extruder_acceleration_checksum CHECKSUM("extruder_acceleration") | |
21 | #define extruder_step_pin_checksum CHECKSUM("extruder_step_pin") | |
22 | #define extruder_dir_pin_checksum CHECKSUM("extruder_dir_pin") | |
23 | #define extruder_en_pin_checksum CHECKSUM("extruder_en_pin") | |
24 | #define extruder_max_speed_checksum CHECKSUM("extruder_max_speed") | |
7dab41f3 | 25 | |
7b7a87d4 | 26 | // default_feed_rate_checksum defined by Robot.h |
dd3b416b | 27 | |
ded56b35 AW |
28 | #define OFF 0 |
29 | #define SOLO 1 | |
30 | #define FOLLOW 2 | |
4cff3ded AW |
31 | |
32 | class Extruder : public Module{ | |
33 | public: | |
ca037905 | 34 | Extruder(); |
8519d744 MM |
35 | void on_module_loaded(); |
36 | void on_config_reload(void* argument); | |
37 | void on_gcode_received(void*); | |
38 | void on_gcode_execute(void* argument); | |
39 | void on_block_begin(void* argument); | |
40 | void on_block_end(void* argument); | |
41 | void on_play(void* argument); | |
42 | void on_pause(void* argument); | |
43 | void on_speed_change(void* argument); | |
8b8b3339 | 44 | uint32_t acceleration_tick(uint32_t dummy); |
be8332cd | 45 | uint32_t stepper_motor_finished_move(uint32_t dummy); |
41bbd0d3 | 46 | Block* append_empty_block(); |
4cff3ded | 47 | |
62bd4cfa MM |
48 | Pin step_pin; // Step pin for the stepper driver |
49 | Pin dir_pin; // Dir pin for the stepper driver | |
50 | Pin en_pin; | |
ca037905 | 51 | |
e2b4a32b AW |
52 | double target_position; // End point ( in steps ) for the current move |
53 | double current_position; // Current point ( in steps ) for the current move, incremented every time a step is outputed | |
4464301d | 54 | int current_steps; |
4cff3ded AW |
55 | Block* current_block; // Current block we are stepping, same as Stepper's one |
56 | int microseconds_per_step_pulse; // Pulse duration for step pulses | |
dd3b416b | 57 | double steps_per_millimeter; // Steps to travel one millimeter |
ca037905 MM |
58 | double feed_rate; // |
59 | double acceleration; // | |
7dab41f3 | 60 | double max_speed; |
4cff3ded | 61 | |
ca037905 | 62 | int counter_increment; |
3b1e82d2 | 63 | int step_counter; |
ded56b35 | 64 | |
436a2cd1 AW |
65 | bool solo_mode; |
66 | double travel_ratio; | |
67 | double travel_distance; | |
68 | bool absolute_mode; | |
0eb11a06 | 69 | |
ecc402eb AW |
70 | bool debug; |
71 | int debug_count; | |
ded56b35 AW |
72 | |
73 | char mode; | |
81b547a1 AW |
74 | |
75 | bool paused; | |
be8332cd | 76 | |
670fa10b | 77 | StepperMotor* stepper_motor; |
be8332cd | 78 | |
4cff3ded AW |
79 | }; |
80 | ||
81 | #endif |