Merge remote-tracking branch 'upstream/duet' into duet

This commit is contained in:
Tony 2013-12-07 15:12:21 +00:00
commit 7cd9c49a43
18 changed files with 7873 additions and 416 deletions

View file

@ -24,8 +24,8 @@ Licence: GPL
#define CONFIGURATION_H
#define NAME "RepRapFirmware"
#define VERSION "0.28"
#define DATE "2013-11-30"
#define VERSION "0.35"
#define DATE "2013-12-06"
#define LAST_AUTHOR "reprappro.com"
// Other firmware that we might switch to be compatible with.
@ -60,7 +60,7 @@ enum Compatibility
#define STANDBY_INTERRUPT_RATE 2.0e-4 // Seconds
#define NUMBER_OF_PROBE_POINTS 3
#define NUMBER_OF_PROBE_POINTS 4
#define Z_DIVE 5.0 // Height from which to probe the bed (mm)
#define SILLY_Z_VALUE -9999.0

View file

@ -670,7 +670,7 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb)
if(gb->Seen('S'))
{
zProbesSet = true;
reprap.GetMove()->SetProbedBedPlane();
reprap.GetMove()->SetProbedBedEquation();
}
return true;
} else
@ -682,7 +682,7 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb)
if(gb->Seen('S'))
{
zProbesSet = true;
reprap.GetMove()->SetProbedBedPlane();
reprap.GetMove()->SetProbedBedEquation();
}
return true;
}
@ -691,20 +691,26 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb)
return false;
}
// This probes multiple points on the bed (usually three in a
// triangle), then sets the bed transformation to compensate
// This probes multiple points on the bed (three in a
// triangle or four in the corners), then sets the bed transformation to compensate
// for the bed not quite being the plane Z = 0.
bool GCodes::DoMultipleZProbe()
{
if(reprap.GetMove()->NumberOfXYProbePoints() < 3)
{
platform->Message(HOST_MESSAGE, "Bed probing: there needs to be 3 or more points set.\n");
return true;
}
if(DoSingleZProbe())
probeCount++;
if(probeCount >= NUMBER_OF_PROBE_POINTS)
if(probeCount >= reprap.GetMove()->NumberOfXYProbePoints())
{
probeCount = 0;
zProbesSet = true;
reprap.GetMove()->SetZProbing(false);
reprap.GetMove()->SetProbedBedPlane();
reprap.GetMove()->SetProbedBedEquation();
return true;
}
return false;
@ -1072,9 +1078,10 @@ void GCodes::HandleReply(bool error, bool fromLine, char* reply, char gMOrT, int
return;
}
if( (gMOrT == 'M' && code == 105) || (gMOrT == 'G' && code == 998) )
if( (gMOrT == 'M' && code == 105) || (gMOrT == 'G' && code == 998))
{
platform->GetLine()->Write(response);
platform->GetLine()->Write(" ");
platform->GetLine()->Write(reply);
platform->GetLine()->Write("\n");
return;
@ -1123,6 +1130,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
bool result = true;
bool error = false;
bool resend = false;
bool seen;
char reply[STRING_LENGTH];
reply[0] = 0;
@ -1285,10 +1293,18 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
case 85: // Set inactive time
break;
case 92: // Set steps/mm for some axes
case 92: // Set/report steps/mm for some axes
seen = false;
for(int8_t drive = 0; drive < DRIVES; drive++)
if(gb->Seen(gCodeLetters[drive]))
{
platform->SetDriveStepsPerUnit(drive, gb->GetFValue());
seen = true;
}
if(!seen)
snprintf(reply, STRING_LENGTH, "Steps/mm: X: %d, Y: %d, Z: %d, E: %d",
(int)platform->DriveStepsPerUnit(X_AXIS), (int)platform->DriveStepsPerUnit(Y_AXIS),
(int)platform->DriveStepsPerUnit(Z_AXIS), (int)platform->DriveStepsPerUnit(AXES)); // FIXME - needs to do multiple extruders
break;
case 104: // Depricated
@ -1327,8 +1343,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
reprap.SetDebug(gb->GetIValue());
break;
case 112: // Emergency stop
reprap.EmergencyStop();
case 112: // Emergency stop - aced upon in Webserver
break;
case 114: // Deprecated
@ -1340,6 +1355,10 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
result = false;
break;
case 115: // Print firmware version
snprintf(reply, STRING_LENGTH, "FIRMWARE_NAME:%s FIRMWARE_VERSION:%s ELECTRONICS:%s DATE:%s", NAME, VERSION, ELECTRONICS, DATE);
break;
case 109: // Depricated
if(gb->Seen('S'))
{
@ -1540,6 +1559,17 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
reprap.GetMove()->SetIdentityTransform();
break;
case 876: // TEMPORARY - this will go away...
if(gb->Seen('P'))
{
iValue = gb->GetIValue();
if(iValue != 1)
platform->SetHeatOn(0);
else
platform->SetHeatOn(1);
}
break;
case 906: // Set Motor currents
for(uint8_t i = 0; i < DRIVES; i++)
{

View file

@ -147,25 +147,23 @@ void Move::Init()
tanXY = 0.0;
tanYZ = 0.0;
tanXZ = 0.0;
zPlaneSet = false;
zEquationSet = false;
lastZHit = 0.0;
zProbing = false;
xBedProbePoints[0] = 0.2*platform->AxisLength(X_AXIS);
yBedProbePoints[0] = 0.2*platform->AxisLength(Y_AXIS);
zBedProbePoints[0] = 0.0;
probePointSet[0] = false;
for(uint8_t point = 0; point < NUMBER_OF_PROBE_POINTS; point++)
{
xBedProbePoints[point] = (0.2 + 0.6*(float)(point%2))*platform->AxisLength(X_AXIS);
yBedProbePoints[point] = (0.2 + 0.6*(float)(point/2))*platform->AxisLength(Y_AXIS);
zBedProbePoints[point] = 0.0;
probePointSet[point] = unset;
}
xBedProbePoints[1] = 0.8*platform->AxisLength(X_AXIS);
yBedProbePoints[1] = 0.2*platform->AxisLength(Y_AXIS);
zBedProbePoints[1] = 0.0;
probePointSet[1] = false;
xRectangle = 1.0/(0.8*platform->AxisLength(X_AXIS));
yRectangle = xRectangle;
xBedProbePoints[2] = 0.5*platform->AxisLength(X_AXIS);
yBedProbePoints[2] = 0.8*platform->AxisLength(Y_AXIS);
zBedProbePoints[2] = 0.0;
probePointSet[2] = false;
secondDegreeCompensation = false;
lastTime = platform->Time();
longWait = lastTime;
@ -558,7 +556,7 @@ void Move::Interrupt()
{
// No - it's still live. Step it and return.
dda->Step(true);
dda->Step();
return;
}
@ -607,30 +605,67 @@ void Move::SetIdentityTransform()
aX = 0.0;
aY = 0.0;
aC = 0.0;
secondDegreeCompensation = false;
}
void Move::Transform(float xyzPoint[])
{
xyzPoint[X_AXIS] = xyzPoint[X_AXIS] + tanXY*xyzPoint[Y_AXIS] + tanXZ*xyzPoint[Z_AXIS];
xyzPoint[Y_AXIS] = xyzPoint[Y_AXIS] + tanYZ*xyzPoint[Z_AXIS];
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC;
if(secondDegreeCompensation)
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + SecondDegreeTransformZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
else
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC;
// platform->GetLine()->Write(xyzPoint[Y_AXIS]);
// platform->GetLine()->Write('\n');
}
void Move::InverseTransform(float xyzPoint[])
{
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - (aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC);
if(secondDegreeCompensation)
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - SecondDegreeTransformZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
else
xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - (aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC);
xyzPoint[Y_AXIS] = xyzPoint[Y_AXIS] - tanYZ*xyzPoint[Z_AXIS];
xyzPoint[X_AXIS] = xyzPoint[X_AXIS] - (tanXY*xyzPoint[Y_AXIS] + tanXZ*xyzPoint[Z_AXIS]);
}
void Move::SetProbedBedPlane()
void Move::SetProbedBedEquation()
{
if(NumberOfProbePoints() >= 3)
{
secondDegreeCompensation = (NumberOfProbePoints() == 4);
if(secondDegreeCompensation)
{
/*
* Transform to a ruled-surface quadratic. The corner points for interpolation are indexed:
*
* ^ [1] [2]
* |
* Y
* |
* | [0] [3]
* -----X---->
*
* These are the scaling factors to apply to x and y coordinates to get them into the
* unit interval [0, 1].
*/
xRectangle = 1.0/(xBedProbePoints[3] - xBedProbePoints[0]);
yRectangle = 1.0/(yBedProbePoints[1] - yBedProbePoints[0]);
zEquationSet = true;
return;
}
} else
{
platform->Message(HOST_MESSAGE, "Attempt to set bed compensation before all probe points have been recorded.");
return;
}
float xkj, ykj, zkj;
float xlj, ylj, zlj;
float a, b, c, d; // Implicit plane equation - what we need to do a proper job
if(!probePointSet[0] || !probePointSet[1] || !probePointSet[2])
platform->Message(HOST_MESSAGE, "Attempt to set bed plane when probing is incomplete!\n");
xkj = xBedProbePoints[1] - xBedProbePoints[0];
ykj = yBedProbePoints[1] - yBedProbePoints[0];
zkj = zBedProbePoints[1] - zBedProbePoints[0];
@ -644,7 +679,7 @@ void Move::SetProbedBedPlane()
aX = -a/c;
aY = -b/c;
aC = -d/c;
zPlaneSet = true;
zEquationSet = true;
}
// FIXME
@ -978,11 +1013,14 @@ void DDA::Start(bool noTest)
active = true;
}
void DDA::Step(bool noTest)
void DDA::Step()
{
if(!active && noTest)
if(!active)
return;
if(!move->active)
return;
uint8_t axesMoving = 0;
uint8_t extrudersMoving = 0;
@ -991,8 +1029,7 @@ void DDA::Step(bool noTest)
counter[drive] += delta[drive];
if(counter[drive] > 0)
{
if(noTest)
platform->Step(drive);
platform->Step(drive);
counter[drive] -= totalSteps;
@ -1045,11 +1082,10 @@ void DDA::Step(bool noTest)
stepCount++;
active = stepCount < totalSteps;
if(noTest)
platform->SetInterrupt(timeStep);
platform->SetInterrupt(timeStep);
}
if(!active && noTest)
if(!active)
{
for(int8_t drive = 0; drive < DRIVES; drive++)
move->liveCoordinates[drive] = myLookAheadEntry->MachineToEndPoint(drive); // Don't use SetLiveCoordinates because that applies the transform

84
Move.h
View file

@ -52,6 +52,14 @@ enum MovementType
eMove = 4
};
enum PointCoordinateSet
{
unset = 0,
xSet = 1,
ySet = 2,
zSet = 4
};
class LookAhead
{
@ -109,7 +117,7 @@ protected:
DDA(Move* m, Platform* p, DDA* n);
MovementProfile Init(LookAhead* lookAhead, float& u, float& v);
void Start(bool noTest);
void Step(bool noTest);
void Step();
bool Active();
DDA* Next();
float InstantDv();
@ -166,8 +174,13 @@ class Move
float xBedProbePoint(int index);
float yBedProbePoint(int index);
float zBedProbePoint(int index);
int NumberOfProbePoints();
int NumberOfXYProbePoints();
bool AllProbeCoordinatesSet(int index);
bool XYProbeCoordinatesSet(int index);
void SetZProbing(bool probing);
void SetProbedBedPlane();
void SetProbedBedEquation();
float SecondDegreeTransformZ(float x, float y);
float GetLastProbedZ();
void SetAxisCompensation(int8_t axis, float tangent);
void SetIdentityTransform();
@ -178,9 +191,6 @@ class Move
friend class DDA;
// protected:
private:
@ -225,12 +235,14 @@ class Move
float xBedProbePoints[NUMBER_OF_PROBE_POINTS];
float yBedProbePoints[NUMBER_OF_PROBE_POINTS];
float zBedProbePoints[NUMBER_OF_PROBE_POINTS];
bool probePointSet[NUMBER_OF_PROBE_POINTS];
uint8_t probePointSet[NUMBER_OF_PROBE_POINTS];
float aX, aY, aC; // Bed plane explicit equation z' = z + aX*x + aY*y + aC
bool zPlaneSet;
bool zEquationSet;
float tanXY, tanYZ, tanXZ; // 90 degrees + angle gives angle between axes
float xRectangle, yRectangle;
float lastZHit;
bool zProbing;
bool secondDegreeCompensation;
float longWait;
};
@ -425,6 +437,7 @@ inline void Move::SetXBedProbePoint(int index, float x)
return;
}
xBedProbePoints[index] = x;
probePointSet[index] |= xSet;
}
inline void Move::SetYBedProbePoint(int index, float y)
@ -435,6 +448,7 @@ inline void Move::SetYBedProbePoint(int index, float y)
return;
}
yBedProbePoints[index] = y;
probePointSet[index] |= ySet;
}
inline void Move::SetZBedProbePoint(int index, float z)
@ -445,7 +459,7 @@ inline void Move::SetZBedProbePoint(int index, float z)
return;
}
zBedProbePoints[index] = z;
probePointSet[index] = true;
probePointSet[index] |= zSet;
}
inline float Move::xBedProbePoint(int index)
@ -473,6 +487,60 @@ inline float Move::GetLastProbedZ()
return lastZHit;
}
inline bool Move::AllProbeCoordinatesSet(int index)
{
return probePointSet[index] == (xSet | ySet | zSet);
}
inline bool Move::XYProbeCoordinatesSet(int index)
{
return (probePointSet[index] & xSet) && (probePointSet[index] & ySet);
}
inline int Move::NumberOfProbePoints()
{
if(AllProbeCoordinatesSet(0) && AllProbeCoordinatesSet(1) && AllProbeCoordinatesSet(2))
{
if(AllProbeCoordinatesSet(3))
return 4;
else
return 3;
}
return 0;
}
inline int Move::NumberOfXYProbePoints()
{
if(XYProbeCoordinatesSet(0) && XYProbeCoordinatesSet(1) && XYProbeCoordinatesSet(2))
{
if(XYProbeCoordinatesSet(3))
return 4;
else
return 3;
}
return 0;
}
/*
* Transform to a ruled-surface quadratic. The corner points for interpolation are indexed:
*
* ^ [1] [2]
* |
* Y
* |
* | [0] [3]
* -----X---->
*
* The values of x and y are transformed to put them in the interval [0, 1].
*/
inline float Move::SecondDegreeTransformZ(float x, float y)
{
x = (x - xBedProbePoints[0])*xRectangle;
y = (y - yBedProbePoints[0])*yRectangle;
return (1.0 - x)*(1.0 - y)*zBedProbePoints[0] + x*(1.0 - y)*zBedProbePoints[3] + (1.0 - x)*y*zBedProbePoints[1] + x*y*zBedProbePoints[2];
}
inline void Move::SetAxisCompensation(int8_t axis, float tangent)
{
switch(axis)

View file

@ -131,6 +131,7 @@ void Platform::Init()
standbyTemperatures = STANDBY_TEMPERATURES;
activeTemperatures = ACTIVE_TEMPERATURES;
coolingFanPin = COOLING_FAN_PIN;
turnHeatOn = HEAT_ON;
webDir = WEB_DIR;
gcodeDir = GCODE_DIR;
@ -333,7 +334,7 @@ void Platform::SetHeater(int8_t heater, const float& power)
return;
byte p = (byte)(255.0*fmin(1.0, fmax(0.0, power)));
if(HEAT_ON == 0)
if(turnHeatOn == 0)
p = 255 - p;
if(heater == 0)
analogWrite(heatOnPins[heater], p);

View file

@ -34,6 +34,10 @@ Licence: GPL
#ifndef PLATFORM_H
#define PLATFORM_H
// What are we supposed to be running on
#define ELECTRONICS "Duet"
// Language-specific includes
#include <stdio.h>
@ -97,7 +101,7 @@ Licence: GPL
// AXES
#define AXIS_LENGTHS {210, 195, 140} // mm
#define AXIS_LENGTHS {210, 200, 140} // mm
#define HOME_FEEDRATES {50.0, 50.0, 1.0} // mm/sec
#define HEAD_OFFSETS {0.0, 0.0, 0.0}
@ -487,6 +491,7 @@ class Platform
bool UsePID(int8_t heater);
float HeatSampleTime();
void CoolingFan(float speed);
void SetHeatOn(int8_t ho); //TEMPORARY - this will go away...
//-------------------------------------------------------------------------------------------------------
protected:
@ -565,6 +570,7 @@ class Platform
float standbyTemperatures[HEATERS];
float activeTemperatures[HEATERS];
int8_t coolingFanPin;
int8_t turnHeatOn;
// Serial/USB
@ -888,6 +894,11 @@ inline void Platform::CoolingFan(float speed)
analogWrite(coolingFanPin, (uint8_t)(speed*255.0));
}
inline void Platform::SetHeatOn(int8_t ho)
{
turnHeatOn = ho;
}
//*********************************************************************************************************

