Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
201bcb94 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. | |
df27a6a3 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
201bcb94 AW |
6 | */ |
7 | ||
8 | #ifndef ENDSTOPS_MODULE_H | |
9 | #define ENDSTOPS_MODULE_H | |
10 | ||
11 | #include "libs/Module.h" | |
750277f8 | 12 | #include "libs/Pin.h" |
201bcb94 | 13 | |
7d6fe308 JM |
14 | #include <bitset> |
15 | ||
9f6f04a5 | 16 | class StepperMotor; |
a2f1ce04 | 17 | class Gcode; |
750277f8 | 18 | |
201bcb94 AW |
19 | class Endstops : public Module{ |
20 | public: | |
21 | Endstops(); | |
22 | void on_module_loaded(); | |
23 | void on_gcode_received(void* argument); | |
a157d099 | 24 | void acceleration_tick(void); |
201bcb94 | 25 | |
47bbe224 | 26 | private: |
7492a02e | 27 | void load_config(); |
81f02e89 JM |
28 | void home(char axes_to_move); |
29 | void do_homing_cartesian(char axes_to_move); | |
f29b0272 | 30 | void do_homing_corexy(char axes_to_move); |
798295c1 JM |
31 | bool wait_for_homed(char axes_to_move); |
32 | bool wait_for_homed_corexy(int axis); | |
1ad23cd3 | 33 | void corexy_home(int home_axis, bool dirx, bool diry, float fast_rate, float slow_rate, unsigned int retract_steps); |
5bfcd44a | 34 | void back_off_home(char axes_to_move); |
2ddf75fd | 35 | void move_to_origin(char); |
9f6f04a5 | 36 | void on_get_public_data(void* argument); |
7d6fe308 | 37 | void on_set_public_data(void* argument); |
3c947f85 | 38 | void on_idle(void *argument); |
28166daf | 39 | bool debounced_get(int pin); |
a2f1ce04 | 40 | void process_home_command(Gcode* gcode); |
078f76e0 | 41 | void set_homing_offset(Gcode* gcode); |
33e4cc02 | 42 | |
1ad23cd3 | 43 | float homing_position[3]; |
33e4cc02 | 44 | float home_offset[3]; |
80605954 | 45 | uint8_t homing_order; |
7d6fe308 | 46 | std::bitset<3> home_direction; |
3c947f85 | 47 | std::bitset<3> limit_enable; |
e714bd32 | 48 | float saved_position[3]{0}; // save G28 (in grbl mode) |
3c947f85 | 49 | |
47bbe224 | 50 | unsigned int debounce_count; |
56ce2b5a JM |
51 | float retract_mm[3]; |
52 | float trim_mm[3]; | |
1ad23cd3 MM |
53 | float fast_rates[3]; |
54 | float slow_rates[3]; | |
56ce2b5a | 55 | Pin pins[6]; |
81f02e89 | 56 | volatile float feed_rate[3]; |
7d6fe308 JM |
57 | struct { |
58 | bool is_corexy:1; | |
59 | bool is_delta:1; | |
11a39396 | 60 | bool is_rdelta:1; |
3e1f5b74 | 61 | bool is_scara:1; |
2ddf75fd | 62 | bool move_to_origin_after_home:1; |
ee1c3181 | 63 | uint8_t bounce_cnt:4; |
e0b58122 | 64 | volatile char status:3; |
7d6fe308 | 65 | }; |
201bcb94 AW |
66 | }; |
67 | ||
201bcb94 | 68 | #endif |