Skip to content

Commit b1f92f5

Browse files
committed
Hangprinter: Allow Hangprinter to be configured with 6 anchors
1 parent b029339 commit b1f92f5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/Movement/Kinematics/HangprinterKinematics.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
constexpr size_t DefaultNumAnchors = 4;
2121
// Default anchor coordinates
2222
// These are only placeholders. Each machine must have these values calibrated in order to work correctly.
23-
constexpr float DefaultAnchors[5][3] = {{ 0.0, -2000.0, -100.0},
23+
constexpr float DefaultAnchors[6][3] = {{ 0.0, -2000.0, -100.0},
2424
{ 2000.0, 1000.0, -100.0},
2525
{-2000.0, 1000.0, -100.0},
2626
{ 0.0, 0.0, 3000.0},
27+
{ 0.0, 0.0, 0.0},
2728
{ 0.0, 0.0, 0.0}};
2829
constexpr float DefaultPrintRadius = 1500.0;
2930

@@ -83,13 +84,13 @@ void HangprinterKinematics::Init() noexcept
8384
* In practice you might want to compensate a bit more or a bit less */
8485
constexpr float DefaultSpoolBuildupFactor = 0.007;
8586
/* Measure and set spool radii with M669 to achieve better accuracy */
86-
constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default
87+
constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default
8788
/* If axis runs lines back through pulley system, set mechanical advantage accordingly with M669 */
88-
constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 4}; // HP4 default
89-
constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1}; // HP4 default
90-
constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20}; // HP4 default
91-
constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255}; // HP4 default
92-
constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25};
89+
constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 4}; // HP4 default
90+
constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1}; // HP4 default
91+
constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20}; // HP4 default
92+
constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255}; // HP4 default
93+
constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25};
9394
ARRAY_INIT(anchors, DefaultAnchors);
9495
numAnchors = DefaultNumAnchors;
9596
printRadius = DefaultPrintRadius;
@@ -167,6 +168,7 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const
167168
return true;
168169
}
169170
}
171+
170172
if (gb.Seen('P'))
171173
{
172174
printRadius = gb.GetFValue();
@@ -490,6 +492,7 @@ bool HangprinterKinematics::WriteCalibrationParameters(FileStore *f) const noexc
490492
{
491493
scratchString.catf("%c%.3f:%.3f:%.3f ", ANCHOR_CHARS[i], (double)anchors[i][X_AXIS], (double)anchors[i][Y_AXIS], (double)anchors[i][Z_AXIS]);
492494
}
495+
493496
if (!f->Write(scratchString.c_str()))
494497
{
495498
return false;
@@ -671,8 +674,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce
671674
HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException)
672675
{
673676
const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES;
674-
static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0 };
675-
static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
677+
static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0 };
678+
static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
676679
static size_t numSeenDrives = 0;
677680
size_t thisDriveIdx = 0;
678681

src/Movement/Kinematics/HangprinterKinematics.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class HangprinterKinematics : public RoundBedKinematics
5252

5353
private:
5454
// Basic facts about movement system
55-
const char* ANCHOR_CHARS = "ABCDE";
56-
static constexpr size_t HANGPRINTER_MAX_AXES = 5;
55+
const char* ANCHOR_CHARS = "ABCDEF";
56+
static constexpr size_t HANGPRINTER_MAX_AXES = 6;
5757
static constexpr size_t A_AXIS = 0;
5858
static constexpr size_t B_AXIS = 1;
5959
static constexpr size_t C_AXIS = 2;

0 commit comments

Comments
 (0)