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