Version 0.78g

Fixed bug: if 5 point bed compansation was used then doing G32 more than
once would try to move the head off the edge of the bed unless the first
4 probe coordinates were reset between them.
Fixed bug: if the last command in a a macro file did not end in newline
then it might not be fully executed
Bug fix: potential array underrun in Gcodes::Pop()
Reduced Z dive height back to 5mm
This commit is contained in:
David Crocker 2014-07-30 15:54:17 +01:00
parent 653ba3b344
commit 30b67ff40a
12 changed files with 86 additions and 59 deletions

View file

@ -5,10 +5,10 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="it.baeyens.arduino.core.toolChain.release.674980254" moduleId="org.eclipse.cdt.core.settings" name="Release"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="it.baeyens.arduino.core.toolChain.release.674980254" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/> <externalSettings/>
<extensions> <extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
@ -21,8 +21,10 @@
<option id="it.baeyens.arduino.compiler.cpp.sketch.option.incpath.274618772" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.cpp.sketch.option.incpath" valueType="includePath"> <option id="it.baeyens.arduino.compiler.cpp.sketch.option.incpath.274618772" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.cpp.sketch.option.incpath" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/core}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/variant}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/variant}&quot;"/>
<listOptionValue builtIn="false" value="/usr/local/arduino-1.5.4/hardware/arduino/sam/system/libsam/include"/> <listOptionValue builtIn="false" value="C:/Arduino-1.5.4/hardware/arduino/sam/system/libsam/include"/>
<listOptionValue builtIn="false" value="&quot;C:\Arduino-1.5.4\hardware\arduino\sam\cores\arduino&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/network}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/network}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Flash}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/EMAC}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/Lwip}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/Lwip}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/MCP4461}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/MCP4461}&quot;"/>
@ -37,7 +39,7 @@
<option id="it.baeyens.arduino.compiler.c.sketch.option.incpath.1536622716" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.c.sketch.option.incpath" valueType="includePath"> <option id="it.baeyens.arduino.compiler.c.sketch.option.incpath.1536622716" name="Include Paths (-I)" superClass="it.baeyens.arduino.compiler.c.sketch.option.incpath" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/core}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/variant}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/arduino/variant}&quot;"/>
<listOptionValue builtIn="false" value="/usr/local/arduino-1.5.4/hardware/arduino/sam/system/libsam/include"/> <listOptionValue builtIn="false" value="C:/Arduino-1.5.4/hardware/arduino/sam/system/libsam/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/network}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/network}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/EMAC}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/EMAC}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/Lwip}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/RepRapFirmware/Libraries/Lwip}&quot;"/>
@ -71,6 +73,11 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/> <storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/RepRapFirmware"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject> </cproject>

View file

@ -70,15 +70,15 @@
<variableList> <variableList>
<variable> <variable>
<name>ArduinoHardwareLibPath</name> <name>ArduinoHardwareLibPath</name>
<value>file:/usr/local/arduino-1.5.4/hardware/arduino/sam/libraries</value> <value>file:/C:/Arduino-1.5.4/hardware/arduino/sam/libraries</value>
</variable> </variable>
<variable> <variable>
<name>ArduinoPinPath</name> <name>ArduinoPinPath</name>
<value>file:/usr/local/arduino-1.5.4/hardware/arduino/sam/variants</value> <value>file:/C:/Arduino-1.5.4/hardware/arduino/sam/variants</value>
</variable> </variable>
<variable> <variable>
<name>ArduinoPlatformPath</name> <name>ArduinoPlatformPath</name>
<value>file:/usr/local/arduino-1.5.4/hardware/arduino/sam</value> <value>file:/C:/Arduino-1.5.4/hardware/arduino/sam</value>
</variable> </variable>
</variableList> </variableList>
</projectDescription> </projectDescription>

View file

