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
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2018-01-02 22:36:09 +0300
committerDavid Crocker <dcrocker@eschertech.com>2018-01-02 22:36:22 +0300
commit1ecf339d585999ff7bad9a5cbf475a18c67a66a1 (patch)
tree2b1aa550b31e821c8915dbecbef41a5b55cc336a /src
parentddcc69d950827052079cf6927721e23b41453eb5 (diff)
Version 1.20.1RC2
Added nonlineear extrusion support (M592) Show calibration parameters in M592 D# response Bug fix: don't run stop.g, sleep.g or cancel.g at the end of simulating a print or cancelling a simulation
Diffstat (limited to 'src')
-rw-r--r--src/BugList.txt185
-rw-r--r--src/Configuration.h2
-rw-r--r--src/FilamentSensors/Duet3DFilamentSensor.cpp16
-rw-r--r--src/FilamentSensors/FilamentSensor.cpp8
-rw-r--r--src/FilamentSensors/FilamentSensor.h4
-rw-r--r--src/GCodes/GCodes.cpp35
-rw-r--r--src/GCodes/GCodes2.cpp45
-rw-r--r--src/Movement/DriveMovement.cpp18
-rw-r--r--src/Movement/DriveMovement.h2
-rw-r--r--src/Pins.h4
-rw-r--r--src/Platform.cpp33
-rw-r--r--src/Platform.h8
-rw-r--r--src/Version.h4
13 files changed, 137 insertions, 227 deletions
diff --git a/src/BugList.txt b/src/BugList.txt
deleted file mode 100644
index d6c28da8..00000000
--- a/src/BugList.txt
+++ /dev/null
@@ -1,185 +0,0 @@
-RRF 1.20 work list
-
-- Logging
-- [done] Fix message "...before homing the towers of a Delta or SCARA printer"
-- [done] M552 option to connect to specified access point on Duet WiFi, including hidden SSIDs
-- [done] Ian's pressure advance issue, https://www.duet3d.com/forum/thread.php?pid=24928#p24928
-- [done] Add "USB will disconnect during firmware update" message
-- [done] Fix duplicate error message when we fail to open a gcode file
-- [done, needs testing] M572 S0.4 D0:1:2:3:4
-- [done, needs testing] Keep 2 grids: the one defined by M577, and the one used by the current grid (e.g. loaded with a height map)
-- [done] Enable pullups on CONN_LCD endstop inputs
-- [done] Bug fix to bed probing bug on SCARA (skips points that it shouldn't skip)
-- [done] Support manual bed adjustment on SCARA kinematics
-- [done] Ignore correction limits for manual bed adjustment
-- [done] SCARA: don't allow mode change for coordinated move
-- [done] SCARA: apply arm limits when converting coordinates
-- [done] when simulating a print, never create or delete resurrect.g
-- [done] when simulating, don't segment
-- [done] Bug fix: missing P parameter in G10 command in resurrect.g
-- [done] When temperature is within 3C of target, switch to fast PID parameters
-
-Above done in 1.20beta1
-
-- [done] G31 parameters no longer written to config-override.g
-- [done] multiple G and M commands on a single line
-- [done] SCARA: do the conversion during the request to limit coordinates, cache result for use if we are asked to do it (need coordinates/uncoordinated flag to 'isReachable')
-- [done] add log entry for time/date set
-- [done] log "max open file count exceeded" message
-- [done] Send heater 0 values to PanelDue even if no heated bed
-- [done] In resurrect.g move up, sideways and down when restoring position
-- [done] SCARA: movement is slow at start, and is still jerky after that
-- [coolstep done] Experimental configurable Stallguard detection + configurable Coolstep (M915)
-- [done] Easier way to resume a print (M916)
-- [done] Power off pause: stop immediately. Need to do a partial move on restart. Or repeat the whole move, from the start of the first segment.
-- [done, needs testing] Pause print on heater error
-- [done] include G- or M-code in error messages
-- [done] when tuning, use specified max pwm if given, or old max pwm if not
-- [done] Increase ADC oversample bits to 2
-- [done] Display wifi sleep mode
-- [done] M114 remove space after colon for Pronterface
-- [done] Parameter R-1 in M569 command disables driver monitoring
-- [done] Implement M585
-- [done] if axis lengths are adjusted by probing, M500 should save them in config-override.g
-- [done] if tool offsets are adjusted by probing, M500 should save them in config-override.g
-- [done] consider using a better way of counting layers
-- [done] debug messages are prevented from causing software watchdog resets
-- [done] limit axis speeds properly in corexy
-- [done] polar kinematics initial support
-- [done] faster short-to-ground detection
-- [done] rr_ command parameters are order-independent
-- [done] Duet WiFi: more network debug info
-- [done] "Bed probe heights" in M122 -> "G32 bed probe heights"
-
-Above done in 1.20beta2
-
-Bugs fixed in beta 3:
-- config-override.g extra M307 lines
-- CoreXY homing was broken
-- motor idle detection was broken
-- M585 didn't work
-- Can't resume if no M911 command used
-- prints diagnostics if you send a command with the string 122 in it
-
-Done in beta3:
-- when a print is cancelled, don't send 'finished printing file ...." message, just the cancel message
-
-Done in beta4+1:
-- PT100 reference resistor configuration
-- PT100 3-wire config supported
-- M906 and M913 don't wait for movement to stop
-- Endstop types changed. For Ormerod/Mendel/Huxley need to change M574 command. XYZ parameters removed from M558.
-- Bug fix: 31856 thermocouple code buffer overflow in SPI read
-
-Done in beta 6:
-- Stall detection: get it usable
-- Allow ABC to be created without creating XYZ, for CNC applications
-- Stall detection: option to log stalls but take no other action
-- Send axis names to DWC and PanelDue
-
-Done in 1.20beta7:
-- Optional quotes around filenames etc.
-- Always use gcode queue when executing macros
-- Pausing: IsPausing etc. need to take account of all gcode sources, not just fileGCode
-- M0/M1 don't turn off heaters and drives when in simulation mode
-- SCARA crosstalk to be in movement amount not steps
-- SCARA homing didn't take account of crosstalk
-- deleteexisting=yes option in http move command
-- in M589 the IP address should be compulsory
-- feed rate wasn't being passed to fileGCode when resuming a print
-- when a T command is sent, make sure the tool heaters are turned on
-- support CWD . in FTP
-- [tested, ok] test resurrect in absolute extrusion mode - does the M82/83 apply to the wrong gcode source?
-
-Done in 1.20beta8:
-- [done, ok] Command to activate the tool that was active at a pause (T R1?)
-- [done, ok] Stall detection: implement R2 R3
-- [done] Compensate extruder heater power for supply voltage
-- [done] in M587 and M589 report the IP addresses
-- [done] sensorless homing: for corexy monitor both X and Y
-- [done, ok] can pause within segmented moves
-- [done] add log entries for undervoltage, overvoltage
-- [done, test] log overheating drivers
-- [done, ok] log M81 power off
-- [done, ok] M562 with no parameter clears all heater faults
-- [done, ok] support mixed analog/digital write on SX1509B pins
-- [done] Bug fix to M26 P parameter on resume after power fail
-
-Done in 1.20beta10:
-- [done, test] Heater fault timeout to cancelling print to be configurable
-- [done] Filament monitor always updates calibration accumulators during a print even if not in calbration mode
-- [done] Added CoreXYUV
-- [done] improved square root timing
-- [done] added Z probe types 7 and 8
-- [done] bug fix: semicolons inside quoted strings were still stripped out from some gcode sources
-- [done] Bug fix: giving silly numbers of microsteps in M350 messed up the steps/mm
-- [done] Bug fix: High microstepping and high acceleration on deltas led to poor timing in deceleration phase and high MaxReps
-- [done] Bug fix: The commands in tool change macro files were sometimes not fully executed before the next action
-- [done] Bug fix to speed limits in CoreXYU
-- [done] Possible bug fix: avoid race condition in TMC SPI ISR
-
-Done in 1.20beta11:
-- [done, ok] On filament error, doesn't print the right message in the box
-- [done, ok] Layer shift reports (new in beta 10)
-- [done, ok] Report of watchdog resets (from 1.20beta7)
-- [done, ok] Add test report: test voltage readings, stepper driver status, SD card interface speed, and report processor ID
-- [done] M92, M201 etc. to work on all axes, not just visible axes
-
-Done in 1.20RC1:
-- [ask him to test it again] Ian's report of strange M584 P behaviour, https://www.duet3d.com/forum/thread.php?pid=31469#p31469
-- [done] Ian's report of M109 Z movement issue, see https://www.duet3d.com/forum/thread.php?pid=31542#p31542
-- [done, test] M109/M104 tool selection and temperature setting
-- [done, ok] On filament error, doesn't log the message
-- [done, ok] On filament error, only pops up a message box once
-- [done] Chrishamm's responder bug fix
-- [done, ok] Z probe type 5 didn't work on Duet 085
-- [done, ok] WPA2 password check minimum 8 characters
-- [done, test] M500 doesn't save axis lengths found by G1 S3
-- [done, ok] display SG load register in M122
-- [done, ok] Variable heater PWM frequency
-- [done, ok] changed calculation of PID parameters for faster heatup
-- [done, ok] Added M81 S parameter
-- [done, ok so far] card detect
-- [done, ok] Protection against deleting an open file especially a log file
-
-Remaining after RC1:
-- Fix for pressure advance script https://www.duet3d.com/forum/thread.php?pid=32107#p32107
-- Allow longer M587 commands
-- Heater PWM frequency limit
-- Heater tuning doesn't start, says the header is not ready
-- M29 didn't work
-- Record time of last software reset, more stack, and whether it was deliberate
-- Free up memory esp. on Duet085 build
-
-Remaining:
-- [done] ADC low and high offsets are no longer divided by 2 compared to previously
-- PT1000 support
-- If no temp sensor configured, M305 Px should say so instead of allocating a thermistor
-- Document heater protection
-- Document multiple bed and chamber heaters
-
-Investigations:
-
-[done, waiting forvever for SD card] Investigate https://www.duet3d.com/forum/thread.php?pid=32237#p32237
-[done] https://www.duet3d.com/forum/thread.php?pid=30414#p30414 (watchdog reset)
-[can't reproduce] https://www.duet3d.com/forum/thread.php?pid=28210#p28210 (pressure advance causes over extrusion)
-[done] https://www.duet3d.com/forum/thread.php?pid=28255#p28255 (tool change problem)
-[done] https://www.duet3d.com/forum/thread.php?pid=30431#p30431 (bed probing inaccurate)
-[can't reproduce] https://www.duet3d.com/forum/thread.php?pid=30799#p30799 (step errors at high E steps/mm)
-[no fault] https://www.duet3d.com/forum/thread.php?pid=30851#p30851 (split axis motor goes the wrong way)
-[done BUT still wrong in lwip 2] inconsistend oversize vs. len
-p->ref == 1 in WiFi
-
-Later versions:
-
-- Use M140H1:2:3 to set multiple bed heater numbers
-- Option to not broadcast SSID?
-- Support faster homing by using interrupts to check homing switch states
-- Implement G1 S4? (like S2 but always relative)
-- Add work coordinates? https://www.duet3d.com/forum/thread.php?pid=27128#p27128
-- Don't do presure advance during accel/decel of sequences of short segments
-- Axis limits on arc moves
-- Arc move with same finish and start coordinates to do complete circle
-- Add T parameter to M207
-- look at supporting SIZE in FTP
-- Make mp.delta.hmz0sK, hmz0scK and dsk 64-bit in SAM4E versions, to increase movement limit - also increase K2?
diff --git a/src/Configuration.h b/src/Configuration.h
index 04fb18b4..7ad46ac3 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -220,6 +220,8 @@ constexpr float DefaultArcSegmentLength = 0.2; // G2 and G3 arc movement comma
constexpr uint32_t DefaultIdleTimeout = 30000; // Milliseconds
constexpr float DefaultIdleCurrentFactor = 0.3; // Proportion of normal motor current that we use for idle hold
+constexpr float DefaultNonlinearExtrusionLimit = 0.2; // Maximum additional commanded extrusion to compensate for nonlinearity
+
// Triggers
constexpr unsigned int MaxTriggers = 10; // Must be <= 32 because we store a bitmap of pending triggers in a uint32_t
diff --git a/src/FilamentSensors/Duet3DFilamentSensor.cpp b/src/FilamentSensors/Duet3DFilamentSensor.cpp
index c1e5cf36..ceddf765 100644
--- a/src/FilamentSensors/Duet3DFilamentSensor.cpp
+++ b/src/FilamentSensors/Duet3DFilamentSensor.cpp
@@ -53,7 +53,7 @@ bool Duet3DFilamentSensor::Configure(GCodeBuffer& gb, StringRef& reply, bool& se
}
else
{
- reply.printf("Duet3D filament sensor on endstop %u, %s microswitch, %.1fmm per rev, check every %.1fmm, tolerance %.1f%%, ",
+ reply.printf("Duet3D filament monitor on E%u, %s microswitch, %.2fmm/rev, check every %.1fmm, tolerance %.1f%%, ",
GetEndstopNumber(), (withSwitch) ? "with" : "no", (double)mmPerRev, (double)minimumExtrusionCheckLength, (double)(tolerance * 100.0));
if (!dataReceived)
@@ -66,7 +66,19 @@ bool Duet3DFilamentSensor::Configure(GCodeBuffer& gb, StringRef& reply, bool& se
}
else
{
- reply.catf("current angle %.1f", (double)GetCurrentAngle());
+ reply.catf("current angle %.1f, ", (double)GetCurrentAngle());
+ if (calibrationStarted && fabsf(totalRevsMeasured) > 1.0 && totalExtrusionCommanded > 20.0)
+ {
+ const float measuredMmPerRev = totalExtrusionCommanded/totalRevsMeasured;
+ const float normalRatio = 1.0/measuredMmPerRev;
+ const int measuredPosTolerance = lrintf(100.0 * (((normalRatio > 0.0) ? maxMovementRatio : minMovementRatio) - normalRatio)/normalRatio);
+ const int measuredNegTolerance = lrintf(100.0 * (normalRatio - ((normalRatio > 0.0) ? minMovementRatio : maxMovementRatio))/normalRatio);
+ reply.catf("measured %.2fmm/rev +%d%% -%d%% over %.1fmm\n", (double)measuredMmPerRev, measuredPosTolerance, measuredNegTolerance, (double)totalExtrusionCommanded);
+ }
+ else
+ {
+ reply.cat("no calibration data");
+ }
}
}
diff --git a/src/FilamentSensors/FilamentSensor.cpp b/src/FilamentSensors/FilamentSensor.cpp
index 53d1d7c1..b7a9c9a9 100644
--- a/src/FilamentSensors/FilamentSensor.cpp
+++ b/src/FilamentSensors/FilamentSensor.cpp
@@ -128,15 +128,15 @@ bool FilamentSensor::ConfigurePin(GCodeBuffer& gb, StringRef& reply, bool& seen)
}
// Return the filament sensor associated with a particular extruder
-/*static*/ FilamentSensor *FilamentSensor::GetFilamentSensor(int extruder)
+/*static*/ FilamentSensor *FilamentSensor::GetFilamentSensor(unsigned int extruder)
{
- return (extruder >= 0 && extruder < (int)MaxExtruders) ? filamentSensors[extruder] : nullptr;
+ return (extruder < MaxExtruders) ? filamentSensors[extruder] : nullptr;
}
// Set the filament sensor associated with a particular extruder
-/*static*/ bool FilamentSensor::SetFilamentSensorType(int extruder, int newSensorType)
+/*static*/ bool FilamentSensor::SetFilamentSensorType(unsigned int extruder, int newSensorType)
{
- if (extruder >= 0 && extruder < (int)MaxExtruders)
+ if (extruder < MaxExtruders)
{
FilamentSensor*& sensor = filamentSensors[extruder];
const int oldSensorType = (sensor == nullptr) ? 0 : sensor->GetType();
diff --git a/src/FilamentSensors/FilamentSensor.h b/src/FilamentSensors/FilamentSensor.h
index 07ca4c8f..2483cec3 100644
--- a/src/FilamentSensors/FilamentSensor.h
+++ b/src/FilamentSensors/FilamentSensor.h
@@ -52,10 +52,10 @@ public:
static void Spin(bool full);
// Return the filament sensor associated with a particular extruder
- static FilamentSensor *GetFilamentSensor(int extruder);
+ static FilamentSensor *GetFilamentSensor(unsigned int extruder);
// Set the filament sensor associated with a particular extruder
- static bool SetFilamentSensorType(int extruder, int newSensorType);
+ static bool SetFilamentSensorType(unsigned int extruder, int newSensorType);
// Send diagnostics info
static void Diagnostics(MessageType mtype);
diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp
index 2b8c0144..9a7c025b 100644
--- a/src/GCodes/GCodes.cpp
+++ b/src/GCodes/GCodes.cpp
@@ -652,29 +652,26 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, StringRef& reply)
case GCodeState::stopping: // MO after executing stop.g if present
case GCodeState::sleeping: // M1 after executing sleep.g if present
- if (simulationMode == 0)
+ // Deselect the active tool and turn off all heaters, unless parameter Hn was used with n > 0
+ if (!gb.Seen('H') || gb.GetIValue() <= 0)
{
- // Deselect the active tool and turn off all heaters, unless parameter Hn was used with n > 0
- if (!gb.Seen('H') || gb.GetIValue() <= 0)
+ Tool* tool = reprap.GetCurrentTool();
+ if (tool != nullptr)
{
- Tool* tool = reprap.GetCurrentTool();
- if (tool != nullptr)
- {
- reprap.StandbyTool(tool->Number(), simulationMode != 0);
- }
- reprap.GetHeat().SwitchOffAll(true);
+ reprap.StandbyTool(tool->Number(), simulationMode != 0);
}
+ reprap.GetHeat().SwitchOffAll(true);
+ }
- // chrishamm 2014-18-10: Although RRP says M0 is supposed to turn off all drives and heaters,
- // I think M1 is sufficient for this purpose. Leave M0 for a normal reset.
- if (gb.GetState() == GCodeState::sleeping)
- {
- DisableDrives();
- }
- else
- {
- platform.SetDriversIdle();
- }
+ // chrishamm 2014-18-10: Although RRP says M0 is supposed to turn off all drives and heaters,
+ // I think M1 is sufficient for this purpose. Leave M0 for a normal reset.
+ if (gb.GetState() == GCodeState::sleeping)
+ {
+ DisableDrives();
+ }
+ else
+ {
+ platform.SetDriversIdle();
}
gb.SetState(GCodeState::normal);
break;
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index 03429543..2e9d1e55 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -294,17 +294,21 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
}
{
const bool wasPaused = isPaused; // isPaused gets cleared by CancelPrint
+ const bool wasSimulating = IsSimulating(); // simulationMode may get cleared by CancelPrint
StopPrint(&gb == fileGCode); // if this is normal end-of-print commanded by the file, delete the resurrect.g file
- // If we are cancelling a paused print with M0 and we are homed and cancel.g exists then run it and do nothing else
- if (wasPaused && code == 0 && AllAxesAreHomed() && DoFileMacro(gb, CANCEL_G, false))
+ if (!wasSimulating) // don't run any macro files or turn heaters off etc. if we were simulating before we stopped the print
{
- break;
+ // If we are cancelling a paused print with M0 and we are homed and cancel.g exists then run it and do nothing else
+ if (wasPaused && code == 0 && AllAxesAreHomed() && DoFileMacro(gb, CANCEL_G, false))
+ {
+ break;
+ }
+
+ gb.SetState((code == 0) ? GCodeState::stopping : GCodeState::sleeping);
+ DoFileMacro(gb, (code == 0) ? STOP_G : SLEEP_G, false);
}
}
-
- gb.SetState((code == 0) ? GCodeState::stopping : GCodeState::sleeping);
- DoFileMacro(gb, (code == 0) ? STOP_G : SLEEP_G, false);
break;
case 3: // Spin spindle clockwise
@@ -3384,8 +3388,8 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
case 591: // Configure filament sensor
if (gb.Seen('D'))
{
- int extruder = gb.GetIValue();
- if (extruder >= 0 && extruder < (int)numExtruders)
+ const unsigned int extruder = gb.GetUIValue();
+ if (extruder < numExtruders)
{
bool seen = false;
long sensorType;
@@ -3408,12 +3412,35 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply)
}
else if (!seen)
{
- reply.printf("Extruder drive %d has no filament sensor", extruder);
+ reply.printf("Extruder drive %u has no filament sensor", extruder);
}
}
}
break;
+#if NONLINEAR_EXTRUSION
+ case 592: // Configure nonlinear extrusion
+ if (gb.Seen('D'))
+ {
+ const unsigned int extruder = gb.GetUIValue();
+ bool seen = false;
+ float a = 0.0, b = 0.0, limit = DefaultNonlinearExtrusionLimit;
+ gb.TryGetFValue('A', a, seen);
+ gb.TryGetFValue('B', b, seen);
+ gb.TryGetFValue('L', limit, seen);
+ if (seen)
+ {
+ platform.SetNonlinearExtrusion(extruder, a, b, limit);
+ }
+ else
+ {
+ platform.GetExtrusionCoefficients(extruder, a, b, limit);
+ reply.printf("Drive %u nonlinear extrusion coefficients: A=%.3f, B=%.4f, limit=%.2f", extruder, (double)a, (double)b, (double)limit);
+ }
+ }
+ break;
+#endif
+
case 593: // Configure filament properties
// TODO: We may need this code later to restrict specific filaments to certain tools or to reset filament counters.
break;
diff --git a/src/Movement/DriveMovement.cpp b/src/Movement/DriveMovement.cpp
index 5b25ba1b..2352cc26 100644
--- a/src/Movement/DriveMovement.cpp
+++ b/src/Movement/DriveMovement.cpp
@@ -172,11 +172,25 @@ void DriveMovement::PrepareDeltaAxis(const DDA& dda, const PrepParams& params)
void DriveMovement::PrepareExtruder(const DDA& dda, const PrepParams& params, bool doCompensation)
{
const float dv = dda.directionVector[drive];
- const float stepsPerMm = reprap.GetPlatform().DriveStepsPerUnit(drive) * fabsf(dv);
+ float stepsPerMm = reprap.GetPlatform().DriveStepsPerUnit(drive) * fabsf(dv);
+ const size_t extruder = drive - reprap.GetGCodes().GetTotalAxes();
+
+#if NONLINEAR_EXTRUSION
+ if (dda.isPrintingMove)
+ {
+ float a, b, limit;
+ if (reprap.GetPlatform().GetExtrusionCoefficients(extruder, a, b, limit))
+ {
+ const float averageExtrusionSpeed = (dda.totalDistance * dv * DDA::stepClockRate)/dda.clocksNeeded;
+ stepsPerMm *= 1.0 + min<float>((averageExtrusionSpeed * a) + (averageExtrusionSpeed * averageExtrusionSpeed * b), limit);
+ }
+ }
+#endif
+
mp.cart.twoCsquaredTimesMmPerStepDivA = roundU64((double)(DDA::stepClockRateSquared * 2)/((double)stepsPerMm * (double)dda.acceleration));
// Calculate the pressure advance parameter
- const float compensationTime = (doCompensation && dv > 0.0) ? reprap.GetPlatform().GetPressureAdvance(drive - reprap.GetGCodes().GetTotalAxes()) : 0.0;
+ const float compensationTime = (doCompensation && dv > 0.0) ? reprap.GetPlatform().GetPressureAdvance(extruder) : 0.0;
mp.cart.compensationClocks = roundU32(compensationTime * (float)DDA::stepClockRate);
mp.cart.accelCompensationClocks = roundU32(compensationTime * (float)DDA::stepClockRate * params.compFactor);
diff --git a/src/Movement/DriveMovement.h b/src/Movement/DriveMovement.h
index 1d71931e..bf511795 100644
--- a/src/Movement/DriveMovement.h
+++ b/src/Movement/DriveMovement.h
@@ -286,7 +286,7 @@ inline int32_t DriveMovement::GetNetStepsTaken() const
}
else
{
- netStepsTaken = (int32_t)nextStep - (int32_t)(2 * reverseStartStep) + 2; // allowing for direction having changed
+ netStepsTaken = (int32_t)nextStep - (int32_t)(2 * reverseStartStep) + 1; // allowing for direction having changed
}
return (direction) ? netStepsTaken : -netStepsTaken;
}
diff --git a/src/Pins.h b/src/Pins.h
index dc0c5ed7..f940d06a 100644
--- a/src/Pins.h
+++ b/src/Pins.h
@@ -38,4 +38,8 @@
# define HAS_MULTIPLE_NETWORK_INTERFACES 0
#endif
+#ifndef NONLINEAR_EXTRUSION
+#define NONLINEAR_EXTRUSION 1 // for now this is always enabled
+#endif
+
#endif // PINS_H__
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 4c54bc67..ef3baf88 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -57,7 +57,8 @@ extern char _end;
extern "C" char *sbrk(int i);
#if !defined(HAS_LWIP_NETWORKING) || !defined(HAS_WIFI_NETWORKING) || !defined(HAS_CPU_TEMP_SENSOR) || !defined(HAS_HIGH_SPEED_SD) \
- || !defined(HAS_SMART_DRIVERS) || !defined(HAS_STALL_DETECT) || !defined(HAS_VOLTAGE_MONITOR) || !defined(HAS_VREF_MONITOR) || !defined(ACTIVE_LOW_HEAT_ON)
+ || !defined(HAS_SMART_DRIVERS) || !defined(HAS_STALL_DETECT) || !defined(HAS_VOLTAGE_MONITOR) || !defined(HAS_VREF_MONITOR) || !defined(ACTIVE_LOW_HEAT_ON) \
+ || !defined(NONLINEAR_EXTRUSION)
# error Missing feature definition
#endif
@@ -537,6 +538,10 @@ void Platform::Init()
{
extruderDrivers[extr] = (uint8_t)(extr + MinAxes); // set up default extruder drive mapping
SetPressureAdvance(extr, 0.0); // no pressure advance
+#if NONLINEAR_EXTRUSION
+ nonlinearExtrusionA[extr] = nonlinearExtrusionB[extr] = 0.0;
+ nonlinearExtrusionLimit[extr] = DefaultNonlinearExtrusionLimit;
+#endif
}
#if defined(DUET_NG)
@@ -3794,6 +3799,32 @@ void Platform::SetPressureAdvance(size_t extruder, float factor)
}
}
+#if NONLINEAR_EXTRUSION
+
+bool Platform::GetExtrusionCoefficients(size_t extruder, float& a, float& b, float& limit) const
+{
+ 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)
+{
+ if (extruder < MaxExtruders && nonlinearExtrusionLimit[extruder] > 0.0)
+ {
+ nonlinearExtrusionLimit[extruder] = limit;
+ nonlinearExtrusionA[extruder] = a;
+ nonlinearExtrusionB[extruder] = b;
+ }
+}
+
+#endif
+
float Platform::ActualInstantDv(size_t drive) const
{
const float idv = instantDvs[drive];
diff --git a/src/Platform.h b/src/Platform.h
index 21fa55aa..7eb03ff0 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -467,6 +467,11 @@ public:
uint32_t GetSlowDrivers() const { return slowDrivers; }
uint32_t GetSlowDriverClocks() const { return slowDriverStepPulseClocks; }
+#if NONLINEAR_EXTRUSION
+ bool GetExtrusionCoefficients(size_t extruder, float& a, float& b, float& limit) const;
+ void SetNonlinearExtrusion(size_t extruder, float a, float b, float limit);
+#endif
+
// Z probe
void SetZProbeDefaults();
@@ -718,6 +723,9 @@ private:
float driveStepsPerUnit[DRIVES];
float instantDvs[DRIVES];
float pressureAdvance[MaxExtruders];
+#if NONLINEAR_EXTRUSION
+ float nonlinearExtrusionA[MaxExtruders], nonlinearExtrusionB[MaxExtruders], nonlinearExtrusionLimit[MaxExtruders];
+#endif
float motorCurrents[DRIVES]; // the normal motor current for each stepper driver
float motorCurrentFraction[DRIVES]; // the percentages of normal motor current that each driver is set to
#if HAS_SMART_DRIVERS
diff --git a/src/Version.h b/src/Version.h
index 29af85b6..d2599956 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -9,11 +9,11 @@
#define SRC_VERSION_H_
#ifndef VERSION
-# define VERSION "1.20.1RC1"
+# define VERSION "1.20.1RC2"
#endif
#ifndef DATE
-# define DATE "2017-12-31"
+# define DATE "2018-01-01"
#endif
#define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman"