|
20 | 20 | constexpr size_t DefaultNumAnchors = 4; |
21 | 21 | // Default anchor coordinates |
22 | 22 | // These are only placeholders. Each machine must have these values calibrated in order to work correctly. |
23 | | -constexpr float DefaultAnchors[7][3] = {{ 0.0, -2000.0, -100.0}, |
| 23 | +constexpr float DefaultAnchors[8][3] = {{ 0.0, -2000.0, -100.0}, |
24 | 24 | { 2000.0, 1000.0, -100.0}, |
25 | 25 | {-2000.0, 1000.0, -100.0}, |
26 | 26 | { 0.0, 0.0, 3000.0}, |
27 | 27 | { 0.0, 0.0, 0.0}, |
28 | 28 | { 0.0, 0.0, 0.0}, |
| 29 | + { 0.0, 0.0, 0.0}, |
29 | 30 | { 0.0, 0.0, 0.0}}; |
30 | 31 | constexpr float DefaultPrintRadius = 1500.0; |
31 | 32 |
|
@@ -85,13 +86,13 @@ void HangprinterKinematics::Init() noexcept |
85 | 86 | * In practice you might want to compensate a bit more or a bit less */ |
86 | 87 | constexpr float DefaultSpoolBuildupFactor = 0.007; |
87 | 88 | /* Measure and set spool radii with M669 to achieve better accuracy */ |
88 | | - constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default |
| 89 | + constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default |
89 | 90 | /* If axis runs lines back through pulley system, set mechanical advantage accordingly with M669 */ |
90 | | - constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 2, 4}; // HP4 default |
91 | | - constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1, 1}; // HP4 default |
92 | | - constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20, 20}; // HP4 default |
93 | | - constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255, 255}; // HP4 default |
94 | | - constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25, 25}; |
| 91 | + constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 2, 2, 4}; // HP4 default |
| 92 | + constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1, 1, 1}; // HP4 default |
| 93 | + constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20, 20, 20}; // HP4 default |
| 94 | + constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255, 255, 255}; // HP4 default |
| 95 | + constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25, 25, 25}; |
95 | 96 | ARRAY_INIT(anchors, DefaultAnchors); |
96 | 97 | numAnchors = DefaultNumAnchors; |
97 | 98 | printRadius = DefaultPrintRadius; |
@@ -205,6 +206,14 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
205 | 206 | return true; |
206 | 207 | } |
207 | 208 | } |
| 209 | + if (numAnchors > 7) |
| 210 | + { |
| 211 | + if (gb.TryGetFloatArray('H', 3, anchors[H_AXIS], reply, seen)) |
| 212 | + { |
| 213 | + error = true; |
| 214 | + return true; |
| 215 | + } |
| 216 | + } |
208 | 217 |
|
209 | 218 | if (gb.Seen('P')) |
210 | 219 | { |
@@ -246,6 +255,11 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
246 | 255 | reply.lcatf("G:%.2f, %.2f, %.2f\n", |
247 | 256 | (double)anchors[G_AXIS][X_AXIS], (double)anchors[G_AXIS][Y_AXIS], (double)anchors[G_AXIS][Z_AXIS]); |
248 | 257 | } |
| 258 | + if (numAnchors > 7) |
| 259 | + { |
| 260 | + reply.lcatf("H:%.2f, %.2f, %.2f\n", |
| 261 | + (double)anchors[H_AXIS][X_AXIS], (double)anchors[H_AXIS][Y_AXIS], (double)anchors[H_AXIS][Z_AXIS]); |
| 262 | + } |
249 | 263 | } |
250 | 264 | } |
251 | 265 | else if (mCode == 666) |
@@ -581,6 +595,16 @@ bool HangprinterKinematics::WriteCalibrationParameters(FileStore *f) const noexc |
581 | 595 | } |
582 | 596 | } |
583 | 597 |
|
| 598 | + if (numAnchors > 7) |
| 599 | + { |
| 600 | + scratchString.printf(" H%.3f:%.3f:%.3f", |
| 601 | + (double)anchors[H_AXIS][X_AXIS], (double)anchors[H_AXIS][Y_AXIS], (double)anchors[H_AXIS][Z_AXIS]); |
| 602 | + if (!f->Write(scratchString.c_str())) |
| 603 | + { |
| 604 | + return false; |
| 605 | + } |
| 606 | + } |
| 607 | + |
584 | 608 | scratchString.printf(" P%.1f\n", (double)printRadius); |
585 | 609 | if (!f->Write(scratchString.c_str())) |
586 | 610 | { |
@@ -797,8 +821,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce |
797 | 821 | HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException) |
798 | 822 | { |
799 | 823 | const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES; |
800 | | - static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0, 0 }; |
801 | | - static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; |
| 824 | + static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 825 | + static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; |
802 | 826 | static size_t numSeenDrives = 0; |
803 | 827 | size_t thisDriveIdx = 0; |
804 | 828 |
|
|
0 commit comments