@ -1,4 +1,4 @@
Additional functionality in 0.78e-dc42 release compared to RRP 0.78: Additional functionality in 0.78g-dc42 release compared to RRP 0.78:
* The Duet can serve all the files needed by the web interface * The Duet can serve all the files needed by the web interface
@ -72,7 +72,7 @@ Additional functionality in 0.78e-dc42 release compared to RRP 0.78:
* M104 and M109 commands now accept an optional T parameter to specify the tool number, as generated by slic3r in multi-media gcode files. * M104 and M109 commands now accept an optional T parameter to specify the tool number, as generated by slic3r in multi-media gcode files.
* Movement code from RepRapPro's 0.89 dev version incorporated, including 5-point manual or automatic bed compensation mechanism. * Movement code from RepRapPro's 0.89 dev version incorporated, including 5-point manual or automatic bed compensation mechanism. A bug fix to this was added in version 0.78g.
* Heater status (off/standby/on) is included in the status poll response for the web interface. This will be used in a future version of the web interface. * Heater status (off/standby/on) is included in the status poll response for the web interface. This will be used in a future version of the web interface.
@ -94,9 +94,9 @@ Additional functionality in 0.78e-dc42 release compared to RRP 0.78:
* Bug fix: indentation of multipart messages sent to the USB interface now works properly * Bug fix: indentation of multipart messages sent to the USB interface now works properly
* Bug fix: if G10 was used to set just the active temperature for a tool, then the standby temperature for the same tool was set to an undefined value, and vice versa. * Bug fix: if G10 was used to set just the active temperature for a tool, then the standby temperature for the same tool was set to an undefined value, and vice versa
* Bug fix: if bed compensation or axis compensation was in use, then a G1 S1 command to home an axis could be prematurely terminated if the head was already at the endstop position for a different axis. * Bug fix: if bed compensation or axis compensation was in use, then a G1 S1 command to home an axis could be prematurely terminated if the head was already at the endstop position for a different axis
* Bug fix: if a tool was defined as using zero drives or zero extruders, it would be treated as assuming a collection of drives or extruders according to the vales in an uninitialised array * Bug fix: if a tool was defined as using zero drives or zero extruders, it would be treated as assuming a collection of drives or extruders according to the vales in an uninitialised array
@ -106,6 +106,8 @@ Additional functionality in 0.78e-dc42 release compared to RRP 0.78:
* Bug fix: print moves received just prior to an M109 or M190 command were not executed until after the heater had reached temperature instead of before * Bug fix: print moves received just prior to an M109 or M190 command were not executed until after the heater had reached temperature instead of before
* Bug fix: if the last command in a macro file did not have a newline character at the end then the command might not be fully executed
Additional functionality in web interface 0.95 compared to RRP 0.65: Additional functionality in web interface 0.95 compared to RRP 0.65:

View file

@ -24,8 +24,8 @@ Licence: GPL
#define CONFIGURATION_H #define CONFIGURATION_H
#define NAME "RepRapFirmware" #define NAME "RepRapFirmware"
#define VERSION "0.78f-dc42" #define VERSION "0.78g-dc42"
#define DATE "2014-07-27" #define DATE "2014-07-30"
#define AUTHORS "reprappro, dc42. zpl" #define AUTHORS "reprappro, dc42. zpl"
// Other firmware that we might switch to be compatible with. // 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 STANDBY_INTERRUPT_RATE 2.0e-4 // Seconds
#define NUMBER_OF_PROBE_POINTS 5 // Maximum number of probe points #define NUMBER_OF_PROBE_POINTS 5 // Maximum number of probe points
#define Z_DIVE 8.0 // Height from which to probe the bed (mm) #define Z_DIVE 5.0 // Height from which to probe the bed (mm)
#define TRIANGLE_0 -0.001 // Slightly less than 0 for point-in-triangle tests #define TRIANGLE_0 -0.001 // Slightly less than 0 for point-in-triangle tests
#define SILLY_Z_VALUE -9999.0 #define SILLY_Z_VALUE -9999.0

