Merge remote-tracking branch 'upstream/master' into edge
[clinton/Smoothieware.git] / src / modules / tools / endstops / Endstops.h
1 /*
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.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #ifndef ENDSTOPS_MODULE_H
9 #define ENDSTOPS_MODULE_H
10
11 #include "libs/Module.h"
12 #include "libs/Pin.h"
13
14 #include <bitset>
15
16 class StepperMotor;
17
18 class Endstops : public Module{
19 public:
20 Endstops();
21 void on_module_loaded();
22 void on_gcode_received(void* argument);
23 void on_config_reload(void* argument);
24 uint32_t acceleration_tick(uint32_t dummy);
25
26 private:
27 void do_homing(char axes_to_move);
28 void do_homing_corexy(char axes_to_move);
29 void wait_for_homed(char axes_to_move);
30 void wait_for_homed_corexy(int axis);
31 void corexy_home(int home_axis, bool dirx, bool diry, float fast_rate, float slow_rate, unsigned int retract_steps);
32 void back_off_home();
33 void on_get_public_data(void* argument);
34 void on_set_public_data(void* argument);
35 void on_idle(void *argument);
36
37 float homing_position[3];
38 float home_offset[3];
39 std::bitset<3> home_direction;
40 std::bitset<3> limit_enable;
41
42 unsigned int debounce_count;
43 float retract_mm[3];
44 float trim_mm[3];
45 float fast_rates[3];
46 float slow_rates[3];
47 float feed_rate[3];
48 Pin pins[6];
49 char status;
50 struct {
51 bool is_corexy:1;
52 bool is_delta:1;
53 };
54 };
55
56 #endif