Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-10-07 15:49:04 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-10-07 15:49:04 +0300
commit03866e859459857a2b8fc0570465f631f15f6c50 (patch)
treea3ef0d467a5ab0027fcdf60fd2d5201727f19d94 /src/Movement
parente1db9ab1d7d2abe2956b3acf101b352e4b0ea6a6 (diff)
Don't reset TMC2660 microstep position if driver has been disabled
Diffstat (limited to 'src/Movement')
-rw-r--r--src/Movement/StepperDrivers/TMC2660.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/Movement/StepperDrivers/TMC2660.cpp b/src/Movement/StepperDrivers/TMC2660.cpp
index eb55820f..5f042865 100644
--- a/src/Movement/StepperDrivers/TMC2660.cpp
+++ b/src/Movement/StepperDrivers/TMC2660.cpp
@@ -1095,28 +1095,32 @@ namespace SmartDrivers
bool moreNeeded = false;
for (size_t i = 0; i < numTmc2660Drivers; ++i)
{
- uint32_t count = driverStates[i].ReadMicrostepPosition();
- if (count != 0)
+ // The following line assumes that driver numbers in RRF map directly to smart driver numbers in this module. They do on Duets.
+ if (reprap.GetPlatform().GetEnableValue(i) >= 0) // if the driver has not been disabled
{
- moreNeeded = true;
- if (count < 1024)
+ uint32_t count = driverStates[i].ReadMicrostepPosition();
+ if (count != 0)
{
- const bool backwards = (count > 512);
- reprap.GetPlatform().SetDriverAbsoluteDirection(i, backwards); // a high on DIR decreases the microstep counter
- if (backwards)
+ moreNeeded = true;
+ if (count < 1024)
{
- count = 1024 - count;
+ const bool backwards = (count > 512);
+ reprap.GetPlatform().SetDriverAbsoluteDirection(i, backwards); // a high on DIR decreases the microstep counter
+ if (backwards)
+ {
+ count = 1024 - count;
+ }
+ do
+ {
+ delayMicroseconds(1);
+ const uint32_t driverBitmap = StepPins::CalcDriverBitmap(i);
+ StepPins::StepDriversHigh(driverBitmap);
+ delayMicroseconds(1);
+ StepPins::StepDriversLow(driverBitmap);
+ --count;
+ } while (count != 0);
+ driverStates[i].ClearMicrostepPosition();
}
- do
- {
- delayMicroseconds(1);
- const uint32_t driverBitmap = StepPins::CalcDriverBitmap(i);
- StepPins::StepDriversHigh(driverBitmap);
- delayMicroseconds(1);
- StepPins::StepDriversLow(driverBitmap);
- --count;
- } while (count != 0);
- driverStates[i].ClearMicrostepPosition();
}
}
}