Skip to content

Commit

Permalink
Version 1.00q
Browse files Browse the repository at this point in the history
Corrected case of geometry string passed to PanelDue
Added stepper motor idle mode
Added experimental 6-point Delta calibration
  • Loading branch information
dc42 committed Mar 19, 2015
1 parent 3c74827 commit 31adc97
Show file tree
Hide file tree
Showing 18 changed files with 463 additions and 140 deletions.
8 changes: 7 additions & 1 deletion Changes in dc42 fork.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Additional functionality in 1.00o-dc42 release compared to RRP 0.78c
Additional functionality in 1.00q-dc42 release compared to RRP 0.78c
====================================================================

* The Duet can serve all the files needed by the web interface
Expand Down Expand Up @@ -93,10 +93,16 @@ Additional functionality in 1.00o-dc42 release compared to RRP 0.78c

* The Move code has been almost completely rewritten to generate steps at accurate intervals, instead of using the Bresenham approximation. There are no minimum speeds any more.

* X and Y axes can be homed simultaneously for faster homing (not available on CoreXY/CoreXZ/CoreYZ machines)

* Motor current is reduced to lower than normal when M0 is received or the motors have all been idle for 30 seconds. The default is 30% of normal, but it can be adjusted using the S parameter in the M906 command.

* Extruder elasticity compensation is supported (M572 command)

* Delta printers are supported (M665 and M666 commands)

* CoreXY, CoreXZ and CoreYZ printers are supported (M667 command)

* Endstops can be configured (M574 command)

* Debugging can now be enabled and disabled separately for all modules (M111 command). The module is selected using the P parameter.
Expand Down
11 changes: 7 additions & 4 deletions Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Licence: GPL
#define CONFIGURATION_H

#define NAME "RepRapFirmware"
#define VERSION "1.00p-dc42"
#define DATE "2015-03-07"
#define VERSION "1.00q-dc42"
#define DATE "2015-03-19"
#define AUTHORS "reprappro, dc42, zpl"

#define FLASH_SAVE_ENABLED (1)
Expand All @@ -49,6 +49,9 @@ enum Compatibility
const unsigned int GcodeLength = 100; // Maximum length of a G Code string that we handle
const unsigned int MaxFilenameLength = 100; // Maximum length of a path + filename on the SD card

const float defaultIdleCurrentFactor = 0.3; // Proportion of normal motor current that we use for idle hold
const float defaultIdleTimeout = 30.0;

#define ABS_ZERO (-273.15) // Celsius

#define INCH_TO_MM (25.4)
Expand All @@ -67,8 +70,8 @@ const unsigned int MaxFilenameLength = 100; // Maximum length of a path + filena
#define BAD_LOW_TEMPERATURE -10.0
#define BAD_HIGH_TEMPERATURE 300.0

#define NUMBER_OF_PROBE_POINTS 5 // Maximum number of probe points
#define Z_DIVE 5.0 // Height from which to probe the bed (mm)
#define NUMBER_OF_PROBE_POINTS 9 // Maximum number of probe points
#define Z_DIVE 5.0 // Default height from which to probe the bed (mm)
#define TRIANGLE_0 -0.001 // Slightly less than 0 for point-in-triangle tests

#define SILLY_Z_VALUE -9999.0
Expand Down
6 changes: 4 additions & 2 deletions DDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,8 @@ float DDA::CalcTime() const
+ (topSpeed - endSpeed)/acceleration;
}

