Revive SCARA's home offset (unimplemented)

This commit is contained in:
Scott Lahteine
2018-11-03 03:56:33 -05:00
parent 2c9586be0c
commit d1ff22b983
13 changed files with 193 additions and 140 deletions

View File

@ -66,32 +66,43 @@
* S[segments-per-second] - Segments-per-second
* P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle
* T[theta-offset] - Theta offset, added to the elbow (B/Y) angle
* Z[z-offset] - Z offset, added to Z
*
* A, P, and X are all aliases for the shoulder angle
* B, T, and Y are all aliases for the elbow angle
*/
void GcodeSuite::M665() {
if (parser.seen('S')) delta_segments_per_second = parser.value_float();
if (parser.seenval('S')) delta_segments_per_second = parser.value_float();
const bool hasA = parser.seen('A'), hasP = parser.seen('P'), hasX = parser.seen('X');
const uint8_t sumAPX = hasA + hasP + hasX;
if (sumAPX == 1)
home_offset[A_AXIS] = parser.value_float();
else if (sumAPX > 1) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
return;
}
#if HAS_SCARA_OFFSET
const bool hasB = parser.seen('B'), hasT = parser.seen('T'), hasY = parser.seen('Y');
const uint8_t sumBTY = hasB + hasT + hasY;
if (sumBTY == 1)
home_offset[B_AXIS] = parser.value_float();
else if (sumBTY > 1) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
return;
}
if (parser.seenval('Z')) scara_home_offset[Z_AXIS] = parser.value_linear_units();
const bool hasA = parser.seenval('A'), hasP = parser.seenval('P'), hasX = parser.seenval('X');
const uint8_t sumAPX = hasA + hasP + hasX;
if (sumAPX) {
if (sumAPX == 1)
scara_home_offset[A_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed.");
return;
}
}
const bool hasB = parser.seenval('B'), hasT = parser.seenval('T'), hasY = parser.seenval('Y');
const uint8_t sumBTY = hasB + hasT + hasY;
if (sumBTY) {
if (sumBTY == 1)
scara_home_offset[B_AXIS] = parser.value_float();
else {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed.");
return;
}
}
#endif // HAS_SCARA_OFFSET
}
#endif

View File

@ -20,6 +20,10 @@
*
*/
#include "../../inc/MarlinConfigPre.h"
#if HAS_SOFTWARE_ENDSTOPS
#include "../gcode.h"
#include "../../module/motion.h"
@ -46,3 +50,5 @@ void GcodeSuite::M211() {
SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_max[Y_AXIS]));
SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_max[Z_AXIS]));
}
#endif

View File

@ -483,7 +483,9 @@ void GcodeSuite::process_parsed_command(
#endif
#endif
case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#if HAS_SOFTWARE_ENDSTOPS
case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#endif
#if EXTRUDERS > 1
case 217: M217(); break; // M217: Set filament swap parameters

View File

@ -44,7 +44,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) {
const float diff = new_offset[i] - old_offset[i];
if (diff) {
position_shift[i] += diff;
update_software_endstops((AxisEnum)i);
update_workspace_offset((AxisEnum)i);
}
}
return true;

View File

@ -42,7 +42,7 @@ void GcodeSuite::G92() {
const float v = position_shift[i];
if (v) {
position_shift[i] = 0;
update_software_endstops((AxisEnum)i);
update_workspace_offset((AxisEnum)i);
}
}
#endif // Not SCARA
@ -79,7 +79,7 @@ void GcodeSuite::G92() {
}
else {
position_shift[i] += d; // Other axes simply offset the coordinate space
update_software_endstops((AxisEnum)i);
update_workspace_offset((AxisEnum)i);
}
#endif
}