114
README
View file

@ -1,38 +1,50 @@
RepRapFirmware - Main Program
This firmware is intended to be a fully object-oriented highly modular control program for
This firmware is intended to be a fully object-oriented highly modular control program for
RepRap self-replicating 3D printers.
It owes a lot to Marlin and to the original RepRap FiveD_GCode.
This is the version for the RepRap Duet:
http://blog.think3dprint3d.com/2013/12/Duet-Arduino-Due-compatible-3DPrinter-controller.html
To edit and compile this you will also need the libraries in this repository:
https://github.com/jmgiacalone/Arduino-libraries
A complete uploadable executable version is in the directory Release/RepRapFirmware.bin in this
repository. For details of how to flash it to a Duet see here:
http://www.reprappro.com/documentation/RepRapPro_Firmware#Flashing_the_Firmware
General design principles:
* Control by RepRap G Codes. These are taken to be machine independent, though some may be unsupported.
* Full use of C++ OO techniques,
* Make classes hide their data,
* Make everything as stateless as possible,
* Make everything except the Platform class (see below) as stateless as possible,
* No use of conditional compilation except for #include guards - if you need that, you should be
forking the repository to make a new branch - let the repository take the strain,
* Concentration of all machine-dependent defintions and code in Platform.h and Platform.cpp,
* No specials for (X,Y) or (Z) - all movement is 3-dimensional,
* Except in Platform.h, use real units (mm, seconds etc) throughout the rest of the code wherever possible,
* Try to be efficient in memory use, but this is not critical,
* Labour hard to be efficient in time use, and this is critical,
* Don't abhor floats - they work fast enough if you're clever,
* Don't avoid arrays and structs/classes,
* Don't avoid pointers,
* Use operator and function overloading where appropriate, particularly for vector algebra.
* Use operator and function overloading where appropriate.
Naming conventions:
* #defines are all capitals with optional underscores between words
* #defines are all CAPITALS_WITH_OPTIONAL_UNDERSCORES_BETWEEN_WORDS
* No underscores in other names - MakeReadableWithCapitalisation
* Class names and functions start with a CapitalLetter
* Variables start with a lowerCaseLetter
* Use veryLongDescriptiveNames
Structure:
There are six main classes:
@ -42,7 +54,7 @@ There are six main classes:
* Heat
* Move
* Platform, and
* Webserver
* Webserver
RepRap:
@ -50,12 +62,12 @@ This is just a container class for the single instances of all the others, and o
GCodes:
This class is fed GCodes, either from the web interface or from GCode files, interprests them, and requests
actions from the RepRap machine via the other classes.
This class is fed GCodes, either from the web interface, or from GCode files, or from a serial interface,
Interprets them, and requests actions from the RepRap machine via the other classes.
Heat:
This class imlements all heating and temperature control in the RepRap machine.
This class implements all heating and temperature control in the RepRap machine.
Move:
@ -76,36 +88,36 @@ interface to the RepRap machine. It uses the Knockout and Jquery Javascript lib
When the software is running there is one single instance of each main class, and all the memory allocation is
done on initialisation. new/malloc should not be used in the general running code, and delete is never
done on initialization. new/malloc should not be used in the general running code, and delete is never
used. Each class has an Init() function that resets it to its boot-up state; the constructors merely handle
that memory allocation on startup. Calling RepRap.Init() calls all the other Init()s in the right sequence.
There are other ancilliary classes that are declared in the .h files for the master classes that use them. For
There are other ancillary classes that are declared in the .h files for the master classes that use them. For
example, Move has a DDA class that implements a Bresenham/digital differential analyser.
Timing:
There is a single interrupt chain entered via Platform.Interrupt(). This controls movement step timing, and
this chain of code should be the only place that volatile declarations and structure/variable-locking are
There is a single interrupt chain entered via Platform.Interrupt(). This controls movement step timing, and
this chain of code should be the only place that volatile declarations and structure/variable-locking are
required. All the rest of the code is called sequentially and repeatedly as follows:
All the main classes have a Spin() function. These are called in a loop by the RepRap.Spin() function and implement
simple timesharing. No class does, or ever should, wait inside one of its functions for anything to happen or call
All the main classes have a Spin() function. These are called in a loop by the RepRap.Spin() function and implement
simple timesharing. No class does, or ever should, wait inside one of its functions for anything to happen or call
any sort of delay() function. The general rule is:
Can I do a thing?
Yes - do it
No - set a flag/timer to remind me to do it next-time-I'm-called/at-a-future-time and return.
The restriction this strategy places on almost all the code in the firmware (that it must execute quickly and
never cause waits or delays) is balanced by the fact that none of that code needs to worry about synchronicity,
locking, or other areas of code accessing items upon which it is working. As mentioned, only the interrupt
chain needs to concern itself with such problems. Unlike movement, heating (including PID controllers) does
not need the fast precision of timing that interrupts alone can offer. Indeed, most heating code only needs
The restriction this strategy places on almost all the code in the firmware (that it must execute quickly and
never cause waits or delays) is balanced by the fact that none of that code needs to worry about synchronization,
locking, or other areas of code accessing items upon which it is working. As mentioned, only the interrupt
chain needs to concern itself with such problems. Unlike movement, heating (including PID controllers) does
not need the fast precision of timing that interrupts alone can offer. Indeed, most heating code only needs
to execute a couple of times a second.
Most data is transferred bytewise, with classes typically containg code like this:
Most data is transferred bytewise, with classes' Spin() functions typically containing code like this:
Is a byte available for me?
Yes
@ -115,52 +127,18 @@ Most data is transferred bytewise, with classes typically containg code like thi
Act on the contents of my buffer
No
Return
No
Return
Note that it is simple to raise the "priority" of any class's activities relative to the others by calling its
No
Return
Note that it is simple to raise the "priority" of any class's activities relative to the others by calling its
Spin() function more than once from RepRap.Spin().
--------------------------------------------------------------------------------
This version is for the Arduino Due with an Ethernet shield with an SD card and
the RepRapPro Ltd Arduino DUE to Sanguinololu Adaptor.
(See https://github.com/reprappro/ARMadaptor)
Test compiling was with Arduino 1.5.2.
Upload it to your Due, put the ether shield on it, plug in a
network cable, and copy the files in the SD-image folder onto the SD.
The IP address for your browser is 192.168.1.14.
You can change that in Platform.h if you need to:
#define IP0 192
#define IP1 168
#define IP2 1
#define IP3 14
The password when the web browser asks for it is "reprap" with no quotes.
The password is intended to stop fidgety friends or colleagues from playing
with your RepRap. It is not intended to stop international cyberterrorists
hiding in a hollowed-out volcano from controlling your RepRap from the next
continent. For example, it is transmitted unencrypted...
If you open the Arduino serial monitor (115200 baud) you should see a
log of incoming HTTP requests and a record of any G Codes it thinks it
has to act upon.
Actually acting upon them will be added shortly :-)
-------------
Version 0.2 pre-alpha
Version 0.3n beta
Started: 18 November 2012
This date: 12 June 2013
Started: 2012-11-18
This README dated: 2013-12-06
Adrian Bowyer
RepRap Professional Ltd