// Prepare this DDA for execution
// Prepare this DDA for execution.
// This must not be called with interrupts disabled, because it calls Platform::EnableDrive.
void DDA::Prepare()
{
//debugPrintf("Prep\n");
Expand Down Expand Up @@ -571,6 +572,7 @@ void DDA::Prepare()
DriveMovement& dm = ddm[drive];
if (dm.moving)
{
reprap.GetPlatform()->EnableDrive(drive);
if (drive >= AXES)
{
dm.PrepareExtruder(*this, params, drive);
Expand Down Expand Up @@ -657,7 +659,7 @@ bool DDA::Start(uint32_t tim)
DriveMovement& dm = ddm[i];
if (dm.moving)
{
reprap.GetPlatform()->SetDirection(i, dm.direction, true);
reprap.GetPlatform()->SetDirection(i, dm.direction);
}
}
return reprap.GetPlatform()->ScheduleInterrupt(firstStepTime + moveStartTime);
Expand Down
4 changes: 2 additions & 2 deletions DriveMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ uint32_t DriveMovement::CalcNextStepTimeCartesian(size_t drive)
{
if (nextStep == mp.cart.reverseStartStep)
{
reprap.GetPlatform()->SetDirection(drive, !direction, false);
reprap.GetPlatform()->SetDirection(drive, !direction);
}
nextStepTime = topSpeedTimesCdivAPlusDecelStartClocks
+ isqrt((int64_t)(mp.cart.twoCsquaredTimesMmPerStepDivA * nextStep) - mp.cart.fourMaxStepDistanceMinusTwoDistanceToStopTimesCsquaredDivA);
Expand Down Expand Up @@ -247,7 +247,7 @@ uint32_t DriveMovement::CalcNextStepTimeDelta(const DDA &dda, size_t drive)
if (nextStep == mp.delta.reverseStartStep)
{
direction = false;
reprap.GetPlatform()->SetDirection(drive, false, false); // going down now
reprap.GetPlatform()->SetDirection(drive, false); // going down now
}

// Calculate d*s*K as an integer, where d = distance the head has travelled, s = steps/mm for this drive, K = a power of 2 to reduce the rounding errors
Expand Down
79 changes: 56 additions & 23 deletions GCodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void GCodes::Spin()
if (probeCount >= numProbePoints)
{
zProbesSet = true;
reprap.GetMove()->FinishedBedProbing(0, numProbePoints, reply);
reprap.GetMove()->FinishedBedProbing(0, reply);
HandleReply(false, gbCurrent, nullptr, 'G', 32, false);
state = GCodeState::normal;
}
Expand Down Expand Up @@ -1068,6 +1068,12 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb, StringRef& reply)
return DoSingleZProbe();

int probePointIndex = gb->GetIValue();
if (probePointIndex < 0 || probePointIndex >= NUMBER_OF_PROBE_POINTS)
{
reprap.GetPlatform()->Message(BOTH_ERROR_MESSAGE, "Z probe point index out of range.\n");
return true;
}

const ZProbeParameters& rp = platform->GetZProbeParameters();

float x = (gb->Seen(axisLetters[X_AXIS])) ? gb->GetFValue() : moveBuffer[X_AXIS] - rp.xOffset;
Expand All @@ -1083,7 +1089,7 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb, StringRef& reply)
if (gb->Seen('S'))
{
zProbesSet = true;
reprap.GetMove()->FinishedBedProbing(gb->GetIValue(), probePointIndex, reply);
reprap.GetMove()->FinishedBedProbing(gb->GetIValue(), reply);
}
return true;
}
Expand All @@ -1105,7 +1111,7 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb, StringRef& reply)
}
else
{
reprap.GetMove()->FinishedBedProbing(sParam, probePointIndex, reply);
reprap.GetMove()->FinishedBedProbing(sParam, reply);
}
}
return true;
Expand Down Expand Up @@ -1580,7 +1586,7 @@ void GCodes::DisableDrives()
{
for (size_t drive = 0; drive < DRIVES; drive++)
{
platform->Disable(drive);
platform->DisableDrive(drive);
}
SetAllAxesNotHomed();
}
Expand Down Expand Up @@ -2180,6 +2186,13 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
{
DisableDrives();
}
else
{
for (size_t drive = 0; drive < DRIVES; ++drive)
{
platform->SetDriveIdle(drive);
}
}

