Minor updates
Added chrishamm's FTP fix Fix spurious extra command word in http parser Minor improvements to Heat and PrintMonitor
This commit is contained in:
parent
aa7bac3cc0
commit
96e8d2010b
7 changed files with 212 additions and 202 deletions
|
@ -30,7 +30,7 @@ Licence: GPL
|
|||
#endif
|
||||
|
||||
#ifndef DATE
|
||||
#define DATE "2015-12-30"
|
||||
#define DATE "2015-12-31"
|
||||
#endif
|
||||
|
||||
#define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
duet
|
||||
thermistor
|
||||
debounce
|
||||
struct
|
||||
arduino
|
||||
extruder
|
||||
deprecated
|
20
Heat.cpp
20
Heat.cpp
|
@ -22,8 +22,7 @@ Licence: GPL
|
|||
|
||||
const float invHeatPwmAverageCount = HEAT_SAMPLE_TIME/HEAT_PWM_AVERAGE_TIME;
|
||||
|
||||
Heat::Heat(Platform* p) : platform(p), active(false), coldExtrude(false),
|
||||
bedHeater(BED_HEATER), chamberHeater(-1)
|
||||
Heat::Heat(Platform* p) : platform(p), active(false), coldExtrude(false), bedHeater(BED_HEATER), chamberHeater(-1)
|
||||
{
|
||||
for (size_t heater = 0; heater < HEATERS; heater++)
|
||||
{
|
||||
|
@ -87,8 +86,10 @@ bool Heat::AllHeatersAtSetTemperatures(bool includingBed) const
|
|||
for (int8_t heater = (includingBed) ? 0 : 1; heater < HEATERS; heater++)
|
||||
{
|
||||
if (!HeaterAtSetTemperature(heater))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,9 @@ bool Heat::AllHeatersAtSetTemperatures(bool includingBed) const
|
|||
bool Heat::HeaterAtSetTemperature(int8_t heater) const
|
||||
{
|
||||
if (pids[heater]->SwitchedOff()) // If it hasn't anything to do, it must be right wherever it is...
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
float dt = GetTemperature(heater);
|
||||
float target = (pids[heater]->Active()) ? GetActiveTemperature(heater) : GetStandbyTemperature(heater);
|
||||
|
@ -132,12 +135,11 @@ void PID::Init()
|
|||
|
||||
void PID::SwitchOn()
|
||||
{
|
||||
// if(reprap.Debug())
|
||||
// {
|
||||
// snprintf(scratchString, STRING_LENGTH, "Heater %d switched on.\n", heater);
|
||||
// platform->Message(BOTH_MESSAGE, scratchString);
|
||||
// }
|
||||
switchedOff = false;
|
||||
if (reprap.Debug(Module::moduleHeat))
|
||||
{
|
||||
platform->MessageF(GENERIC_MESSAGE, "Heater %d switched on.\n", heater);
|
||||
}
|
||||
switchedOff = temperatureFault;
|
||||
}
|
||||
|
||||
void PID::SetHeater(float power) const
|
||||
|
@ -251,6 +253,7 @@ void PID::Spin()
|
|||
lastTemperature = temperature;
|
||||
return;
|
||||
}
|
||||
|
||||
if (error > pp.fullBand)
|
||||
{
|
||||
// actual temperature is well below target
|
||||
|
@ -304,4 +307,3 @@ float PID::GetAveragePWM() const
|
|||
}
|
||||
|
||||
// End
|
||||
|
||||
|
|
|
@ -137,14 +137,14 @@ a lot of data that needs to be copied, this should be set high. */
|
|||
#define LWIP_TCP (1)
|
||||
#define TCP_TTL (255)
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND (2 * 1432)
|
||||
#define TCP_WND (2 * 1460)
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS (1432) // 1432 is optimal for Windows clients
|
||||
#define TCP_MSS (1460) // 1432 is optimal for Windows clients
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF (2 * 1432) //changed from 2150 to pass LWIP sanity checks
|
||||
#define TCP_SND_BUF (2 * 1460) //changed from 2150 to pass LWIP sanity checks
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 * TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN (3 * TCP_SND_BUF / TCP_MSS)
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
|
|
|
@ -470,7 +470,7 @@ bool PrintMonitor::GetFileInfo(const char *directory, const char *fileName, GCod
|
|||
}
|
||||
|
||||
// Go to the last sector and proceed from there on
|
||||
const FilePosition seekFromEnd = fileBeingParsed->Length() % GCODE_READ_SIZE;
|
||||
const FilePosition seekFromEnd = ((fileBeingParsed->Length() - 1) % GCODE_READ_SIZE) + 1;
|
||||
fileBeingParsed->Seek(fileBeingParsed->Length() - seekFromEnd);
|
||||
fileOverlapLength = 0;
|
||||
parseState = parsingFooter;
|
||||
|
|
BIN
Release/RepRapFirmware-1.09p-alpha-dc42.bin
Normal file
BIN
Release/RepRapFirmware-1.09p-alpha-dc42.bin
Normal file
Binary file not shown.
|
@ -209,7 +209,7 @@ void Webserver::Spin()
|
|||
{
|
||||
telnetInterpreter->SendGCodeReply(transaction);
|
||||
}
|
||||
// Process other messages (unless this is an HTTP request which may need special treatement)
|
||||
// Process other messages (unless this is an HTTP request which may need special treatment)
|
||||
else if (interpreter != httpInterpreter || httpInterpreter->IsReady())
|
||||
{
|
||||
for(size_t i = 0; i < 500; i++)
|
||||
|
@ -236,6 +236,7 @@ void Webserver::Spin()
|
|||
}
|
||||
}
|
||||
}
|
||||
// else the HTTP server is not ready
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1042,6 +1043,10 @@ bool Webserver::HttpInterpreter::NeedMoreData()
|
|||
// At this stage we've processed the first chunk of a POST upload request. Store the
|
||||
// initial payload and reset the HTTP reader again in order to process new requests
|
||||
WriteUploadedData(clientMessage + (clientPointer - uploadedBytes), uploadedBytes);
|
||||
if (reprap.Debug(moduleWebserver))
|
||||
{
|
||||
platform->MessageF(HOST_MESSAGE, "Wrote %lu bytes of file\n", uploadedBytes);
|
||||
}
|
||||
ResetState();
|
||||
return false;
|
||||
}
|
||||
|
@ -1228,7 +1233,6 @@ bool Webserver::HttpInterpreter::CharFromClient(char c)
|
|||
case '\t':
|
||||
clientMessage[clientPointer++] = 0;
|
||||
qualifiers[numQualKeys].key = clientMessage + clientPointer; // so that we can read the whole value even if it contains a null
|
||||
++numCommandWords;
|
||||
commandWords[numCommandWords] = clientMessage + clientPointer;
|
||||
state = doingCommandWord;
|
||||
break;
|
||||
|
@ -1431,12 +1435,18 @@ bool Webserver::HttpInterpreter::ProcessMessage()
|
|||
{
|
||||
if (reprap.Debug(moduleWebserver))
|
||||
{
|
||||
platform->MessageF(HOST_MESSAGE, "HTTP requests with %d command words:", numCommandWords);
|
||||
platform->Message(HOST_MESSAGE, "HTTP req, command words {");
|
||||
for (size_t i = 0; i < numCommandWords; ++i)
|
||||
{
|
||||
platform->MessageF(HOST_MESSAGE, " %s", commandWords[i]);
|
||||
}
|
||||
platform->Message(HOST_MESSAGE, "\n");
|
||||
platform->Message(HOST_MESSAGE, " }, parameters {");
|
||||
|
||||
for (size_t i = 0; i < numQualKeys; ++i)
|
||||
{
|
||||
platform->MessageF(HOST_MESSAGE, " %s=%s", qualifiers[i].key, qualifiers[i].value);
|
||||
}
|
||||
platform->Message(HOST_MESSAGE, " }\n");
|
||||
}
|
||||
|
||||
if (numCommandWords < 2)
|
||||
|
@ -1498,6 +1508,10 @@ bool Webserver::HttpInterpreter::ProcessMessage()
|
|||
FileStore *file = platform->GetFileStore("0:/", qualifiers[0].value, true);
|
||||
if (StartUpload(file))
|
||||
{
|
||||
if (reprap.Debug(moduleWebserver))
|
||||
{
|
||||
platform->MessageF(HOST_MESSAGE, "Start uploading file %s length %lu\n", qualifiers[0].value, postFileLength);
|
||||
}
|
||||
// Start new file upload
|
||||
uploadingTextData = false;
|
||||
uploadedBytes = numContinuationBytes = 0;
|
||||
|
@ -2307,27 +2321,28 @@ void Webserver::FtpInterpreter::ProcessLine()
|
|||
else if (StringStartsWith(clientMessage, "RETR"))
|
||||
{
|
||||
ReadFilename(4);
|
||||
FileStore *fs = platform->GetFileStore(currentDir, filename, false);
|
||||
FileStore *file = platform->GetFileStore(currentDir, filename, false);
|
||||
|
||||
if (fs == nullptr)
|
||||
if (file == nullptr)
|
||||
{
|
||||
SendReply(550, "Failed to open file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(ftpResponse, ftpResponseLength, "Opening data connection for %s (%lu bytes).", filename, fs->Length());
|
||||
snprintf(ftpResponse, ftpResponseLength, "Opening data connection for %s (%lu bytes).", filename, file->Length());
|
||||
SendReply(150, ftpResponse);
|
||||
|
||||
if (network->AcquireDataTransaction())
|
||||
{
|
||||
// send the file via data port
|
||||
NetworkTransaction *dataTransaction = network->GetTransaction();
|
||||
dataTransaction->SetFileToWrite(fs);
|
||||
dataTransaction->SetFileToWrite(file);
|
||||
dataTransaction->Commit(false);
|
||||
state = doingPasvIO;
|
||||
}
|
||||
else
|
||||
{
|
||||
file->Close();
|
||||
SendReply(500, "Unknown error.");
|
||||
network->CloseDataPort();
|
||||
state = authenticated;
|
||||
|
|
Reference in a new issue