Binary file not shown.

View file

@ -246,6 +246,7 @@ void RepRap::EmergencyStop()
for(i = 0; i < HEATERS; i++)
platform->SetHeater(i, 0.0);
// We do this twice, to avoid an interrupt switching
// a drive back on. move->Exit() should prevent
// interrupts doing this.
@ -259,6 +260,7 @@ void RepRap::EmergencyStop()
platform->Disable(i);
}
}
platform->Message(HOST_MESSAGE, "Emergency Stop! Reset the controller to continue.");
}

View file

@ -1,202 +0,0 @@
G1 F2000
G1 X180 Y100
G1 X179.96 Y102.525
G1 X179.841 Y105.048
G1 X179.641 Y107.566
G1 X179.363 Y110.077
G1 X179.005 Y112.577
G1 X178.569 Y115.065
G1 X178.054 Y117.538
G1 X177.461 Y119.993
G1 X176.792 Y122.428
G1 X176.045 Y124.841
G1 X175.223 Y127.23
G1 X174.326 Y129.591
G1 X173.355 Y131.922
G1 X172.311 Y134.222
G1 X171.194 Y136.488
G1 X170.007 Y138.717
G1 X168.75 Y140.908
G1 X167.424 Y143.058
G1 X166.031 Y145.165
G1 X164.573 Y147.227
G1 X163.049 Y149.242
G1 X161.464 Y151.208
G1 X159.816 Y153.122
G1 X158.11 Y154.984
G1 X156.345 Y156.791
G1 X154.524 Y158.542
G1 X152.649 Y160.234
G1 X150.721 Y161.866
G1 X148.743 Y163.436
G1 X146.716 Y164.943
G1 X144.642 Y166.386
G1 X142.524 Y167.762
G1 X140.364 Y169.071
G1 X138.163 Y170.31
G1 X135.925 Y171.48
G1 X133.65 Y172.579
G1 X131.342 Y173.605
G1 X129.003 Y174.557
G1 X126.635 Y175.436
G1 X124.24 Y176.239
G1 X121.822 Y176.966
G1 X119.381 Y177.617
G1 X116.921 Y178.19
G1 X114.444 Y178.685
G1 X111.953 Y179.102
G1 X109.45 Y179.44
G1 X106.938 Y179.699
G1 X104.418 Y179.878
G1 X101.894 Y179.978
G1 X99.3685 Y179.998
G1 X96.8434 Y179.938
G1 X94.3215 Y179.798
G1 X91.8052 Y179.579
G1 X89.2971 Y179.281
G1 X86.7997 Y178.903
G1 X84.3154 Y178.447
G1 X81.8467 Y177.913
G1 X79.3962 Y177.301
G1 X76.9661 Y176.612
G1 X74.5591 Y175.847
G1 X72.1774 Y175.006
G1 X69.8234 Y174.09
G1 X67.4995 Y173.101
G1 X65.208 Y172.038
G1 X62.9512 Y170.904
G1 X60.7314 Y169.699
G1 X58.5506 Y168.425
G1 X56.4112 Y167.082
G1 X54.3153 Y165.673
G1 X52.2648 Y164.198
G1 X50.262 Y162.659
G1 X48.3087 Y161.057
G1 X46.407 Y159.395
G1 X44.5587 Y157.674
G1 X42.7657 Y155.895
G1 X41.0297 Y154.06
G1 X39.3525 Y152.172
G1 X37.7357 Y150.231
G1 X36.181 Y148.24
G1 X34.6899 Y146.202
G1 X33.264 Y144.117
G1 X31.9045 Y141.988
G1 X30.613 Y139.818
G1 X29.3906 Y137.607
G1 X28.2385 Y135.359
G1 X27.1581 Y133.076
G1 X26.1502 Y130.76
G1 X25.2159 Y128.414
G1 X24.3562 Y126.039
G1 X23.5719 Y123.638
G1 X22.8638 Y121.213
G1 X22.2326 Y118.768
G1 X21.6789 Y116.303
G1 X21.2032 Y113.823
G1 X20.8061 Y111.328
G1 X20.488 Y108.823
G1 X20.2491 Y106.308
G1 X20.0897 Y103.787
G1 X20.01 Y101.263
G1 X20.01 Y98.7371
G1 X20.0897 Y96.2126
G1 X20.2491 Y93.6918
G1 X20.488 Y91.1773
G1 X20.8061 Y88.6716
G1 X21.2032 Y86.1773
G1 X21.6789 Y83.6966
G1 X22.2326 Y81.2323
G1 X22.8638 Y78.7866
G1 X23.5719 Y76.3621
G1 X24.3562 Y73.9612
G1 X25.2159 Y71.5862
G1 X26.1502 Y69.2395
G1 X27.1581 Y66.9235
G1 X28.2385 Y64.6405
G1 X29.3906 Y62.3927
G1 X30.613 Y60.1824
G1 X31.9045 Y58.0118
G1 X33.264 Y55.8831
G1 X34.6899 Y53.7983
G1 X36.181 Y51.7596
G1 X37.7357 Y49.769
G1 X39.3525 Y47.8284
G1 X41.0297 Y45.9399
G1 X42.7657 Y44.1052
G1 X44.5587 Y42.3262
G1 X46.407 Y40.6048
G1 X48.3087 Y38.9425
G1 X50.262 Y37.3412
G1 X52.2648 Y35.8022
G1 X54.3153 Y34.3273
G1 X56.4112 Y32.9178
G1 X58.5506 Y31.5752
G1 X60.7314 Y30.3008
G1 X62.9512 Y29.0959
G1 X65.208 Y27.9617
G1 X67.4995 Y26.8993
G1 X69.8234 Y25.9097
G1 X72.1774 Y24.994
G1 X74.5591 Y24.1531
G1 X76.9661 Y23.3877
G1 X79.3961 Y22.6988
G1 X81.8467 Y22.0869
G1 X84.3154 Y21.5526
G1 X86.7996 Y21.0966
G1 X89.2971 Y20.7192
G1 X91.8052 Y20.4208
G1 X94.3215 Y20.2018
G1 X96.8434 Y20.0623
G1 X99.3685 Y20.0025
G1 X101.894 Y20.0224
G1 X104.418 Y20.1221
G1 X106.938 Y20.3014
G1 X109.45 Y20.5601
G1 X111.953 Y20.898
G1 X114.444 Y21.3148
G1 X116.921 Y21.81
G1 X119.381 Y22.3831
G1 X121.822 Y23.0336
G1 X124.24 Y23.7609
G1 X126.635 Y24.5641
G1 X129.003 Y25.4425
G1 X131.342 Y26.3953
G1 X133.65 Y27.4214
G1 X135.925 Y28.5199
G1 X138.163 Y29.6896
G1 X140.364 Y30.9294
G1 X142.524 Y32.2381
G1 X144.642 Y33.6143
G1 X146.716 Y35.0567
G1 X148.743 Y36.5638
G1 X150.721 Y38.1341
G1 X152.649 Y39.7662
G1 X154.524 Y41.4582
G1 X156.345 Y43.2086
G1 X158.11 Y45.0157
G1 X159.816 Y46.8775
G1 X161.464 Y48.7923
G1 X163.049 Y50.7581
G1 X164.573 Y52.7731
G1 X166.031 Y54.8351
G1 X167.424 Y56.9421
G1 X168.75 Y59.092
G1 X170.007 Y61.2827
G1 X171.194 Y63.5121
G1 X172.311 Y65.7777
G1 X173.355 Y68.0775
G1 X174.326 Y70.4092
G1 X175.223 Y72.7703
G1 X176.045 Y75.1585
G1 X176.792 Y77.5716
G1 X177.461 Y80.007
G1 X178.054 Y82.4623
G1 X178.569 Y84.9351
G1 X179.005 Y87.4229
G1 X179.363 Y89.9232
G1 X179.641 Y92.4336
G1 X179.841 Y94.9515
G1 X179.96 Y97.4745
G1 X180 Y100

