You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ENDSTOPS_MODULE_H
-#define ENDSTOPS_MODULE_H
+#pragma once
#include "libs/Module.h"
#include "libs/Pin.h"
#include <bitset>
+#include <array>
class StepperMotor;
+class Gcode;
class Endstops : public Module{
public:
Endstops();
void on_module_loaded();
void on_gcode_received(void* argument);
- void on_config_reload(void* argument);
- uint32_t acceleration_tick(uint32_t dummy);
private:
- void do_homing(char axes_to_move);
- void do_homing_corexy(char axes_to_move);
- void wait_for_homed(char axes_to_move);
- void wait_for_homed_corexy(int axis);
- void corexy_home(int home_axis, bool dirx, bool diry, float fast_rate, float slow_rate, unsigned int retract_steps);
- void back_off_home();
+ void load_config();
+ void home(std::bitset<3> a);
+ void back_off_home(std::bitset<3> axis);
+ void move_to_origin();
void on_get_public_data(void* argument);
void on_set_public_data(void* argument);
void on_idle(void *argument);
+ bool debounced_get(int pin);
+ void process_home_command(Gcode* gcode);
+ void set_homing_offset(Gcode* gcode);
+ uint32_t read_endstops(uint32_t dummy);
float homing_position[3];
float home_offset[3];
- std::bitset<3> home_direction;
- std::bitset<3> limit_enable;
+ float saved_position[3]{0}; // save G28 (in grbl mode)
+ float alpha_max, beta_max, gamma_max;
unsigned int debounce_count;
float retract_mm[3];
float trim_mm[3];
float fast_rates[3];
float slow_rates[3];
- float feed_rate[3];
Pin pins[6];
- char status;
+ std::array<uint16_t, 3> debounce;
+
+ std::bitset<3> home_direction;
+ std::bitset<3> limit_enable;
+ std::bitset<3> axis_to_home;
+
struct {
+ uint8_t homing_order:6;
+ uint8_t bounce_cnt:4;
+ volatile char status:3;
bool is_corexy:1;
bool is_delta:1;
+ bool is_rdelta:1;
+ bool is_scara:1;
+ bool move_to_origin_after_home:1;
};
};
-
-#endif