View file

@ -291,7 +291,7 @@ bool GCodes::Push()
bool GCodes::Pop() bool GCodes::Pop()
{ {
if(stackPointer <= 0) if(stackPointer < 1)
{ {
platform->Message(BOTH_ERROR_MESSAGE, "Pop(): stack underflow!\n"); platform->Message(BOTH_ERROR_MESSAGE, "Pop(): stack underflow!\n");
return true; return true;
@ -506,6 +506,14 @@ bool GCodes::DoFileCannedCycles(const char* fileName)
return false; return false;
} }
// Complete the current move (must do this before checking whether we have finished the file in case it didn't end in newline)
if (cannedCycleGCode->Active())
{
cannedCycleGCode->SetFinished(ActOnCode(cannedCycleGCode));
return false;
}
// Have we finished the file? // Have we finished the file?
if (!fileBeingPrinted.IsLive()) if (!fileBeingPrinted.IsLive())
@ -521,12 +529,6 @@ bool GCodes::DoFileCannedCycles(const char* fileName)
// No - Do more of the file // No - Do more of the file
if (cannedCycleGCode->Active())
{
cannedCycleGCode->SetFinished(ActOnCode(cannedCycleGCode));
return false;
}
DoFilePrint(cannedCycleGCode); DoFilePrint(cannedCycleGCode);
return false; return false;
} }
@ -548,7 +550,7 @@ bool GCodes::FileCannedCyclesReturn()
// To execute any move, call this until it returns true. // To execute any move, call this until it returns true.
// moveToDo[] entries corresponding with false entries in action[] will // moveToDo[] entries corresponding with false entries in action[] will
// be ignored. Recall that moveToDo[DRIVES] should contain the feedrate // be ignored. Recall that moveToDo[DRIVES] should contain the feed rate
// you want (if action[DRIVES] is true). // you want (if action[DRIVES] is true).
bool GCodes::DoCannedCycleMove(EndstopChecks ce) bool GCodes::DoCannedCycleMove(EndstopChecks ce)
@ -569,7 +571,9 @@ bool GCodes::DoCannedCycleMove(EndstopChecks ce)
for (int8_t drive = 0; drive <= DRIVES; drive++) for (int8_t drive = 0; drive <= DRIVES; drive++)
{ {
if (activeDrive[drive]) if (activeDrive[drive])
{
moveBuffer[drive] = moveToDo[drive]; moveBuffer[drive] = moveToDo[drive];
}
} }
endStopsToCheck = ce; endStopsToCheck = ce;
cannedCycleMoveQueued = true; cannedCycleMoveQueued = true;
@ -850,19 +854,9 @@ bool GCodes::SetSingleZProbeAtAPosition(GCodeBuffer *gb, char *reply)
int probePointIndex = gb->GetIValue(); int probePointIndex = gb->GetIValue();
float x, y, z; float x = (gb->Seen(axisLetters[X_AXIS])) ? gb->GetFValue() : moveBuffer[X_AXIS];
if (gb->Seen(axisLetters[X_AXIS])) float y = (gb->Seen(axisLetters[Y_AXIS])) ? gb->GetFValue() : moveBuffer[Y_AXIS];
x = gb->GetFValue(); float z = (gb->Seen(axisLetters[Z_AXIS])) ? gb->GetFValue() : moveBuffer[Z_AXIS];
else
x = moveBuffer[X_AXIS];
if (gb->Seen(axisLetters[Y_AXIS]))
y = gb->GetFValue();
else
y = moveBuffer[Y_AXIS];
if (gb->Seen(axisLetters[Z_AXIS]))
z = gb->GetFValue();
else
z = moveBuffer[Z_AXIS];
probeCount = probePointIndex; probeCount = probePointIndex;
reprap.GetMove()->SetXBedProbePoint(probeCount, x); reprap.GetMove()->SetXBedProbePoint(probeCount, x);
@ -906,7 +900,7 @@ bool GCodes::DoMultipleZProbe(char *reply)
{ {
if (reprap.GetMove()->NumberOfXYProbePoints() < 3) if (reprap.GetMove()->NumberOfXYProbePoints() < 3)
{ {
platform->Message(HOST_MESSAGE, "Bed probing: there needs to be 3 or more points set.\n"); strncpy(reply, "Bed probing: there needs to be 3 or more points set.\n", STRING_LENGTH);
return true; return true;
} }

View file

@ -765,12 +765,12 @@ void Move::SetAxisCompensation(int8_t axis, float tangent)
void Move::BarycentricCoordinates(int8_t p1, int8_t p2, int8_t p3, float x, float y, float& l1, float& l2, float& l3) const void Move::BarycentricCoordinates(int8_t p1, int8_t p2, int8_t p3, float x, float y, float& l1, float& l2, float& l3) const
{ {
float y23 = yBedProbePoints[p2] - yBedProbePoints[p3]; float y23 = baryYBedProbePoints[p2] - baryYBedProbePoints[p3];
float x3 = x - xBedProbePoints[p3]; float x3 = x - baryXBedProbePoints[p3];
float x32 = xBedProbePoints[p3] - xBedProbePoints[p2]; float x32 = baryXBedProbePoints[p3] - baryXBedProbePoints[p2];
float y3 = y - yBedProbePoints[p3]; float y3 = y - baryYBedProbePoints[p3];
float x13 = xBedProbePoints[p1] - xBedProbePoints[p3]; float x13 = baryXBedProbePoints[p1] - baryXBedProbePoints[p3];
float y13 = yBedProbePoints[p1] - yBedProbePoints[p3]; float y13 = baryYBedProbePoints[p1] - baryYBedProbePoints[p3];
float iDet = 1.0 / (y23 * x13 + x32 * y13); float iDet = 1.0 / (y23 * x13 + x32 * y13);
l1 = (y23 * x3 + x32 * y3) * iDet; l1 = (y23 * x3 + x32 * y3) * iDet;
l2 = (-y13 * x3 + x13 * y3) * iDet; l2 = (-y13 * x3 + x13 * y3) * iDet;
@ -798,7 +798,7 @@ float Move::TriangleZ(float x, float y) const
BarycentricCoordinates(i, j, 4, x, y, l1, l2, l3); BarycentricCoordinates(i, j, 4, x, y, l1, l2, l3);
if(l1 > TRIANGLE_0 && l2 > TRIANGLE_0 && l3 > TRIANGLE_0) if(l1 > TRIANGLE_0 && l2 > TRIANGLE_0 && l3 > TRIANGLE_0)
{ {
return l1 * zBedProbePoints[i] + l2 * zBedProbePoints[j] + l3 * zBedProbePoints[4]; return l1 * baryZBedProbePoints[i] + l2 * baryZBedProbePoints[j] + l3 * baryZBedProbePoints[4];
} }
} }
platform->Message(HOST_MESSAGE, "Triangle interpolation: point outside all triangles!"); platform->Message(HOST_MESSAGE, "Triangle interpolation: point outside all triangles!");
@ -857,10 +857,13 @@ void Move::SetProbedBedEquation(char *reply)
float x10 = xBedProbePoints[i] - xBedProbePoints[4]; float x10 = xBedProbePoints[i] - xBedProbePoints[4];
float y10 = yBedProbePoints[i] - yBedProbePoints[4]; float y10 = yBedProbePoints[i] - yBedProbePoints[4];
float z10 = zBedProbePoints[i] - zBedProbePoints[4]; float z10 = zBedProbePoints[i] - zBedProbePoints[4];
xBedProbePoints[i] = xBedProbePoints[4] + 2.0 * x10; baryXBedProbePoints[i] = xBedProbePoints[4] + 2.0 * x10;
yBedProbePoints[i] = yBedProbePoints[4] + 2.0 * y10; baryYBedProbePoints[i] = yBedProbePoints[4] + 2.0 * y10;
zBedProbePoints[i] = zBedProbePoints[4] + 2.0 * z10; baryZBedProbePoints[i] = zBedProbePoints[4] + 2.0 * z10;
} }
baryXBedProbePoints[4] = xBedProbePoints[4];
baryYBedProbePoints[4] = yBedProbePoints[4];
baryZBedProbePoints[4] = zBedProbePoints[4];
identityBedTransform = false; identityBedTransform = false;
break; break;

