From 3e71fd5bccd70b1954e395956e166ba0952c1865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Wed, 7 Sep 2022 13:06:12 +0100 Subject: [PATCH] DEFECTIVE: Hangprinter: Allow Hangprinter to be configured with 7 anchors The response messages in M669 and M666 when sent empty won't fit The solution is started here: https://github.com/Duet3D/RepRapFirmware/pull/585#discussion_r973196192 --- .../Kinematics/HangprinterKinematics.cpp | 20 ++++++++++--------- .../Kinematics/HangprinterKinematics.h | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Movement/Kinematics/HangprinterKinematics.cpp b/src/Movement/Kinematics/HangprinterKinematics.cpp index 68d579352c..2c72a2f08b 100644 --- a/src/Movement/Kinematics/HangprinterKinematics.cpp +++ b/src/Movement/Kinematics/HangprinterKinematics.cpp @@ -20,11 +20,12 @@ constexpr size_t DefaultNumAnchors = 4; // Default anchor coordinates // These are only placeholders. Each machine must have these values calibrated in order to work correctly. -constexpr float DefaultAnchors[6][3] = {{ 0.0, -2000.0, -100.0}, +constexpr float DefaultAnchors[7][3] = {{ 0.0, -2000.0, -100.0}, { 2000.0, 1000.0, -100.0}, {-2000.0, 1000.0, -100.0}, { 0.0, 0.0, 3000.0}, { 0.0, 0.0, 0.0}, + { 0.0, 0.0, 0.0}, { 0.0, 0.0, 0.0}}; constexpr float DefaultPrintRadius = 1500.0; @@ -84,13 +85,13 @@ void HangprinterKinematics::Init() noexcept * In practice you might want to compensate a bit more or a bit less */ constexpr float DefaultSpoolBuildupFactor = 0.007; /* Measure and set spool radii with M669 to achieve better accuracy */ - constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default + constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default /* If axis runs lines back through pulley system, set mechanical advantage accordingly with M669 */ - constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 4}; // HP4 default - constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1}; // HP4 default - constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20}; // HP4 default - constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255}; // HP4 default - constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25}; + constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 2, 4}; // HP4 default + constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1, 1}; // HP4 default + constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20, 20}; // HP4 default + constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255, 255}; // HP4 default + constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25, 25}; ARRAY_INIT(anchors, DefaultAnchors); numAnchors = DefaultNumAnchors; printRadius = DefaultPrintRadius; @@ -183,6 +184,7 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const { Kinematics::Configure(mCode, gb, reply, error); reply.lcatf("P:Print radius: %.1f", (double)printRadius); + // TODO FIX messages are too long if there are 7 anchors or more for (size_t i = 0; i < numAnchors; ++i) { reply.lcatf("%c:%.2f, %.2f, %.2f", @@ -674,8 +676,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException) { const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES; - static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0 }; - static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0, 0 }; + static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; static size_t numSeenDrives = 0; size_t thisDriveIdx = 0; diff --git a/src/Movement/Kinematics/HangprinterKinematics.h b/src/Movement/Kinematics/HangprinterKinematics.h index f0ba31d332..341af8e8d8 100644 --- a/src/Movement/Kinematics/HangprinterKinematics.h +++ b/src/Movement/Kinematics/HangprinterKinematics.h @@ -52,8 +52,8 @@ class HangprinterKinematics : public RoundBedKinematics private: // Basic facts about movement system - const char* ANCHOR_CHARS = "ABCDEF"; - static constexpr size_t HANGPRINTER_MAX_AXES = 6; + const char* ANCHOR_CHARS = "ABCDEFH"; // Skip the G, since it is reserved in G-code + static constexpr size_t HANGPRINTER_MAX_AXES = 7; static constexpr size_t A_AXIS = 0; static constexpr size_t B_AXIS = 1; static constexpr size_t C_AXIS = 2;