1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-06 20:30:56 +02:00

Fixing Git Mess

This commit is contained in:
bdring
2020-10-23 15:18:52 -05:00
parent 3acc5c76cf
commit a247f72ae6
2 changed files with 265 additions and 276 deletions

View File

@@ -125,17 +125,17 @@ void machine_init() {
// DXL_CENTER,
// DXL_COUNT_MAX,
// DXL_COUNT_PER_RADIAN);
bool user_defined_homing() { // true = do not continue with normal Grbl homing
}
bool user_defined_homing() { // true = do not continue with normal Grbl homing
#ifdef USE_CUSTOM_HOMING
return true;
#else
return false;
#endif
}
}
// This function is used by Grbl
void inverse_kinematics(float* position) {
// This function is used by Grbl
void inverse_kinematics(float* position) {
float motor_angles[3];
read_settings();
@@ -143,11 +143,11 @@ void machine_init() {
position[0] = motor_angles[0];
position[1] = motor_angles[1];
position[2] = motor_angles[2];
}
}
// This function is used by Grbl
void inverse_kinematics(float* target, plan_line_data_t* pl_data, float* position) //The target and position are provided in MPos
{
// This function is used by Grbl
void inverse_kinematics(float* target, plan_line_data_t* pl_data, float* position) //The target and position are provided in MPos
{
float dx, dy, dz; // distances in each cartesian axis
float motor_angles[3];
@@ -225,10 +225,10 @@ void machine_init() {
}
}
}
}
}
// this is used used by Grbl soft limits to see if the range of the machine is exceeded.
uint8_t kinematic_limits_check(float* target) {
// this is used used by Grbl soft limits to see if the range of the machine is exceeded.
uint8_t kinematic_limits_check(float* target) {
float motor_angles[3];
read_settings();
@@ -252,11 +252,11 @@ void machine_init() {
}
return (status == KinematicError::NONE);
}
}
// inverse kinematics: cartesian -> angles
// returned status: 0=OK, -1=non-existing position
KinematicError delta_calcInverse(float* cartesian, float* angles) {
// inverse kinematics: cartesian -> angles
// returned status: 0=OK, -1=non-existing position
KinematicError delta_calcInverse(float* cartesian, float* angles) {
angles[0] = angles[1] = angles[2] = 0;
KinematicError status = KinematicError::NONE;
@@ -283,10 +283,10 @@ void machine_init() {
//grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "xyx (%4.3f,%4.3f,%4.3f) ang (%4.3f,%4.3f,%4.3f)", x0, y0, z0, theta1, theta2, theta3);
return status;
}
}
// inverse kinematics: angles -> cartesian
int calc_forward_kinematics(float* angles, float* catesian) {
// inverse kinematics: angles -> cartesian
int calc_forward_kinematics(float* angles, float* catesian) {
float t = (f - e) * tan30 / 2;
float y1 = -(t + rf * cos(angles[0]));
@@ -328,9 +328,9 @@ void machine_init() {
catesian[X_AXIS] = (a1 * catesian[Z_AXIS] + b1) / dnm;
catesian[Y_AXIS] = (a2 * catesian[Z_AXIS] + b2) / dnm;
return 0;
}
// helper functions, calculates angle theta1 (for YZ-pane)
KinematicError delta_calcAngleYZ(float x0, float y0, float z0, float& theta) {
}
// helper functions, calculates angle theta1 (for YZ-pane)
KinematicError delta_calcAngleYZ(float x0, float y0, float z0, float& theta) {
float y1 = -0.5 * 0.57735 * f; // f/2 * tg 30
y0 -= 0.5 * 0.57735 * e; // shift center to edge
// z = a + b*y
@@ -354,15 +354,15 @@ void machine_init() {
}
return KinematicError::NONE;
}
}
// Determine the unit distance between (2) 3D points
float three_axis_dist(float* point1, float* point2) {
// Determine the unit distance between (2) 3D points
float three_axis_dist(float* point1, float* point2) {
return sqrt(((point1[0] - point2[0]) * (point1[0] - point2[0])) + ((point1[1] - point2[1]) * (point1[1] - point2[1])) +
((point1[2] - point2[2]) * (point1[2] - point2[2])));
}
// called by reporting for WPos status
void forward_kinematics(float* position) {
}
// called by reporting for WPos status
void forward_kinematics(float* position) {
float calc_fwd[N_AXIS];
int status;
@@ -388,18 +388,18 @@ void machine_init() {
} else {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "MSG:Fwd Kin Error");
}
}
}
bool kinematics_pre_homing(uint8_t cycle_mask) { // true = do not continue with normal Grbl homing
bool kinematics_pre_homing(uint8_t cycle_mask) { // true = do not continue with normal Grbl homing
#ifdef USE_CUSTOM_HOMING
return true;
#else
//grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "kinematics_pre_homing");
return false;
#endif
}
}
void kinematics_post_homing() {
void kinematics_post_homing() {
#ifdef USE_CUSTOM_HOMING
#else
@@ -433,13 +433,13 @@ void machine_init() {
#ifdef USE_POST_HOMING_DELAY
delay(1000); // give time for servo type homing
#endif
}
}
void user_m30() {}
void user_m30() {}
void read_settings() {
void read_settings() {
rf = delta_crank_len->get(); // radius of the fixed side (length of motor cranks)
re = delta_link_len->get(); // radius of end effector side (length of linkages)
f = delta_crank_side_len->get(); // sized of fixed side triangel
e = delta_effector_side_len->get(); // size of end effector side triangle
}
}

View File

@@ -204,17 +204,6 @@ namespace Motors {
return;
}
float max_travel = axis_settings[_axis_index]->max_travel->get();
float mpos = axis_settings[_axis_index]->home_mpos->get();
if (bit_istrue(homing_dir_mask->get(), bit(_axis_index))) {
_position_min = mpos;
_position_max = mpos + max_travel;
} else {
_position_min = mpos - max_travel;
_position_max = mpos;
}
uint16_t run_i_ma = (uint16_t)(axis_settings[_axis_index]->run_current->get() * 1000.0);
float hold_i_percent;