View file

@ -1,52 +1,202 @@
G1 F2000
G1 X70 Y50
G1 X69.8358 Y52.5575
G1 X69.3459 Y55.0731
G1 X68.5383 Y57.5053
G1 X67.4264 Y59.8144
G1 X66.0283 Y61.9622
G1 X64.367 Y63.9137
G1 X62.4698 Y65.6366
G1 X60.3679 Y67.1029
G1 X58.0957 Y68.2883
G1 X55.6906 Y69.1734
G1 X53.192 Y69.7436
G1 X50.641 Y69.9897
G1 X48.0795 Y69.9076
G1 X45.5496 Y69.4986
G1 X43.0927 Y68.7694
G1 X40.7492 Y67.732
G1 X38.5577 Y66.4034
G1 X36.554 Y64.8056
G1 X34.7711 Y62.9646
G1 X33.2382 Y60.9107
G1 X31.9806 Y58.6777
G1 X31.0189 Y56.3022
G1 X30.3688 Y53.8232
G1 X30.0411 Y51.2814
G1 X30.0411 Y48.7186
G1 X30.3688 Y46.1768
G1 X31.0189 Y43.6978
G1 X31.9806 Y41.3223
G1 X33.2382 Y39.0893
G1 X34.7711 Y37.0354
G1 X36.554 Y35.1944
G1 X38.5577 Y33.5966
G1 X40.7492 Y32.268
G1 X43.0927 Y31.2306
G1 X45.5496 Y30.5014
G1 X48.0795 Y30.0924
G1 X50.641 Y30.0103
G1 X53.192 Y30.2564
G1 X55.6906 Y30.8266
G1 X58.0957 Y31.7117
G1 X60.3678 Y32.8971
G1 X62.4698 Y34.3634
G1 X64.367 Y36.0863
G1 X66.0283 Y38.0378
G1 X67.4264 Y40.1856
G1 X68.5383 Y42.4947
G1 X69.3459 Y44.9269
G1 X69.8358 Y47.4425
G1 X70 Y50
G1 X180 Y100
G1 X179.96 Y102.525
G1 X179.841 Y105.048
G1 X179.641 Y107.566
G1 X179.363 Y110.077
G1 X179.005 Y112.577
G1 X178.569 Y115.065
G1 X178.054 Y117.538
G1 X177.461 Y119.993
G1 X176.792 Y122.428
G1 X176.045 Y124.841
G1 X175.223 Y127.23
G1 X174.326 Y129.591
G1 X173.355 Y131.922
G1 X172.311 Y134.222
G1 X171.194 Y136.488
G1 X170.007 Y138.717
G1 X168.75 Y140.908
G1 X167.424 Y143.058
G1 X166.031 Y145.165
G1 X164.573 Y147.227
G1 X163.049 Y149.242
G1 X161.464 Y151.208
G1 X159.816 Y153.122
G1 X158.11 Y154.984
G1 X156.345 Y156.791
G1 X154.524 Y158.542
G1 X152.649 Y160.234
G1 X150.721 Y161.866
G1 X148.743 Y163.436
G1 X146.716 Y164.943
G1 X144.642 Y166.386
G1 X142.524 Y167.762
G1 X140.364 Y169.071
G1 X138.163 Y170.31
G1 X135.925 Y171.48
G1 X133.65 Y172.579
G1 X131.342 Y173.605
G1 X129.003 Y174.557
G1 X126.635 Y175.436
G1 X124.24 Y176.239
G1 X121.822 Y176.966
G1 X119.381 Y177.617
G1 X116.921 Y178.19
G1 X114.444 Y178.685
G1 X111.953 Y179.102
G1 X109.45 Y179.44
G1 X106.938 Y179.699
G1 X104.418 Y179.878
G1 X101.894 Y179.978
G1 X99.3685 Y179.998
G1 X96.8434 Y179.938
G1 X94.3215 Y179.798
G1 X91.8052 Y179.579
G1 X89.2971 Y179.281
G1 X86.7997 Y178.903
G1 X84.3154 Y178.447
G1 X81.8467 Y177.913
G1 X79.3962 Y177.301
G1 X76.9661 Y176.612
G1 X74.5591 Y175.847
G1 X72.1774 Y175.006
G1 X69.8234 Y174.09
G1 X67.4995 Y173.101
G1 X65.208 Y172.038
G1 X62.9512 Y170.904
G1 X60.7314 Y169.699
G1 X58.5506 Y168.425
G1 X56.4112 Y167.082
G1 X54.3153 Y165.673
G1 X52.2648 Y164.198
G1 X50.262 Y162.659
G1 X48.3087 Y161.057
G1 X46.407 Y159.395
G1 X44.5587 Y157.674
G1 X42.7657 Y155.895
G1 X41.0297 Y154.06
G1 X39.3525 Y152.172
G1 X37.7357 Y150.231
G1 X36.181 Y148.24
G1 X34.6899 Y146.202
G1 X33.264 Y144.117
G1 X31.9045 Y141.988
G1 X30.613 Y139.818
G1 X29.3906 Y137.607
G1 X28.2385 Y135.359
G1 X27.1581 Y133.076
G1 X26.1502 Y130.76
G1 X25.2159 Y128.414
G1 X24.3562 Y126.039
G1 X23.5719 Y123.638
G1 X22.8638 Y121.213
G1 X22.2326 Y118.768
G1 X21.6789 Y116.303
G1 X21.2032 Y113.823
G1 X20.8061 Y111.328
G1 X20.488 Y108.823
G1 X20.2491 Y106.308
G1 X20.0897 Y103.787
G1 X20.01 Y101.263
G1 X20.01 Y98.7371
G1 X20.0897 Y96.2126
G1 X20.2491 Y93.6918
G1 X20.488 Y91.1773
G1 X20.8061 Y88.6716
G1 X21.2032 Y86.1773
G1 X21.6789 Y83.6966
G1 X22.2326 Y81.2323
G1 X22.8638 Y78.7866
G1 X23.5719 Y76.3621
G1 X24.3562 Y73.9612
G1 X25.2159 Y71.5862
G1 X26.1502 Y69.2395
G1 X27.1581 Y66.9235
G1 X28.2385 Y64.6405
G1 X29.3906 Y62.3927
G1 X30.613 Y60.1824
G1 X31.9045 Y58.0118
G1 X33.264 Y55.8831
G1 X34.6899 Y53.7983
G1 X36.181 Y51.7596
G1 X37.7357 Y49.769
G1 X39.3525 Y47.8284
G1 X41.0297 Y45.9399
G1 X42.7657 Y44.1052
G1 X44.5587 Y42.3262
G1 X46.407 Y40.6048
G1 X48.3087 Y38.9425
G1 X50.262 Y37.3412
G1 X52.2648 Y35.8022
G1 X54.3153 Y34.3273
G1 X56.4112 Y32.9178
G1 X58.5506 Y31.5752
G1 X60.7314 Y30.3008
G1 X62.9512 Y29.0959
G1 X65.208 Y27.9617
G1 X67.4995 Y26.8993
G1 X69.8234 Y25.9097
G1 X72.1774 Y24.994
G1 X74.5591 Y24.1531
G1 X76.9661 Y23.3877
G1 X79.3961 Y22.6988
G1 X81.8467 Y22.0869
G1 X84.3154 Y21.5526
G1 X86.7996 Y21.0966
G1 X89.2971 Y20.7192
G1 X91.8052 Y20.4208
G1 X94.3215 Y20.2018
G1 X96.8434 Y20.0623
G1 X99.3685 Y20.0025
G1 X101.894 Y20.0224
G1 X104.418 Y20.1221
G1 X106.938 Y20.3014
G1 X109.45 Y20.5601
G1 X111.953 Y20.898
G1 X114.444 Y21.3148
G1 X116.921 Y21.81
G1 X119.381 Y22.3831
G1 X121.822 Y23.0336
G1 X124.24 Y23.7609
G1 X126.635 Y24.5641
G1 X129.003 Y25.4425
G1 X131.342 Y26.3953
G1 X133.65 Y27.4214
G1 X135.925 Y28.5199
G1 X138.163 Y29.6896
G1 X140.364 Y30.9294
G1 X142.524 Y32.2381
G1 X144.642 Y33.6143
G1 X146.716 Y35.0567
G1 X148.743 Y36.5638
G1 X150.721 Y38.1341
G1 X152.649 Y39.7662
G1 X154.524 Y41.4582
G1 X156.345 Y43.2086
G1 X158.11 Y45.0157
G1 X159.816 Y46.8775
G1 X161.464 Y48.7923
G1 X163.049 Y50.7581
G1 X164.573 Y52.7731
G1 X166.031 Y54.8351
G1 X167.424 Y56.9421
G1 X168.75 Y59.092
G1 X170.007 Y61.2827
G1 X171.194 Y63.5121
G1 X172.311 Y65.7777
G1 X173.355 Y68.0775
G1 X174.326 Y70.4092
G1 X175.223 Y72.7703
G1 X176.045 Y75.1585
G1 X176.792 Y77.5716
G1 X177.461 Y80.007
G1 X178.054 Y82.4623
G1 X178.569 Y84.9351
G1 X179.005 Y87.4229
G1 X179.363 Y89.9232
G1 X179.641 Y92.4336
G1 X179.841 Y94.9515
G1 X179.96 Y97.4745
G1 X180 Y100

