|
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[5][3] = {{ 0.0, -2000.0, -100.0}, |
| 23 | +constexpr float DefaultAnchors[6][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 | + { 0.0, 0.0, 0.0}, |
27 | 28 | { 0.0, 0.0, 0.0}}; |
28 | 29 | constexpr float DefaultPrintRadius = 1500.0; |
29 | 30 |
|
@@ -83,13 +84,13 @@ void HangprinterKinematics::Init() noexcept |
83 | 84 | * In practice you might want to compensate a bit more or a bit less */ |
84 | 85 | constexpr float DefaultSpoolBuildupFactor = 0.007; |
85 | 86 | /* 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 |
87 | 88 | /* 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}; |
93 | 94 | ARRAY_INIT(anchors, DefaultAnchors); |
94 | 95 | numAnchors = DefaultNumAnchors; |
95 | 96 | printRadius = DefaultPrintRadius; |
@@ -187,6 +188,14 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
187 | 188 | return true; |
188 | 189 | } |
189 | 190 | } |
| 191 | + if (numAnchors > 5) |
| 192 | + { |
| 193 | + if (gb.TryGetFloatArray('F', 3, anchors[F_AXIS], reply, seen)) |
| 194 | + { |
| 195 | + error = true; |
| 196 | + return true; |
| 197 | + } |
| 198 | + } |
190 | 199 |
|
191 | 200 | if (gb.Seen('P')) |
192 | 201 | { |
@@ -218,6 +227,11 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
218 | 227 | reply.lcatf("E:%.2f, %.2f, %.2f\n", |
219 | 228 | (double)anchors[E_AXIS][X_AXIS], (double)anchors[E_AXIS][Y_AXIS], (double)anchors[E_AXIS][Z_AXIS]); |
220 | 229 | } |
| 230 | + if (numAnchors > 5) |
| 231 | + { |
| 232 | + reply.lcatf("F:%.2f, %.2f, %.2f\n", |
| 233 | + (double)anchors[F_AXIS][X_AXIS], (double)anchors[F_AXIS][Y_AXIS], (double)anchors[F_AXIS][Z_AXIS]); |
| 234 | + } |
221 | 235 | } |
222 | 236 | } |
223 | 237 | else if (mCode == 666) |
@@ -533,6 +547,16 @@ bool HangprinterKinematics::WriteCalibrationParameters(FileStore *f) const noexc |
533 | 547 | } |
534 | 548 | } |
535 | 549 |
|
| 550 | + if (numAnchors > 5) |
| 551 | + { |
| 552 | + scratchString.printf(" F%.3f:%.3f:%.3f", |
| 553 | + (double)anchors[F_AXIS][X_AXIS], (double)anchors[F_AXIS][Y_AXIS], (double)anchors[F_AXIS][Z_AXIS]); |
| 554 | + if (!f->Write(scratchString.c_str())) |
| 555 | + { |
| 556 | + return false; |
| 557 | + } |
| 558 | + } |
| 559 | + |
536 | 560 | scratchString.printf(" P%.1f\n", (double)printRadius); |
537 | 561 | if (!f->Write(scratchString.c_str())) |
538 | 562 | { |
@@ -749,8 +773,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce |
749 | 773 | HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException) |
750 | 774 | { |
751 | 775 | const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES; |
752 | | - static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0 }; |
753 | | - static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0 }; |
| 776 | + static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0 }; |
| 777 | + static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; |
754 | 778 | static size_t numSeenDrives = 0; |
755 | 779 | size_t thisDriveIdx = 0; |
756 | 780 |
|
|
0 commit comments