From 22c347021104e586da37ae79be9a0521e793f4c0 Mon Sep 17 00:00:00 2001 From: Kevin Robert Keegan Date: Sun, 23 Aug 2020 16:05:39 -0700 Subject: [PATCH] Don't Detach During Calibrate Chain Lengths Detach is handled by the axis class and really shouldn't be used outside of that. The problem was that calibrate chains was spooling out more chain than it was supposed to, while reporting that it had done less that it was supposed to. This was caused by calling detach inside the calibrate chain length function. This caused the axis to stop moving before the endMove function had completed. As a result, the location was listed as being short of the desired termination point, but since the axis was agressively stopped, its own momemtum would carry it past where it was supposed to go. Solution was to remove detach call. Also changed print statement about the axis location, if we wanted to read the axis, we would have to block until the axis settled first. There is no need for this, we can report what the commanded length was. --- cnc_ctrl_v1/System.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cnc_ctrl_v1/System.cpp b/cnc_ctrl_v1/System.cpp index 92d59d73..fd75f00e 100644 --- a/cnc_ctrl_v1/System.cpp +++ b/cnc_ctrl_v1/System.cpp @@ -46,20 +46,16 @@ void calibrateChainLengths(String gcodeLine){ Serial.println(F("Measuring out left chain")); singleAxisMove(&leftAxis, sysSettings.originalChainLength, (sysSettings.maxFeed * .9)); - Serial.print(leftAxis.read()); + Serial.print(sysSettings.originalChainLength); Serial.println(F("mm")); - - leftAxis.detach(); } else if(extractGcodeValue(gcodeLine, 'R', 0)){ //measure out the right chain Serial.println(F("Measuring out right chain")); singleAxisMove(&rightAxis, sysSettings.originalChainLength, (sysSettings.maxFeed * .9)); - Serial.print(rightAxis.read()); + Serial.print(sysSettings.originalChainLength); Serial.println(F("mm")); - - rightAxis.detach(); } }