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" | |
14ecdbd7 | 16 | #include "modules/tools/toolsmanager/Tool.h" |
4cff3ded | 17 | |
ded56b35 AW |
18 | #define OFF 0 |
19 | #define SOLO 1 | |
20 | #define FOLLOW 2 | |
4cff3ded | 21 | |
14ecdbd7 | 22 | class Extruder : public Module, public Tool { |
4cff3ded | 23 | public: |
14ecdbd7 | 24 | Extruder(uint16_t config_identifier); |
8519d744 MM |
25 | void on_module_loaded(); |
26 | void on_config_reload(void* argument); | |
27 | void on_gcode_received(void*); | |
28 | void on_gcode_execute(void* argument); | |
29 | void on_block_begin(void* argument); | |
30 | void on_block_end(void* argument); | |
31 | void on_play(void* argument); | |
32 | void on_pause(void* argument); | |
33 | void on_speed_change(void* argument); | |
8b8b3339 | 34 | uint32_t acceleration_tick(uint32_t dummy); |
be8332cd | 35 | uint32_t stepper_motor_finished_move(uint32_t dummy); |
41bbd0d3 | 36 | Block* append_empty_block(); |
4cff3ded | 37 | |
62bd4cfa MM |
38 | Pin step_pin; // Step pin for the stepper driver |
39 | Pin dir_pin; // Dir pin for the stepper driver | |
40 | Pin en_pin; | |
ca037905 | 41 | |
bf8adc44 MM |
42 | double target_position; // End point ( in mm ) for the current move |
43 | double current_position; // Current point ( in mm ) for the current move, incremented every time a move is executed | |
44 | double unstepped_distance; // overflow buffer for requested moves that are less than 1 step | |
4cff3ded | 45 | Block* current_block; // Current block we are stepping, same as Stepper's one |
dd3b416b | 46 | double steps_per_millimeter; // Steps to travel one millimeter |
ca037905 MM |
47 | double feed_rate; // |
48 | double acceleration; // | |
7dab41f3 | 49 | double max_speed; |
4cff3ded | 50 | |
436a2cd1 AW |
51 | double travel_ratio; |
52 | double travel_distance; | |
bf8adc44 | 53 | bool absolute_mode; // absolute/relative coordinate mode switch |
ded56b35 | 54 | |
bf8adc44 | 55 | char mode; // extruder motion mode, OFF, SOLO, or FOLLOW |
81b547a1 AW |
56 | |
57 | bool paused; | |
14ecdbd7 AW |
58 | bool single_config; |
59 | ||
60 | uint16_t identifier; | |
be8332cd | 61 | |
670fa10b | 62 | StepperMotor* stepper_motor; |
be8332cd | 63 | |
4cff3ded AW |
64 | }; |
65 | ||
66 | #endif |