|
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[6][3] = {{ 0.0, -2000.0, -100.0}, |
| 23 | +constexpr float DefaultAnchors[7][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 | + { 0.0, 0.0, 0.0}, |
28 | 29 | { 0.0, 0.0, 0.0}}; |
29 | 30 | constexpr float DefaultPrintRadius = 1500.0; |
30 | 31 |
|
@@ -84,13 +85,13 @@ void HangprinterKinematics::Init() noexcept |
84 | 85 | * In practice you might want to compensate a bit more or a bit less */ |
85 | 86 | constexpr float DefaultSpoolBuildupFactor = 0.007; |
86 | 87 | /* Measure and set spool radii with M669 to achieve better accuracy */ |
87 | | - constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default |
| 88 | + constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default |
88 | 89 | /* If axis runs lines back through pulley system, set mechanical advantage accordingly with M669 */ |
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}; |
| 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}; |
94 | 95 | ARRAY_INIT(anchors, DefaultAnchors); |
95 | 96 | numAnchors = DefaultNumAnchors; |
96 | 97 | printRadius = DefaultPrintRadius; |
@@ -196,6 +197,14 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
196 | 197 | return true; |
197 | 198 | } |
198 | 199 | } |
| 200 | + if (numAnchors > 6) |
| 201 | + { |
| 202 | + if (gb.TryGetFloatArray('G', 3, anchors[G_AXIS], reply, seen)) |
| 203 | + { |
| 204 | + error = true; |
| 205 | + return true; |
| 206 | + } |
| 207 | + } |
199 | 208 |
|
200 | 209 | if (gb.Seen('P')) |
201 | 210 | { |
@@ -232,6 +241,11 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
232 | 241 | reply.lcatf("F:%.2f, %.2f, %.2f\n", |
233 | 242 | (double)anchors[F_AXIS][X_AXIS], (double)anchors[F_AXIS][Y_AXIS], (double)anchors[F_AXIS][Z_AXIS]); |
234 | 243 | } |
| 244 | + if (numAnchors > 6) |
| 245 | + { |
| 246 | + reply.lcatf("G:%.2f, %.2f, %.2f\n", |
| 247 | + (double)anchors[G_AXIS][X_AXIS], (double)anchors[G_AXIS][Y_AXIS], (double)anchors[G_AXIS][Z_AXIS]); |
| 248 | + } |
235 | 249 | } |
236 | 250 | } |
237 | 251 | else if (mCode == 666) |
@@ -557,6 +571,16 @@ bool HangprinterKinematics::WriteCalibrationParameters(FileStore *f) const noexc |
557 | 571 | } |
558 | 572 | } |
559 | 573 |
|
| 574 | + if (numAnchors > 6) |
| 575 | + { |
| 576 | + scratchString.printf(" G%.3f:%.3f:%.3f", |
| 577 | + (double)anchors[G_AXIS][X_AXIS], (double)anchors[G_AXIS][Y_AXIS], (double)anchors[G_AXIS][Z_AXIS]); |
| 578 | + if (!f->Write(scratchString.c_str())) |
| 579 | + { |
| 580 | + return false; |
| 581 | + } |
| 582 | + } |
| 583 | + |
560 | 584 | scratchString.printf(" P%.1f\n", (double)printRadius); |
561 | 585 | if (!f->Write(scratchString.c_str())) |
562 | 586 | { |
@@ -773,8 +797,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce |
773 | 797 | HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException) |
774 | 798 | { |
775 | 799 | const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES; |
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 }; |
| 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 }; |
778 | 802 | static size_t numSeenDrives = 0; |
779 | 803 | size_t thisDriveIdx = 0; |
780 | 804 |
|
|
0 commit comments