|
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[8][3] = {{ 0.0, -2000.0, -100.0}, |
| 23 | +constexpr float DefaultAnchors[9][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 | 29 | { 0.0, 0.0, 0.0}, |
| 30 | + { 0.0, 0.0, 0.0}, |
30 | 31 | { 0.0, 0.0, 0.0}}; |
31 | 32 | constexpr float DefaultPrintRadius = 1500.0; |
32 | 33 |
|
@@ -86,13 +87,13 @@ void HangprinterKinematics::Init() noexcept |
86 | 87 | * In practice you might want to compensate a bit more or a bit less */ |
87 | 88 | constexpr float DefaultSpoolBuildupFactor = 0.007; |
88 | 89 | /* Measure and set spool radii with M669 to achieve better accuracy */ |
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 |
| 90 | + constexpr float DefaultSpoolRadii[HANGPRINTER_MAX_AXES] = { 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0, 75.0}; // HP4 default |
90 | 91 | /* If axis runs lines back through pulley system, set mechanical advantage accordingly with M669 */ |
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}; |
| 92 | + constexpr uint32_t DefaultMechanicalAdvantage[HANGPRINTER_MAX_AXES] = { 2, 2, 2, 2, 2, 2, 2, 2, 4}; // HP4 default |
| 93 | + constexpr uint32_t DefaultLinesPerSpool[HANGPRINTER_MAX_AXES] = { 1, 1, 1, 1, 1, 1, 1, 1, 1}; // HP4 default |
| 94 | + constexpr uint32_t DefaultMotorGearTeeth[HANGPRINTER_MAX_AXES] = { 20, 20, 20, 20, 20, 20, 20, 20, 20}; // HP4 default |
| 95 | + constexpr uint32_t DefaultSpoolGearTeeth[HANGPRINTER_MAX_AXES] = { 255, 255, 255, 255, 255, 255, 255, 255, 255}; // HP4 default |
| 96 | + constexpr uint32_t DefaultFullStepsPerMotorRev[HANGPRINTER_MAX_AXES] = { 25, 25, 25, 25, 25, 25, 25, 25, 25}; |
96 | 97 | ARRAY_INIT(anchors, DefaultAnchors); |
97 | 98 | numAnchors = DefaultNumAnchors; |
98 | 99 | printRadius = DefaultPrintRadius; |
@@ -214,6 +215,14 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
214 | 215 | return true; |
215 | 216 | } |
216 | 217 | } |
| 218 | + if (numAnchors > 8) |
| 219 | + { |
| 220 | + if (gb.TryGetFloatArray('I', 3, anchors[I_AXIS], reply, seen)) |
| 221 | + { |
| 222 | + error = true; |
| 223 | + return true; |
| 224 | + } |
| 225 | + } |
217 | 226 |
|
218 | 227 | if (gb.Seen('P')) |
219 | 228 | { |
@@ -260,6 +269,11 @@ bool HangprinterKinematics::Configure(unsigned int mCode, GCodeBuffer& gb, const |
260 | 269 | reply.lcatf("H:%.2f, %.2f, %.2f\n", |
261 | 270 | (double)anchors[H_AXIS][X_AXIS], (double)anchors[H_AXIS][Y_AXIS], (double)anchors[H_AXIS][Z_AXIS]); |
262 | 271 | } |
| 272 | + if (numAnchors > 8) |
| 273 | + { |
| 274 | + reply.lcatf("I:%.2f, %.2f, %.2f\n", |
| 275 | + (double)anchors[I_AXIS][X_AXIS], (double)anchors[I_AXIS][Y_AXIS], (double)anchors[I_AXIS][Z_AXIS]); |
| 276 | + } |
263 | 277 | } |
264 | 278 | } |
265 | 279 | else if (mCode == 666) |
@@ -605,6 +619,16 @@ bool HangprinterKinematics::WriteCalibrationParameters(FileStore *f) const noexc |
605 | 619 | } |
606 | 620 | } |
607 | 621 |
|
| 622 | + if (numAnchors > 8) |
| 623 | + { |
| 624 | + scratchString.printf(" I%.3f:%.3f:%.3f", |
| 625 | + (double)anchors[I_AXIS][X_AXIS], (double)anchors[I_AXIS][Y_AXIS], (double)anchors[I_AXIS][Z_AXIS]); |
| 626 | + if (!f->Write(scratchString.c_str())) |
| 627 | + { |
| 628 | + return false; |
| 629 | + } |
| 630 | + } |
| 631 | + |
608 | 632 | scratchString.printf(" P%.1f\n", (double)printRadius); |
609 | 633 | if (!f->Write(scratchString.c_str())) |
610 | 634 | { |
@@ -821,8 +845,8 @@ void HangprinterKinematics::PrintParameters(const StringRef& reply) const noexce |
821 | 845 | HangprinterKinematics::ODriveAnswer HangprinterKinematics::GetODrive3EncoderEstimate(DriverId const driver, bool const makeReference, const StringRef& reply, bool const subtractReference) THROWS(GCodeException) |
822 | 846 | { |
823 | 847 | const uint8_t cmd = CANSimple::MSG_GET_ENCODER_ESTIMATES; |
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 }; |
| 848 | + static CanAddress seenDrives[HANGPRINTER_MAX_AXES] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 849 | + static float referencePositions[HANGPRINTER_MAX_AXES] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; |
826 | 850 | static size_t numSeenDrives = 0; |
827 | 851 | size_t thisDriveIdx = 0; |
828 | 852 |
|
|
0 commit comments