✨ Polargraph / Makelangelo kinematics (#22790)
This commit is contained in:
committed by
Scott Lahteine
parent
71b8a22d96
commit
b3fd03198a
@ -132,7 +132,7 @@
|
||||
}
|
||||
|
||||
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
|
||||
report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_SCARA_S TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
|
||||
report_heading_etc(forReplay, PSTR(STR_SCARA_SETTINGS " (" STR_S_SEG_PER_SEC TERN_(HAS_SCARA_OFFSET, " " STR_SCARA_P_T_Z) ")"));
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR(" M665 S"), segments_per_second
|
||||
#if HAS_SCARA_OFFSET
|
||||
@ -143,6 +143,29 @@
|
||||
);
|
||||
}
|
||||
|
||||
#elif ENABLED(POLARGRAPH)
|
||||
|
||||
#include "../../module/polargraph.h"
|
||||
|
||||
/**
|
||||
* M665: Set POLARGRAPH settings
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* S[segments-per-second] - Segments-per-second
|
||||
*/
|
||||
void GcodeSuite::M665() {
|
||||
if (parser.seenval('S'))
|
||||
segments_per_second = parser.value_float();
|
||||
else
|
||||
M665_report();
|
||||
}
|
||||
|
||||
void GcodeSuite::M665_report(const bool forReplay/*=true*/) {
|
||||
report_heading_etc(forReplay, PSTR(STR_POLARGRAPH_SETTINGS " (" STR_S_SEG_PER_SEC ")"));
|
||||
SERIAL_ECHOLNPGM(" M665 S", segments_per_second);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // IS_KINEMATIC
|
||||
|
@ -26,22 +26,44 @@
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/servo.h"
|
||||
#include "../../module/planner.h"
|
||||
|
||||
/**
|
||||
* M280: Get or set servo position. P<index> [S<angle>]
|
||||
* M280: Get or set servo position.
|
||||
* P<index> - Servo index
|
||||
* S<angle> - Angle to set, omit to read current angle, or use -1 to detach
|
||||
*
|
||||
* With POLARGRAPH:
|
||||
* T<ms> - Duration of servo move
|
||||
*/
|
||||
void GcodeSuite::M280() {
|
||||
|
||||
if (!parser.seen('P')) return;
|
||||
if (!parser.seenval('P')) return;
|
||||
|
||||
TERN_(POLARGRAPH, planner.synchronize());
|
||||
|
||||
const int servo_index = parser.value_int();
|
||||
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
|
||||
if (parser.seen('S')) {
|
||||
const int a = parser.value_int();
|
||||
if (a == -1)
|
||||
DETACH_SERVO(servo_index);
|
||||
if (parser.seenval('S')) {
|
||||
const int anew = parser.value_int();
|
||||
if (anew >= 0) {
|
||||
#if ENABLED(POLARGRAPH)
|
||||
if (parser.seen('T')) { // (ms) Total duration of servo move
|
||||
const int16_t t = constrain(parser.value_int(), 0, 10000);
|
||||
const int aold = servo[servo_index].read();
|
||||
millis_t now = millis();
|
||||
const millis_t start = now, end = start + t;
|
||||
while (PENDING(now, end)) {
|
||||
safe_delay(50);
|
||||
now = _MIN(millis(), end);
|
||||
MOVE_SERVO(servo_index, LROUND(aold + (anew - aold) * (float(now - start) / t)));
|
||||
}
|
||||
}
|
||||
#endif // POLARGRAPH
|
||||
MOVE_SERVO(servo_index, anew);
|
||||
}
|
||||
else
|
||||
MOVE_SERVO(servo_index, a);
|
||||
DETACH_SERVO(servo_index);
|
||||
}
|
||||
else
|
||||
SERIAL_ECHO_MSG(" Servo ", servo_index, ": ", servo[servo_index].read());
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
void GcodeSuite::M282() {
|
||||
|
||||
if (!parser.seen('P')) return;
|
||||
if (!parser.seenval('P')) return;
|
||||
|
||||
const int servo_index = parser.value_int();
|
||||
if (WITHIN(servo_index, 0, NUM_SERVOS - 1))
|
||||
|
@ -885,8 +885,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 605: M605(); break; // M605: Set Dual X Carriage movement mode
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
case 665: M665(); break; // M665: Set delta configurations
|
||||
#if IS_KINEMATIC
|
||||
case 665: M665(); break; // M665: Set Delta/SCARA parameters
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
|
||||
|
@ -244,6 +244,7 @@
|
||||
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
|
||||
* M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
|
||||
* M665 - Set delta configurations: "M665 H<delta height> L<diagonal rod> R<delta radius> S<segments/s> B<calibration radius> X<Alpha angle trim> Y<Beta angle trim> Z<Gamma angle trim> (Requires DELTA)
|
||||
* Set SCARA configurations: "M665 S<segments-per-second> P<theta-psi-offset> T<theta-offset> Z<z-offset> (Requires MORGAN_SCARA or MP_SCARA)
|
||||
* M666 - Set/get offsets for delta (Requires DELTA) or dual endstops. (Requires [XYZ]_DUAL_ENDSTOPS)
|
||||
* M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires DUET_SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN)
|
||||
* M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
|
Reference in New Issue
Block a user