View file

@ -17,30 +17,19 @@
; top infill extrusion width = 0.85mm
; first layer extrusion width = 0.48mm
G21 ; set units to millimeters
M107
M104 S205 ; set temperature
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
M107; Fan off
G10 P0 S205 R205 ; Set extruder temperature
T0; Select extruder
M140 S55; Set bed temperature
M140 S65; Set bed temperature
G1 Z5 F200 ; lift nozzle
G28 X0 Y0; home X and Y axes
G1 X55 F2000; move to bed probe point
G28 Z0; zero Z
G32 ; Probe bed
G1 X0 Y0 F2000; Go to wait for warm position
G1 Z0 F200
G1 X2 Y50 F2000; Go to wait for warm position
M116; Wait for all temperatures
G10 P0 S205 R0 ; Set extruder temperature
T0; Select extruder
M116; Wait for all temperatures
M109 S205 ; wait for temperature to be reached
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
G1 F1800.000 E-1.00000
G1 Z0.240 F3600.000
G1 X83.244 Y72.792
G1 Z0.240 F3600.000
G1 F1800.000 E1.00000
G1 X99.024 Y56.882 F600.000 E1.08284
G1 X100.014 Y56.062 E0.06212

View file

@ -17,30 +17,19 @@
; top infill extrusion width = 0.85mm
; first layer extrusion width = 0.48mm
G21 ; set units to millimeters
M107
M104 S205 ; set temperature
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
M107; Fan off
G10 P0 S205 R205 ; Set extruder temperature
T0; Select extruder
M140 S65; Set bed temperature
G1 Z5 F200 ; lift nozzle
G28 X0 Y0; home X and Y axes
G1 X55 F2000; move to bed probe point
G28 Z0; zero Z
G32 ; Probe bed
G1 X2 Y50 F2000; Go to wait for warm position
G1 Z0 F200
M116; Wait for all temperatures
;M109 S205 ; wait for temperature to be reached
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
G10 P0 S205 R0 ; Set extruder temperature
T0; Select extruder
M116; Wait for all temperatures
G1 F1800.000 E-1.00000
G1 Z0.240 F3600.000
G1 X47.463 Y43.710
G1 Z0.240 F3600.000
G1 F1800.000 E1.00000
G1 X48.473 Y42.780 F600.000 E0.06635
G1 X49.653 Y42.090 E0.06605