7
Move.h
View file

@ -265,8 +265,11 @@ class Move
float stepDistances[(1<<DRIVES)]; // The length of steps in different numbers of dimensions float stepDistances[(1<<DRIVES)]; // The length of steps in different numbers of dimensions
long nextMachineEndPoints[DRIVES+1]; // The next endpoint in machine coordinates (i.e. steps) long nextMachineEndPoints[DRIVES+1]; // The next endpoint in machine coordinates (i.e. steps)
float xBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe float xBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe
float yBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe float yBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Y coordinates of the points on the bed at which to probe
float zBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the points on the bed at which to probe float zBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Z coordinates of the points on the bed at which to probe
float baryXBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The X coordinates of the triangle corner points
float baryYBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Y coordinates of the triangle corner points
float baryZBedProbePoints[NUMBER_OF_PROBE_POINTS]; // The Z coordinates of the triangle corner points
uint8_t probePointSet[NUMBER_OF_PROBE_POINTS]; // Has the XY of this point been set? Has the Z been probed? uint8_t probePointSet[NUMBER_OF_PROBE_POINTS]; // Has the XY of this point been set? Has the Z been probed?
float aX, aY, aC; // Bed plane explicit equation z' = z + aX*x + aY*y + aC float aX, aY, aC; // Bed plane explicit equation z' = z + aX*x + aY*y + aC
float tanXY, tanYZ, tanXZ; // Axis compensation - 90 degrees + angle gives angle between axes float tanXY, tanYZ, tanXZ; // Axis compensation - 90 degrees + angle gives angle between axes