reprap.GetHeat()->SwitchOffAll();
if (isPaused)
Expand All @@ -2200,7 +2213,7 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
if (gb->Seen(axisLetters[axis]))
{
axisIsHomed[axis] = false;
platform->Disable(axis);
platform->DisableDrive(axis);
seen = true;
}
}
Expand All @@ -2219,7 +2232,7 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
error = true;
break;
}
platform->Disable(AXES + eDrive[i]);
platform->DisableDrive(AXES + eDrive[i]);
}
}

Expand Down Expand Up @@ -3387,22 +3400,29 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
if (gb->Seen('P'))
{
int point = gb->GetIValue();
bool seen = false;
if (gb->Seen(axisLetters[X_AXIS]))
if (point < 0 || point >= NUMBER_OF_PROBE_POINTS)
{
reprap.GetMove()->SetXBedProbePoint(point, gb->GetFValue());
seen = true;
reprap.GetPlatform()->Message(BOTH_ERROR_MESSAGE, "Z probe point index out of range.\n");
}
if (gb->Seen(axisLetters[Y_AXIS]))
else
{
reprap.GetMove()->SetYBedProbePoint(point, gb->GetFValue());
seen = true;
}
bool seen = false;
if (gb->Seen(axisLetters[X_AXIS]))
{
reprap.GetMove()->SetXBedProbePoint(point, gb->GetFValue());
seen = true;
}
if (gb->Seen(axisLetters[Y_AXIS]))
{
reprap.GetMove()->SetYBedProbePoint(point, gb->GetFValue());
seen = true;
}

if (!seen)
{
reply.printf("Probe point %d - [%.1f, %.1f]\n", point, reprap.GetMove()->XBedProbePoint(point),
reprap.GetMove()->YBedProbePoint(point));
if (!seen)
{
reply.printf("Probe point %d - [%.1f, %.1f]\n", point, reprap.GetMove()->XBedProbePoint(point),
reprap.GetMove()->YBedProbePoint(point));
}
}
}
break;
Expand Down Expand Up @@ -3831,7 +3851,7 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
case 906: // Set/report Motor currents
{
bool seen = false;
for (int8_t axis = 0; axis < AXES; axis++)
for (size_t axis = 0; axis < AXES; axis++)
{
if (gb->Seen(axisLetters[axis]))
{
Expand All @@ -3846,19 +3866,32 @@ bool GCodes::HandleMcode(GCodeBuffer* gb, StringRef& reply)
int eCount = DRIVES - AXES;
gb->GetFloatArray(eVals, eCount);
// 2014-09-29 DC42: we no longer insist that the user supplies values for all possible extruder drives
for (int8_t e = 0; e < eCount; e++)
for (size_t e = 0; e < eCount; e++)
{
platform->SetMotorCurrent(AXES + e, eVals[e]);
}
seen = true;
}
else if (!seen)

if (gb->Seen('I'))
{
float idleFactor = gb->GetFValue();
if (idleFactor >= 0 && idleFactor <= 100.0)
{
platform->SetIdleCurrentFactor(idleFactor/100.0);
seen = true;
}
}

if (!seen)
{
reply.printf("Axis currents (mA) - X:%d, Y:%d, Z:%d, E:", (int) platform->MotorCurrent(X_AXIS),
(int) platform->MotorCurrent(Y_AXIS), (int) platform->MotorCurrent(Z_AXIS));
for (int8_t drive = AXES; drive < DRIVES; drive++)
for (size_t drive = AXES; drive < DRIVES; drive++)
{
reply.catf("%d%c", (int) platform->MotorCurrent(drive), (drive < DRIVES - 1) ? ':' : '\n');
reply.catf("%d%c", (int) platform->MotorCurrent(drive), (drive < DRIVES - 1) ? ':' : ',');
}
reply.catf(" idle factor %d\n", (int)(platform->GetIdleCurrentFactor() * 100.0));
}
}
break;
Expand Down
Loading

0 comments on commit 31adc97

Please sign in to comment.