Further improvements to web upload and tidy-up
Further improved web file upload speed Dealt with Eclipse code analysis warnings Made some more functions and parameters const-correct
This commit is contained in:
parent
603c0c79c5
commit
9edaed4ac1
13 changed files with 164 additions and 151 deletions
|
@ -24,8 +24,8 @@ Licence: GPL
|
|||
#define CONFIGURATION_H
|
||||
|
||||
#define NAME "RepRapFirmware"
|
||||
#define VERSION "0.57d-dc42"
|
||||
#define DATE "2014-01-29"
|
||||
#define VERSION "0.57e-dc42"
|
||||
#define DATE "2014-01-30"
|
||||
#define LAST_AUTHOR "reprappro.com"
|
||||
|
||||
// Other firmware that we might switch to be compatible with.
|
||||
|
|
83
GCodes.cpp
83
GCodes.cpp
|
@ -145,15 +145,26 @@ void GCodes::Spin()
|
|||
// in the same order for the same reason.
|
||||
|
||||
if(webserver->GCodeAvailable())
|
||||
{
|
||||
int8_t i = 0;
|
||||
do
|
||||
{
|
||||
char b = webserver->ReadGCode();
|
||||
if(webGCode->Put(b))
|
||||
{
|
||||
// we have a complete gcode
|
||||
if(webGCode->WritingFileDirectory() != NULL)
|
||||
{
|
||||
WriteGCodeToFile(webGCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
webGCode->SetFinished(ActOnGcode(webGCode));
|
||||
}
|
||||
break; // stop after receiving a complete gcode in case we haven't finished processing it
|
||||
}
|
||||
++i;
|
||||
} while ( i < 16 && webserver->GCodeAvailable());
|
||||
platform->ClassReport("GCodes", longWait);
|
||||
return;
|
||||
}
|
||||
|
@ -300,8 +311,6 @@ bool GCodes::Pop()
|
|||
|
||||
void GCodes::LoadMoveBufferFromGCode(GCodeBuffer *gb, bool doingG92, bool applyLimits)
|
||||
{
|
||||
float absE;
|
||||
|
||||
for(uint8_t i = 0; i < DRIVES; i++)
|
||||
{
|
||||
if(i < AXES)
|
||||
|
@ -313,9 +322,9 @@ void GCodes::LoadMoveBufferFromGCode(GCodeBuffer *gb, bool doingG92, bool applyL
|
|||
{
|
||||
moveArg += moveBuffer[i];
|
||||
}
|
||||
if (applyLimits && axisIsHomed[i] & !doingG92)
|
||||
if (applyLimits && i < 2 && axisIsHomed[i] && !doingG92) // limit X and Y moves unless doing G92
|
||||
{
|
||||
if (moveArg < (i == 2 ? -5.0 : 0.0)) // limits are 0 for X, Y and -5mm for Z
|
||||
if (moveArg < 0.0)
|
||||
{
|
||||
moveArg = 0.0;
|
||||
}
|
||||
|
@ -339,7 +348,7 @@ void GCodes::LoadMoveBufferFromGCode(GCodeBuffer *gb, bool doingG92, bool applyL
|
|||
moveBuffer[i] = moveArg;
|
||||
else
|
||||
{
|
||||
absE = moveArg;
|
||||
float absE = moveArg;
|
||||
moveBuffer[i] = absE - lastPos[i - AXES];
|
||||
lastPos[i - AXES] = absE;
|
||||
}
|
||||
|
@ -876,14 +885,17 @@ char* GCodes::GetCurrentCoordinates()
|
|||
return scratchString;
|
||||
}
|
||||
|
||||
char* GCodes::OpenFileToWrite(char* directory, char* fileName, GCodeBuffer *gb)
|
||||
void GCodes::OpenFileToWrite(const char* directory, const char* fileName, GCodeBuffer *gb)
|
||||
{
|
||||
fileBeingWritten = platform->GetFileStore(directory, fileName, true);
|
||||
if(fileBeingWritten == NULL)
|
||||
{
|
||||
platform->Message(HOST_MESSAGE, "Can't open GCode file for writing.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
gb->SetWritingFileDirectory(directory);
|
||||
|
||||
}
|
||||
eofStringCounter = 0;
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1111,7 @@ bool GCodes::StandbyHeaters()
|
|||
void GCodes::SetEthernetAddress(GCodeBuffer *gb, int mCode)
|
||||
{
|
||||
byte eth[4];
|
||||
char* ipString = gb->GetString();
|
||||
const char* ipString = gb->GetString();
|
||||
uint8_t sp = 0;
|
||||
uint8_t spp = 0;
|
||||
uint8_t ipp = 0;
|
||||
|
@ -1107,9 +1119,7 @@ void GCodes::SetEthernetAddress(GCodeBuffer *gb, int mCode)
|
|||
{
|
||||
if(ipString[sp] == '.')
|
||||
{
|
||||
ipString[sp] = 0;
|
||||
eth[ipp] = atoi(&ipString[spp]);
|
||||
ipString[sp] = '.';
|
||||
ipp++;
|
||||
if(ipp > 3)
|
||||
{
|
||||
|
@ -1244,9 +1254,6 @@ void GCodes::HandleReply(bool error, bool fromLine, const char* reply, char gMOr
|
|||
bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
||||
{
|
||||
int code;
|
||||
float value;
|
||||
int iValue;
|
||||
char* str;
|
||||
bool result = true;
|
||||
bool error = false;
|
||||
bool resend = false;
|
||||
|
@ -1401,9 +1408,11 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
break;
|
||||
|
||||
case 28: // Write to file
|
||||
str = gb->GetUnprecedentedString();
|
||||
{
|
||||
const char* str = gb->GetUnprecedentedString();
|
||||
OpenFileToWrite(platform->GetGCodeDir(), str, gb);
|
||||
snprintf(reply, STRING_LENGTH, "Writing to file: %s", str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 29: // End of file being written; should be intercepted before getting here
|
||||
|
@ -1499,12 +1508,14 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
break;
|
||||
|
||||
case 114: // Deprecated
|
||||
str = GetCurrentCoordinates();
|
||||
{
|
||||
const char* str = GetCurrentCoordinates();
|
||||
if(str != 0)
|
||||
{
|
||||
strncpy(reply, str, STRING_LENGTH);
|
||||
} else
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 115: // Print firmware version
|
||||
|
@ -1517,7 +1528,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
reprap.GetHeat()->SetActiveTemperature(1, gb->GetFValue()); // 0 is the bed
|
||||
reprap.GetHeat()->Activate(1);
|
||||
}
|
||||
// Deliberate fall-through to case 116 here to wait for temperatures
|
||||
/* no break */
|
||||
case 116: // Wait for everything, especially set temperatures
|
||||
if(!AllMovesAreFinishedAndMoveBufferIsLoaded())
|
||||
return false;
|
||||
|
@ -1562,6 +1573,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
case 201: // Set axis accelerations
|
||||
for(int8_t drive = 0; drive < DRIVES; drive++)
|
||||
{
|
||||
float value;
|
||||
if(gb->Seen(gCodeLetters[drive]))
|
||||
{
|
||||
value = gb->GetFValue();
|
||||
|
@ -1577,7 +1589,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
{
|
||||
if(gb->Seen(gCodeLetters[drive]))
|
||||
{
|
||||
value = gb->GetFValue()*distanceScale*0.016666667; // G Code feedrates are in mm/minute; we need mm/sec;
|
||||
float value = gb->GetFValue()*distanceScale*0.016666667; // G Code feedrates are in mm/minute; we need mm/sec;
|
||||
platform->SetMaxFeedrate(drive, value);
|
||||
}
|
||||
}
|
||||
|
@ -1595,7 +1607,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
{
|
||||
if(gb->Seen(gCodeLetters[axis]))
|
||||
{
|
||||
value = gb->GetFValue()*distanceScale;
|
||||
float value = gb->GetFValue()*distanceScale;
|
||||
platform->SetAxisLength(axis, value);
|
||||
}
|
||||
}
|
||||
|
@ -1606,7 +1618,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
{
|
||||
if(gb->Seen(gCodeLetters[axis]))
|
||||
{
|
||||
value = gb->GetFValue()*distanceScale*0.016666667;
|
||||
float value = gb->GetFValue()*distanceScale*0.016666667;
|
||||
platform->SetHomeFeedRate(axis, value);
|
||||
}
|
||||
}
|
||||
|
@ -1640,7 +1652,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
SetEthernetAddress(gb, code);
|
||||
else
|
||||
{
|
||||
byte *ip = platform->IPAddress();
|
||||
const byte *ip = platform->IPAddress();
|
||||
snprintf(reply, STRING_LENGTH, "IP address: %d.%d.%d.%d\n ", ip[0], ip[1], ip[2], ip[3]);
|
||||
}
|
||||
break;
|
||||
|
@ -1650,7 +1662,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
SetEthernetAddress(gb, code);
|
||||
else
|
||||
{
|
||||
byte *nm = platform->NetMask();
|
||||
const byte *nm = platform->NetMask();
|
||||
snprintf(reply, STRING_LENGTH, "Net mask: %d.%d.%d.%d\n ", nm[0], nm[1], nm[2], nm[3]);
|
||||
}
|
||||
break;
|
||||
|
@ -1660,7 +1672,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
SetEthernetAddress(gb, code);
|
||||
else
|
||||
{
|
||||
byte *gw = platform->GateWay();
|
||||
const byte *gw = platform->GateWay();
|
||||
snprintf(reply, STRING_LENGTH, "Gateway: %d.%d.%d.%d\n ", gw[0], gw[1], gw[2], gw[3]);
|
||||
}
|
||||
break;
|
||||
|
@ -1673,7 +1685,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
case 556: // Axis compensation
|
||||
if(gb->Seen('S'))
|
||||
{
|
||||
value = gb->GetFValue();
|
||||
float value = gb->GetFValue();
|
||||
for(int8_t axis = 0; axis < AXES; axis++)
|
||||
if(gb->Seen(gCodeLetters[axis]))
|
||||
reprap.GetMove()->SetAxisCompensation(axis, gb->GetFValue()/value);
|
||||
|
@ -1683,7 +1695,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
case 557: // Set Z probe point coordinates
|
||||
if(gb->Seen('P'))
|
||||
{
|
||||
iValue = gb->GetIValue();
|
||||
int iValue = gb->GetIValue();
|
||||
if(gb->Seen(gCodeLetters[X_AXIS]))
|
||||
reprap.GetMove()->SetXBedProbePoint(iValue, gb->GetFValue());
|
||||
if(gb->Seen(gCodeLetters[Y_AXIS]))
|
||||
|
@ -1703,18 +1715,23 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
break;
|
||||
|
||||
case 559: // Upload config.g
|
||||
{
|
||||
const char* str;
|
||||
if(gb->Seen('P'))
|
||||
str = gb->GetString();
|
||||
else
|
||||
str = platform->GetConfigFile();
|
||||
OpenFileToWrite(platform->GetSysDir(), str, gb);
|
||||
snprintf(reply, STRING_LENGTH, "Writing to file: %s", str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 560: // Upload reprap.htm
|
||||
str = INDEX_PAGE;
|
||||
{
|
||||
const char* str = INDEX_PAGE;
|
||||
OpenFileToWrite(platform->GetWebDir(), str, gb);
|
||||
snprintf(reply, STRING_LENGTH, "Writing to file: %s", str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 561:
|
||||
|
@ -1724,7 +1741,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
case 562: // Reset temperature fault - use with great caution
|
||||
if(gb->Seen('P'))
|
||||
{
|
||||
iValue = gb->GetIValue();
|
||||
int iValue = gb->GetIValue();
|
||||
reprap.GetHeat()->ResetFault(iValue);
|
||||
}
|
||||
break;
|
||||
|
@ -1755,7 +1772,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
{
|
||||
if(gb->Seen(gCodeLetters[i]))
|
||||
{
|
||||
value = gb->GetFValue(); // mA
|
||||
float value = gb->GetFValue(); // mA
|
||||
platform->SetMotorCurrent(i, value);
|
||||
}
|
||||
}
|
||||
|
@ -1826,7 +1843,7 @@ bool GCodes::ActOnGcode(GCodeBuffer *gb)
|
|||
|
||||
// This class stores a single G Code and provides functions to allow it to be parsed
|
||||
|
||||
GCodeBuffer::GCodeBuffer(Platform* p, char* id)
|
||||
GCodeBuffer::GCodeBuffer(Platform* p, const char* id)
|
||||
{
|
||||
platform = p;
|
||||
identity = id;
|
||||
|
@ -1843,7 +1860,7 @@ void GCodeBuffer::Init()
|
|||
int GCodeBuffer::CheckSum()
|
||||
{
|
||||
int cs = 0;
|
||||
for(int i = 0; gcodeBuffer[i] != '*' && gcodeBuffer[i] != NULL; i++)
|
||||
for(int i = 0; gcodeBuffer[i] != '*' && gcodeBuffer[i] != 0; i++)
|
||||
cs = cs ^ gcodeBuffer[i];
|
||||
cs &= 0xff; // Defensive programming...
|
||||
return cs;
|
||||
|
@ -1864,7 +1881,7 @@ bool GCodeBuffer::Put(char c)
|
|||
{
|
||||
gcodeBuffer[gcodePointer] = 0;
|
||||
Init();
|
||||
if(reprap.Debug() && gcodeBuffer[0]) // Don't bother with blank/comment lines
|
||||
if(reprap.Debug() && gcodeBuffer[0] && !writingFileDirectory) // Don't bother with blank/comment lines
|
||||
{
|
||||
platform->Message(HOST_MESSAGE, identity);
|
||||
platform->Message(HOST_MESSAGE, gcodeBuffer);
|
||||
|
@ -1966,14 +1983,14 @@ float GCodeBuffer::GetFValue()
|
|||
// It will be the whole of the rest of the GCode string, so strings
|
||||
// should always be the last parameter.
|
||||
|
||||
char* GCodeBuffer::GetString()
|
||||
const char* GCodeBuffer::GetString()
|
||||
{
|
||||
if(readPointer < 0)
|
||||
{
|
||||
platform->Message(HOST_MESSAGE, "GCodes: Attempt to read a GCode string before a search.\n");
|
||||
return "";
|
||||
}
|
||||
char* result = &gcodeBuffer[readPointer+1];
|
||||
const char* result = &gcodeBuffer[readPointer+1];
|
||||
readPointer = -1;
|
||||
return result;
|
||||
}
|
||||
|
@ -1989,7 +2006,7 @@ char* GCodeBuffer::GetString()
|
|||
// preference use GetString() which requires the string to have
|
||||
// been preceded by a tag letter.
|
||||
|
||||
char* GCodeBuffer::GetUnprecedentedString()
|
||||
const char* GCodeBuffer::GetUnprecedentedString()
|
||||
{
|
||||
readPointer = 0;
|
||||
while(gcodeBuffer[readPointer] && gcodeBuffer[readPointer] != ' ')
|
||||
|
|
24
GCodes.h
24
GCodes.h
|
@ -32,31 +32,31 @@ Licence: GPL
|
|||
class GCodeBuffer
|
||||
{
|
||||
public:
|
||||
GCodeBuffer(Platform* p, char* id);
|
||||
GCodeBuffer(Platform* p, const char* id);
|
||||
void Init();
|
||||
bool Put(char c);
|
||||
bool Seen(char c);
|
||||
float GetFValue();
|
||||
int GetIValue();
|
||||
long GetLValue();
|
||||
char* GetUnprecedentedString();
|
||||
char* GetString();
|
||||
char* Buffer();
|
||||
const char* GetUnprecedentedString();
|
||||
const char* GetString();
|
||||
const char* Buffer();
|
||||
bool Finished() const;
|
||||
void SetFinished(bool f);
|
||||
char* WritingFileDirectory() const;
|
||||
void SetWritingFileDirectory(char* wfd);
|
||||
const char* WritingFileDirectory() const;
|
||||
void SetWritingFileDirectory(const char* wfd);
|
||||
|
||||
private:
|
||||
int CheckSum();
|
||||
Platform* platform;
|
||||
char gcodeBuffer[GCODE_LENGTH];
|
||||
char* identity;
|
||||
const char* identity;
|
||||
int gcodePointer;
|
||||
int readPointer;
|
||||
bool inComment;
|
||||
bool finished;
|
||||
char* writingFileDirectory;
|
||||
const char* writingFileDirectory;
|
||||
};
|
||||
|
||||
//****************************************************************************************************
|
||||
|
@ -108,7 +108,7 @@ class GCodes
|
|||
bool StandbyHeaters();
|
||||
void SetEthernetAddress(GCodeBuffer *gb, int mCode);
|
||||
void HandleReply(bool error, bool fromLine, const char* reply, char gMOrT, int code, bool resend);
|
||||
char* OpenFileToWrite(char* directory, char* fileName, GCodeBuffer *gb);
|
||||
void OpenFileToWrite(const char* directory, const char* fileName, GCodeBuffer *gb);
|
||||
void WriteGCodeToFile(GCodeBuffer *gb);
|
||||
bool SendConfigToLine();
|
||||
void WriteHTMLToFile(char b, GCodeBuffer *gb);
|
||||
|
@ -172,7 +172,7 @@ inline int GCodeBuffer::GetIValue()
|
|||
return (int)GetLValue();
|
||||
}
|
||||
|
||||
inline char* GCodeBuffer::Buffer()
|
||||
inline const char* GCodeBuffer::Buffer()
|
||||
{
|
||||
return gcodeBuffer;
|
||||
}
|
||||
|
@ -187,12 +187,12 @@ inline void GCodeBuffer::SetFinished(bool f)
|
|||
finished = f;
|
||||
}
|
||||
|
||||
inline char* GCodeBuffer::WritingFileDirectory() const
|
||||
inline const char* GCodeBuffer::WritingFileDirectory() const
|
||||
{
|
||||
return writingFileDirectory;
|
||||
}
|
||||
|
||||
inline void GCodeBuffer::SetWritingFileDirectory(char* wfd)
|
||||
inline void GCodeBuffer::SetWritingFileDirectory(const char* wfd)
|
||||
{
|
||||
writingFileDirectory = wfd;
|
||||
}
|
||||
|
|
5
Heat.h
5
Heat.h
|
@ -156,10 +156,7 @@ inline void Heat::SetStandbyTemperature(int8_t heater, const float& t)
|
|||
|
||||
inline float Heat::GetStandbyTemperature(int8_t heater)
|
||||
{
|
||||
if (heater >= 0 && heater < HEATERS)
|
||||
{
|
||||
return pids[heater]->GetStandbyTemperature();
|
||||
}
|
||||
return (heater >= 0 && heater < HEATERS) ? pids[heater]->GetStandbyTemperature() : ABS_ZERO;
|
||||
}
|
||||
|
||||
inline float Heat::GetTemperature(int8_t heater)
|
||||
|
|
|
@ -763,7 +763,7 @@ void FileStore::Write(char b)
|
|||
WriteBuffer();
|
||||
}
|
||||
|
||||
void FileStore::Write(char* b)
|
||||
void FileStore::Write(const char* b)
|
||||
{
|
||||
if(!inUse)
|
||||
{
|
||||
|
|
118
Platform.h
118
Platform.h
|
@ -368,7 +368,7 @@ public:
|
|||
int8_t Status(); // Returns OR of IOStatus
|
||||
bool Read(char& b);
|
||||
void Write(char b);
|
||||
void Write(char* s);
|
||||
void Write(const char* s);
|
||||
void Close();
|
||||
void GoToEnd(); // Position the file at the end (so you can write on the end).
|
||||
unsigned long Length(); // File size in bytes
|
||||
|
@ -418,7 +418,7 @@ class Platform
|
|||
|
||||
void Exit(); // Shut down tidily. Calling Init after calling this should reset to the beginning
|
||||
|
||||
Compatibility Emulating();
|
||||
Compatibility Emulating() const;
|
||||
|
||||
void SetEmulating(Compatibility c);
|
||||
|
||||
|
@ -439,24 +439,24 @@ class Platform
|
|||
// Communications and data storage
|
||||
|
||||
Network* GetNetwork();
|
||||
Line* GetLine();
|
||||
Line* GetLine() const;
|
||||
void SetIPAddress(byte ip[]);
|
||||
byte* IPAddress();
|
||||
const byte* IPAddress() const;
|
||||
void SetNetMask(byte nm[]);
|
||||
byte* NetMask();
|
||||
const byte* NetMask() const;
|
||||
void SetGateWay(byte gw[]);
|
||||
byte* GateWay();
|
||||
const byte* GateWay() const;
|
||||
|
||||
friend class FileStore;
|
||||
|
||||
MassStorage* GetMassStorage();
|
||||
FileStore* GetFileStore(const char* directory, const char* fileName, bool write);
|
||||
void StartNetwork();
|
||||
char* GetWebDir(); // Where the htm etc files are
|
||||
char* GetGCodeDir(); // Where the gcodes are
|
||||
char* GetSysDir(); // Where the system files are
|
||||
char* GetTempDir(); // Where temporary files are
|
||||
char* GetConfigFile(); // Where the configuration is stored (in the system dir).
|
||||
const char* GetWebDir() const; // Where the htm etc files are
|
||||
const char* GetGCodeDir() const; // Where the gcodes are
|
||||
const char* GetSysDir() const; // Where the system files are
|
||||
const char* GetTempDir() const; // Where temporary files are
|
||||
const char* GetConfigFile() const; // Where the configuration is stored (in the system dir).
|
||||
|
||||
void Message(char type, const char* message); // Send a message. Messages may simply flash an LED, or,
|
||||
// say, display the messages on an LCD. This may also transmit the messages to the host.
|
||||
|
@ -470,21 +470,21 @@ class Platform
|
|||
void Step(byte drive);
|
||||
void Disable(byte drive); // There is no drive enable; drives get enabled automatically the first time they are used.
|
||||
void SetMotorCurrent(byte drive, float current);
|
||||
float DriveStepsPerUnit(int8_t drive);
|
||||
float DriveStepsPerUnit(int8_t drive) const;
|
||||
void SetDriveStepsPerUnit(int8_t drive, float value);
|
||||
float Acceleration(int8_t drive);
|
||||
float Acceleration(int8_t drive) const;
|
||||
void SetAcceleration(int8_t drive, float value);
|
||||
float MaxFeedrate(int8_t drive);
|
||||
float MaxFeedrate(int8_t drive) const;
|
||||
void SetMaxFeedrate(int8_t drive, float value);
|
||||
float InstantDv(int8_t drive);
|
||||
float HomeFeedRate(int8_t axis);
|
||||
float InstantDv(int8_t drive) const;
|
||||
float HomeFeedRate(int8_t axis) const;
|
||||
void SetHomeFeedRate(int8_t axis, float value);
|
||||
EndStopHit Stopped(int8_t drive);
|
||||
float AxisLength(int8_t axis);
|
||||
float AxisLength(int8_t axis) const;
|
||||
void SetAxisLength(int8_t axis, float value);
|
||||
bool HighStopButNotLow(int8_t axis);
|
||||
bool HighStopButNotLow(int8_t axis) const;
|
||||
|
||||
float ZProbeStopHeight();
|
||||
float ZProbeStopHeight() const;
|
||||
void SetZProbeStopHeight(float z);
|
||||
int ZProbe() const;
|
||||
int ZProbeOnVal() const;
|
||||
|
@ -496,15 +496,15 @@ class Platform
|
|||
|
||||
float GetTemperature(int8_t heater); // Result is in degrees celsius
|
||||
void SetHeater(int8_t heater, const float& power); // power is a fraction in [0,1]
|
||||
float PidKp(int8_t heater);
|
||||
float PidKi(int8_t heater);
|
||||
float PidKd(int8_t heater);
|
||||
float FullPidBand(int8_t heater);
|
||||
float PidMin(int8_t heater);
|
||||
float PidMax(int8_t heater);
|
||||
float DMix(int8_t heater);
|
||||
bool UsePID(int8_t heater);
|
||||
float HeatSampleTime();
|
||||
float PidKp(int8_t heater) const;
|
||||
float PidKi(int8_t heater) const;
|
||||
float PidKd(int8_t heater) const;
|
||||
float FullPidBand(int8_t heater) const;
|
||||
float PidMin(int8_t heater) const;
|
||||
float PidMax(int8_t heater) const;
|
||||
float DMix(int8_t heater) const;
|
||||
bool UsePID(int8_t heater) const;
|
||||
float HeatSampleTime() const;
|
||||
void CoolingFan(float speed);
|
||||
//void SetHeatOn(int8_t ho); //TEMPORARY - this will go away...
|
||||
|
||||
|
@ -525,7 +525,7 @@ class Platform
|
|||
Compatibility compatibility;
|
||||
|
||||
void InitialiseInterrupts();
|
||||
int GetRawZHeight();
|
||||
int GetRawZHeight() const;
|
||||
|
||||
// DRIVES
|
||||
|
||||
|
@ -570,7 +570,7 @@ class Platform
|
|||
|
||||
// HEATERS - Bed is assumed to be the first
|
||||
|
||||
int GetRawTemperature(byte heater);
|
||||
int GetRawTemperature(byte heater) const;
|
||||
|
||||
int8_t tempSensePins[HEATERS];
|
||||
int8_t heatOnPins[HEATERS];
|
||||
|
@ -637,7 +637,7 @@ inline void Platform::Exit()
|
|||
active = false;
|
||||
}
|
||||
|
||||
inline Compatibility Platform::Emulating()
|
||||
inline Compatibility Platform::Emulating() const
|
||||
{
|
||||
if(compatibility == reprapFirmware)
|
||||
return me;
|
||||
|
@ -658,34 +658,34 @@ inline void Platform::SetEmulating(Compatibility c)
|
|||
|
||||
// Where the htm etc files are
|
||||
|
||||
inline char* Platform::GetWebDir()
|
||||
inline const char* Platform::GetWebDir() const
|
||||
{
|
||||
return webDir;
|
||||
}
|
||||
|
||||
// Where the gcodes are
|
||||
|
||||
inline char* Platform::GetGCodeDir()
|
||||
inline const char* Platform::GetGCodeDir() const
|
||||
{
|
||||
return gcodeDir;
|
||||
}
|
||||
|
||||
// Where the system files are
|
||||
|
||||
inline char* Platform::GetSysDir()
|
||||
inline const char* Platform::GetSysDir() const
|
||||
{
|
||||
return sysDir;
|
||||
}
|
||||
|
||||
// Where the temporary files are
|
||||
|
||||
inline char* Platform::GetTempDir()
|
||||
inline const char* Platform::GetTempDir() const
|
||||
{
|
||||
return tempDir;
|
||||
}
|
||||
|
||||
|
||||
inline char* Platform::GetConfigFile()
|
||||
inline const char* Platform::GetConfigFile() const
|
||||
{
|
||||
return configFile;
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ inline char* Platform::GetConfigFile()
|
|||
|
||||
// Drive the RepRap machine - Movement
|
||||
|
||||
inline float Platform::DriveStepsPerUnit(int8_t drive)
|
||||
inline float Platform::DriveStepsPerUnit(int8_t drive) const
|
||||
{
|
||||
return driveStepsPerUnit[drive];
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ inline void Platform::SetDriveStepsPerUnit(int8_t drive, float value)
|
|||
driveStepsPerUnit[drive] = value;
|
||||
}
|
||||
|
||||
inline float Platform::Acceleration(int8_t drive)
|
||||
inline float Platform::Acceleration(int8_t drive) const
|
||||
{
|
||||
return accelerations[drive];
|
||||
}
|
||||
|
@ -716,12 +716,12 @@ inline void Platform::SetAcceleration(int8_t drive, float value)
|
|||
accelerations[drive] = value;
|
||||
}
|
||||
|
||||
inline float Platform::InstantDv(int8_t drive)
|
||||
inline float Platform::InstantDv(int8_t drive) const
|
||||
{
|
||||
return instantDvs[drive];
|
||||
}
|
||||
|
||||
inline bool Platform::HighStopButNotLow(int8_t axis)
|
||||
inline bool Platform::HighStopButNotLow(int8_t axis) const
|
||||
{
|
||||
return (lowStopPins[axis] < 0) && (highStopPins[axis] >= 0);
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ inline void Platform::SetMotorCurrent(byte drive, float current)
|
|||
mcp.setVolatileWiper(potWipes[drive], pot);
|
||||
}
|
||||
|
||||
inline float Platform::HomeFeedRate(int8_t axis)
|
||||
inline float Platform::HomeFeedRate(int8_t axis) const
|
||||
{
|
||||
return homeFeedrates[axis];
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ inline void Platform::SetHomeFeedRate(int8_t axis, float value)
|
|||
homeFeedrates[axis] = value;
|
||||
}
|
||||
|
||||
inline float Platform::AxisLength(int8_t axis)
|
||||
inline float Platform::AxisLength(int8_t axis) const
|
||||
{
|
||||
return axisLengths[axis];
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ inline void Platform::SetAxisLength(int8_t axis, float value)
|
|||
axisLengths[axis] = value;
|
||||
}
|
||||
|
||||
inline float Platform::MaxFeedrate(int8_t drive)
|
||||
inline float Platform::MaxFeedrate(int8_t drive) const
|
||||
{
|
||||
return maxFeedrates[drive];
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ inline void Platform::SetMaxFeedrate(int8_t drive, float value)
|
|||
maxFeedrates[drive] = value;
|
||||
}
|
||||
|
||||
inline int Platform::GetRawZHeight()
|
||||
inline int Platform::GetRawZHeight() const
|
||||
{
|
||||
return (zProbeType != 0) ? analogRead(zProbePin) : 0;
|
||||
}
|
||||
|
@ -836,7 +836,7 @@ inline int Platform::ZProbeOnVal() const
|
|||
: 0;
|
||||
}
|
||||
|
||||
inline float Platform::ZProbeStopHeight()
|
||||
inline float Platform::ZProbeStopHeight() const
|
||||
{
|
||||
return zProbeStopHeight;
|
||||
}
|
||||
|
@ -887,55 +887,55 @@ inline void Platform::PollZHeight()
|
|||
|
||||
// Drive the RepRap machine - Heat and temperature
|
||||
|
||||
inline int Platform::GetRawTemperature(byte heater)
|
||||
inline int Platform::GetRawTemperature(byte heater) const
|
||||
{
|
||||
if(tempSensePins[heater] >= 0)
|
||||
return analogRead(tempSensePins[heater]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline float Platform::HeatSampleTime()
|
||||
inline float Platform::HeatSampleTime() const
|
||||
{
|
||||
return heatSampleTime;
|
||||
}
|
||||
|
||||
inline bool Platform::UsePID(int8_t heater)
|
||||
inline bool Platform::UsePID(int8_t heater) const
|
||||
{
|
||||
return usePID[heater];
|
||||
}
|
||||
|
||||
|
||||
inline float Platform::PidKi(int8_t heater)
|
||||
inline float Platform::PidKi(int8_t heater) const
|
||||
{
|
||||
return pidKis[heater]*heatSampleTime;
|
||||
}
|
||||
|
||||
inline float Platform::PidKd(int8_t heater)
|
||||
inline float Platform::PidKd(int8_t heater) const
|
||||
{
|
||||
return pidKds[heater]/heatSampleTime;
|
||||
}
|
||||
|
||||
inline float Platform::PidKp(int8_t heater)
|
||||
inline float Platform::PidKp(int8_t heater) const
|
||||
{
|
||||
return pidKps[heater];
|
||||
}
|
||||
|
||||
inline float Platform::FullPidBand(int8_t heater)
|
||||
inline float Platform::FullPidBand(int8_t heater) const
|
||||
{
|
||||
return fullPidBand[heater];
|
||||
}
|
||||
|
||||
inline float Platform::PidMin(int8_t heater)
|
||||
inline float Platform::PidMin(int8_t heater) const
|
||||
{
|
||||
return pidMin[heater];
|
||||
}
|
||||
|
||||
inline float Platform::PidMax(int8_t heater)
|
||||
inline float Platform::PidMax(int8_t heater) const
|
||||
{
|
||||
return pidMax[heater]/PidKi(heater);
|
||||
}
|
||||
|
||||
inline float Platform::DMix(int8_t heater)
|
||||
inline float Platform::DMix(int8_t heater) const
|
||||
{
|
||||
return dMix[heater];
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ inline void Platform::SetIPAddress(byte ip[])
|
|||
ipAddress[i] = ip[i];
|
||||
}
|
||||
|
||||
inline byte* Platform::IPAddress()
|
||||
inline const byte* Platform::IPAddress() const
|
||||
{
|
||||
return ipAddress;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ inline void Platform::SetNetMask(byte nm[])
|
|||
netMask[i] = nm[i];
|
||||
}
|
||||
|
||||
inline byte* Platform::NetMask()
|
||||
inline const byte* Platform::NetMask() const
|
||||
{
|
||||
return netMask;
|
||||
}
|
||||
|
@ -1007,12 +1007,12 @@ inline void Platform::SetGateWay(byte gw[])
|
|||
gateWay[i] = gw[i];
|
||||
}
|
||||
|
||||
inline byte* Platform::GateWay()
|
||||
inline const byte* Platform::GateWay() const
|
||||
{
|
||||
return gateWay;
|
||||
}
|
||||
|
||||
inline Line* Platform::GetLine()
|
||||
inline Line* Platform::GetLine() const
|
||||
{
|
||||
return line;
|
||||
}
|
||||
|
|
|
@ -157,9 +157,8 @@ RepRap reprap;
|
|||
|
||||
// Do nothing more in the constructor; put what you want in RepRap:Init()
|
||||
|
||||
RepRap::RepRap()
|
||||
RepRap::RepRap() : active(false), debug(false)
|
||||
{
|
||||
active = false;
|
||||
platform = new Platform();
|
||||
webserver = new Webserver(platform);
|
||||
gCodes = new GCodes(platform, webserver);
|
||||
|
|
|
@ -31,7 +31,7 @@ class Move;
|
|||
class Heat;
|
||||
class RepRap;
|
||||
|
||||
// A single instace of the RepRap class contains all the others
|
||||
// A single instance of the RepRap class contains all the others
|
||||
|
||||
extern RepRap reprap;
|
||||
|
||||
|
|
24
Reprap.h
24
Reprap.h
|
@ -32,13 +32,13 @@ class RepRap
|
|||
void Exit();
|
||||
void Interrupt();
|
||||
void Diagnostics();
|
||||
bool Debug();
|
||||
bool Debug() const;
|
||||
void SetDebug(bool d);
|
||||
Platform* GetPlatform();
|
||||
Move* GetMove();
|
||||
Heat* GetHeat();
|
||||
GCodes* GetGCodes();
|
||||
Webserver* GetWebserver();
|
||||
Platform* GetPlatform() const;
|
||||
Move* GetMove() const;
|
||||
Heat* GetHeat() const;
|
||||
GCodes* GetGCodes() const;
|
||||
Webserver* GetWebserver() const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -51,12 +51,12 @@ class RepRap
|
|||
bool debug;
|
||||
};
|
||||
|
||||
inline Platform* RepRap::GetPlatform() { return platform; }
|
||||
inline Move* RepRap::GetMove() { return move; }
|
||||
inline Heat* RepRap::GetHeat() { return heat; }
|
||||
inline GCodes* RepRap::GetGCodes() { return gCodes; }
|
||||
inline Webserver* RepRap::GetWebserver() { return webserver; }
|
||||
inline bool RepRap::Debug() { return debug; }
|
||||
inline Platform* RepRap::GetPlatform() const { return platform; }
|
||||
inline Move* RepRap::GetMove() const { return move; }
|
||||
inline Heat* RepRap::GetHeat() const { return heat; }
|
||||
inline GCodes* RepRap::GetGCodes() const { return gCodes; }
|
||||
inline Webserver* RepRap::GetWebserver() const { return webserver; }
|
||||
inline bool RepRap::Debug() const { return debug; }
|
||||
|
||||
inline void RepRap::SetDebug(bool d)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
; RepRapPro Ormerod
|
||||
; Standard configuration G Codes
|
||||
M111 S1; Debug on
|
||||
M550 POrmerod; Set the machine's name
|
||||
M551 Preprap; Set the password
|
||||
M552 P192.168.1.14; Set the IP address
|
||||
|
|
|
@ -150,6 +150,7 @@ bool Webserver::LoadGcodeBuffer(const char* gc, bool convertWeb)
|
|||
}
|
||||
}
|
||||
while (c != 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Process a null-terminated gcode
|
||||
|
|
|
@ -270,7 +270,7 @@ static void ethernet_configure_interface(unsigned char ipAddress[], unsigned cha
|
|||
/** \brief Create ethernet task, for ethernet management.
|
||||
*
|
||||
*/
|
||||
void init_ethernet(unsigned char ipAddress[], unsigned char netMask[], unsigned char gateWay[])
|
||||
void init_ethernet(const unsigned char ipAddress[], const unsigned char netMask[], const unsigned char gateWay[])
|
||||
{
|
||||
/* Initialize lwIP */
|
||||
lwip_init();
|
||||
|
|
|
@ -62,7 +62,7 @@ bool status_link_up();//*****************************AB
|
|||
*/
|
||||
//void init_ethernet(void);
|
||||
|
||||
void init_ethernet(unsigned char ipAddress[], unsigned char netMask[], unsigned char gateWay[]);
|
||||
void init_ethernet(const unsigned char ipAddress[], const unsigned char netMask[], const unsigned char gateWay[]);
|
||||
|
||||
struct netif* GetConfiguration();
|
||||
|
||||
|
|
Reference in a new issue