7395
SD-image/gcodes/snowman.g Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
G1 X55 Y5 F2000
G1 Y55
G1 X5
G1 Y180
G1 X180
G1 Y5
G1 X30
G1 X55
G1 Y55 ; Confusing: F20
G1 Y55
G1 X5
G1 Y180
G1 X180
G1 Y5
G1 X55
M0

View file

@ -11,6 +11,7 @@ M92 E420; Set extruder steps/mm
G21 ; Work in mm
G90 ; Absolute positioning
M83 ; Extrusions relative
M558 P1 ; Turn Z Probe on
G31 Z0.5 P500 ; Set Z probe height and threshold
M906 X800 Y800 Z800 E800 ; Motor currents (mA)
T0 ; Select extruder 0

View file

@ -185,7 +185,7 @@ function heatRowHTML(heater, hNumber)
</tr>
<tr>
<td rowspan="2"><button data-bind="click: function(data, event) { sendHome('', data, event) }">Home<br>All</button></td>
<td rowspan="2"><button style="background-color:red" data-bind="click: function(data, event) { sendStop(data, event) }"><br>STOP<br></button></td>
<td colspan="4">- mm</td>
<td colspan="4">+ mm</td>
<td rowspan="2"><button data-bind="click: function(data, event) { motorsOff(data, event) }">Motors<br>off
@ -487,6 +487,11 @@ function viewModel()
$.get('/rr_gcode', {gcode: "G28"}, self.dummy);
};
self.sendStop = function(data, event)
{
$.get('/rr_gcode', {gcode: "M112"}, self.dummy);
};
self.deleteFile = function(data, event)
{
if(self.deleteButton() == 'Print a file')

View file

@ -122,17 +122,18 @@ bool Webserver::LoadGcodeBuffer(char* gc, bool convertWeb)
gcodeBuffer[gcodePointer] = 0;
gcodePointer = 0;
// We intercept two G Codes so we can deal with file manipulation. That
// We intercept three G/M Codes so we can deal with file manipulation and emergencies. That
// way things don't get out of sync, and - as a file name can contain
// a valid G code (!) - confusion is avoided.
int8_t fileAct = 0;
if(StringStartsWith(gcodeBuffer, "M30 ")) fileAct |= 1;
if(StringStartsWith(gcodeBuffer, "M23 ")) fileAct |= 2;
int8_t specialAction = 0;
if(StringStartsWith(gcodeBuffer, "M30 ")) specialAction = 1;
if(StringStartsWith(gcodeBuffer, "M23 ")) specialAction = 2;
if(StringStartsWith(gcodeBuffer, "M112")) specialAction = 3; // FIXME - suppose we ever have an M1121 ??
if(fileAct) // Delete or print a file?
if(specialAction) // Delete or print a file?
{
if(fileAct == 1) // Delete?
if(specialAction == 1) // Delete?
{
if(!platform->GetMassStorage()->Delete(platform->GetGCodeDir(), &gcodeBuffer[4]))
{
@ -140,9 +141,12 @@ bool Webserver::LoadGcodeBuffer(char* gc, bool convertWeb)
platform->Message(HOST_MESSAGE, &gcodeBuffer[4]);
platform->Message(HOST_MESSAGE, "\n");
}
} else // Print it
} else if (specialAction == 2)
{
reprap.GetGCodes()->QueueFileToPrint(&gcodeBuffer[4]);
} else
{
reprap.EmergencyStop();
}
// Check for further G Codes in the string