View file

@ -113,6 +113,16 @@ void Platform::Init()
pinMode(atxPowerPin, OUTPUT); pinMode(atxPowerPin, OUTPUT);
DueFlashStorage::init(); DueFlashStorage::init();
// We really want to use static_assert here, but the ancient version of gcc used by Arduino doesn't support it
//static_assert(sizeof(nvData) <= 1024, "NVData too large");
// So instead, create a reference to a non-existent declaration if the condition fails.
// We are relying on the compiler optimizing this out if the condition is false
// Watch out for the build warning "undefined reference to 'NonExistantFunction()' if this fails.
if (!(sizeof(nvData) <= 1024))
{
extern void BadStaticAssert();
BadStaticAssert();
}
DueFlashStorage::read(nvAddress, &nvData, sizeof(nvData)); DueFlashStorage::read(nvAddress, &nvData, sizeof(nvData));
if (nvData.magic != FlashData::magicValue) if (nvData.magic != FlashData::magicValue)
{ {

Binary file not shown.

View file

@ -472,12 +472,6 @@ void Webserver::StoreGcodeData(const char* data, size_t len)
void Webserver::ConnectionLost(const ConnectionState *cs) void Webserver::ConnectionLost(const ConnectionState *cs)
{ {
uint16_t local_port = cs->GetLocalPort(); uint16_t local_port = cs->GetLocalPort();
if (reprap.Debug())
{
snprintf(scratchString, STRING_LENGTH, "Webserver: ConnectionLost called with port %d\n", local_port);
platform->Message(DEBUG_MESSAGE, scratchString);
}
ProtocolInterpreter *interpreter; ProtocolInterpreter *interpreter;
switch (local_port) switch (local_port)
{ {
@ -497,6 +491,13 @@ void Webserver::ConnectionLost(const ConnectionState *cs)
interpreter = ftpInterpreter; interpreter = ftpInterpreter;
break; break;
} }
if (interpreter->DebugEnabled())
{
debugPrintf("Webserver: ConnectionLost called with port %d\n", local_port);
platform->Message(DEBUG_MESSAGE, scratchString);
}
interpreter->ConnectionLost(local_port); interpreter->ConnectionLost(local_port);
// When our reading connection has been lost, it is no longer important which // When our reading connection has been lost, it is no longer important which
@ -682,7 +683,11 @@ void ProtocolInterpreter::FinishUpload(const long file_length)
filenameBeingUploaded[0] = 0; filenameBeingUploaded[0] = 0;
} }
// This is overridden in class httpInterpreter
bool ProtocolInterpreter::DebugEnabled() const
{
return reprap.Debug();
}
//******************************************************************************************** //********************************************************************************************
// //
@ -1582,7 +1587,7 @@ Webserver::FtpInterpreter::FtpInterpreter(Platform *p, Webserver *ws)
void Webserver::FtpInterpreter::ConnectionEstablished() void Webserver::FtpInterpreter::ConnectionEstablished()
{ {
if (reprap.Debug()) if (DebugEnabled())
{ {
platform->Message(DEBUG_MESSAGE, "Webserver: FTP connection established!\n"); platform->Message(DEBUG_MESSAGE, "Webserver: FTP connection established!\n");
} }
@ -1675,7 +1680,7 @@ bool Webserver::FtpInterpreter::CharFromClient(char c)
case '\n': case '\n':
clientMessage[clientPointer++] = 0; clientMessage[clientPointer++] = 0;
if (reprap.Debug()) if (DebugEnabled())
{ {
snprintf(scratchString, STRING_LENGTH, "FtpInterpreter::ProcessLine called with state %d:\n%s\n", state, clientMessage); snprintf(scratchString, STRING_LENGTH, "FtpInterpreter::ProcessLine called with state %d:\n%s\n", state, clientMessage);
platform->Message(DEBUG_MESSAGE, scratchString); platform->Message(DEBUG_MESSAGE, scratchString);
@ -1688,7 +1693,7 @@ bool Webserver::FtpInterpreter::CharFromClient(char c)
return true; return true;
} }
if (reprap.Debug()) if (DebugEnabled())
{ {
platform->Message(DEBUG_MESSAGE, "FtpInterpreter::ProcessLine call finished."); platform->Message(DEBUG_MESSAGE, "FtpInterpreter::ProcessLine call finished.");
} }
@ -1967,7 +1972,7 @@ void Webserver::FtpInterpreter::ProcessLine()
break; break;
case waitingForPasvPort: case waitingForPasvPort:
if (!reprap.Debug() && platform->Time() - portOpenTime > pasvPortTimeout) if (!DebugEnabled() && platform->Time() - portOpenTime > pasvPortTimeout)
{ {
SendReply(425, "Failed to establish connection."); SendReply(425, "Failed to establish connection.");

View file

@ -76,6 +76,8 @@ class ProtocolInterpreter
virtual bool StoreUploadData(const char* data, unsigned int len); virtual bool StoreUploadData(const char* data, unsigned int len);
virtual bool FlushUploadData(); virtual bool FlushUploadData();
virtual bool DebugEnabled() const;
void CancelUpload(); void CancelUpload();
bool IsUploading() const { return uploadState != notUploading; } bool IsUploading() const { return uploadState != notUploading; }
@ -146,6 +148,7 @@ class Webserver
void ResetState(); void ResetState();
bool FlushUploadData(); bool FlushUploadData();
virtual bool DebugEnabled() /*override*/ const { return webDebug; }
void ReceivedGcodeReply(); void ReceivedGcodeReply();
void SetDebug(bool b) { webDebug = b; } void SetDebug(bool b) { webDebug = b; }