diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-11 21:57:55 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-11 21:57:55 +0300 |
commit | 82d14c198d7b61005093b2b06457d83435a76564 (patch) | |
tree | 6c4f5e994b7e3d620b871f2a79f5ab3e1b4a2612 /src/Platform/Platform.cpp | |
parent | b472db8b61e4b5123fe10b6450bf18c72c91ff00 (diff) |
Fixed issue with extruder stopping after a tiny move
Also refactored nonlinear extrusion coce to make it more efficient
Diffstat (limited to 'src/Platform/Platform.cpp')
-rw-r--r-- | src/Platform/Platform.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 259eae32..8aafab9a 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -313,9 +313,9 @@ constexpr ObjectModelTableEntry Platform::objectModelTable[] = { "stepsPerMm", OBJECT_MODEL_FUNC(self->driveStepsPerUnit[ExtruderToLogicalDrive(context.GetLastIndex())], 2), ObjectModelEntryFlags::none }, // 5. move.extruders[].nonlinear members - { "a", OBJECT_MODEL_FUNC(self->nonlinearExtrusionA[context.GetLastIndex()], 3), ObjectModelEntryFlags::none }, - { "b", OBJECT_MODEL_FUNC(self->nonlinearExtrusionB[context.GetLastIndex()], 3), ObjectModelEntryFlags::none }, - { "upperLimit", OBJECT_MODEL_FUNC(self->nonlinearExtrusionLimit[context.GetLastIndex()], 2), ObjectModelEntryFlags::none }, + { "a", OBJECT_MODEL_FUNC(self->nonlinearExtrusion[context.GetLastIndex()].A, 3), ObjectModelEntryFlags::none }, + { "b", OBJECT_MODEL_FUNC(self->nonlinearExtrusion[context.GetLastIndex()].B, 3), ObjectModelEntryFlags::none }, + { "upperLimit", OBJECT_MODEL_FUNC(self->nonlinearExtrusion[context.GetLastIndex()].limit, 2), ObjectModelEntryFlags::none }, #if HAS_12V_MONITOR // 6. v12 members @@ -694,8 +694,8 @@ void Platform::Init() noexcept extruderDrivers[extr].SetLocal(extr + MinAxes); // set up default extruder drive mapping driveDriverBits[ExtruderToLogicalDrive(extr)] = StepPins::CalcDriverBitmap(extr + MinAxes); #if SUPPORT_NONLINEAR_EXTRUSION - nonlinearExtrusionA[extr] = nonlinearExtrusionB[extr] = 0.0; - nonlinearExtrusionLimit[extr] = DefaultNonlinearExtrusionLimit; + nonlinearExtrusion[extr].A = nonlinearExtrusion[extr].B = 0.0; + nonlinearExtrusion[extr].limit = DefaultNonlinearExtrusionLimit; #endif } @@ -3709,25 +3709,13 @@ void Platform::AtxPowerOff() noexcept #if SUPPORT_NONLINEAR_EXTRUSION -bool Platform::GetExtrusionCoefficients(size_t extruder, float& a, float& b, float& limit) const noexcept -{ - if (extruder < MaxExtruders) - { - a = nonlinearExtrusionA[extruder]; - b = nonlinearExtrusionB[extruder]; - limit = nonlinearExtrusionLimit[extruder]; - return true; - } - return false; -} - void Platform::SetNonlinearExtrusion(size_t extruder, float a, float b, float limit) noexcept { - if (extruder < MaxExtruders && nonlinearExtrusionLimit[extruder] > 0.0) + if (extruder < MaxExtruders && limit > 0.0) { - nonlinearExtrusionLimit[extruder] = limit; - nonlinearExtrusionA[extruder] = a; - nonlinearExtrusionB[extruder] = b; + nonlinearExtrusion[extruder].limit = limit; + nonlinearExtrusion[extruder].A = a; + nonlinearExtrusion[extruder].B = b; } } |