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 | ||
17c89e4d | 13 | #include "Tool.h" |
61134a65 JM |
14 | #include "Pin.h" |
15 | ||
16 | class StepperMotor; | |
17c89e4d | 17 | class Block; |
4cff3ded | 18 | |
17c89e4d JM |
19 | // NOTE Tool is also a module, no need for multiple inheritance here |
20 | class Extruder : public Tool { | |
4cff3ded | 21 | public: |
17c89e4d | 22 | Extruder(uint16_t config_identifier, bool single= false); |
3494f3d0 | 23 | virtual ~Extruder(); |
17c89e4d | 24 | |
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); | |
3d1a4519 | 33 | void on_halt(void* argument); |
8519d744 | 34 | void on_speed_change(void* argument); |
a157d099 | 35 | void acceleration_tick(void); |
be8332cd | 36 | uint32_t stepper_motor_finished_move(uint32_t dummy); |
41bbd0d3 | 37 | Block* append_empty_block(); |
4cff3ded | 38 | |
17c89e4d | 39 | private: |
d87968be | 40 | void on_get_public_data(void* argument); |
b77573dc | 41 | uint32_t rate_increase() const; |
540c8365 | 42 | |
0db12234 JM |
43 | StepperMotor* stepper_motor; |
44 | Pin step_pin; // Step pin for the stepper driver | |
45 | Pin dir_pin; // Dir pin for the stepper driver | |
46 | Pin en_pin; | |
1ad23cd3 | 47 | float target_position; // End point ( in mm ) for the current move |
1ad23cd3 | 48 | float unstepped_distance; // overflow buffer for requested moves that are less than 1 step |
d87968be | 49 | Block* current_block; // Current block we are stepping, same as Stepper's one |
8a3ae3d0 | 50 | |
8a3ae3d0 JM |
51 | // kept together so they can be passed as public data |
52 | struct { | |
79f65cbb JM |
53 | float steps_per_millimeter; // Steps to travel one millimeter |
54 | float filament_diameter; // filament diameter | |
0db12234 JM |
55 | float extruder_multiplier; // flow rate 1.0 == 100% |
56 | float acceleration; // extruder accleration SOLO setting | |
57 | float retract_length; // firmware retract length | |
02e4b295 | 58 | float current_position; // Current point ( in mm ) for the current move, incremented every time a move is executed |
8a3ae3d0 JM |
59 | }; |
60 | ||
79f65cbb | 61 | float volumetric_multiplier; |
3494f3d0 | 62 | float feed_rate; // mm/sec for SOLO moves only |
4cff3ded | 63 | |
1ad23cd3 MM |
64 | float travel_ratio; |
65 | float travel_distance; | |
ded56b35 | 66 | |
ec6fde0b JM |
67 | // for firmware retract |
68 | float retract_feedrate; | |
ec6fde0b JM |
69 | float retract_recover_feedrate; |
70 | float retract_recover_length; | |
76ddeb67 JM |
71 | float retract_zlift_length; |
72 | float retract_zlift_feedrate; | |
ec6fde0b | 73 | |
8a3ae3d0 | 74 | struct { |
cc3d6abe | 75 | char mode:3; // extruder motion mode, OFF, SOLO, or FOLLOW |
8a3ae3d0 JM |
76 | bool absolute_mode:1; // absolute/relative coordinate mode switch |
77 | bool paused:1; | |
78 | bool single_config:1; | |
ec6fde0b | 79 | bool retracted:1; |
78af0407 | 80 | bool cancel_zlift_restore:1; // hack to stop a G11 zlift restore from overring an absolute Z setting |
8a3ae3d0 | 81 | }; |
14ecdbd7 | 82 | |
be8332cd | 83 | |
4cff3ded AW |
84 | }; |
85 | ||
86 | #endif |