diff --git a/Configuration.h b/Configuration.h index 5a82635..0d991d8 100644 --- a/Configuration.h +++ b/Configuration.h @@ -43,6 +43,8 @@ Licence: GPL #define PASSWORD_PAGE "passwd.php" #define INDEX_PAGE "control.php" #define PRINT_PAGE "print.php" +#define MESSAGE_FILE "messages.php" +#define MESSAGE_TEMPLATE "messages.txt" #define STRING_LENGTH 1000 #define PHP_TAG_LENGTH 200 #define POST_LENGTH 200 diff --git a/GCodes.h b/GCodes.h index 90f2698..694e13b 100644 --- a/GCodes.h +++ b/GCodes.h @@ -36,6 +36,7 @@ class GCodes void ActOnGcode(); Platform* platform; + boolean active; Move* move; Heat* heat; Webserver* webserver; diff --git a/GCodes.ino b/GCodes.ino index 9198527..22f904f 100644 --- a/GCodes.ino +++ b/GCodes.ino @@ -23,6 +23,7 @@ Licence: GPL GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w) { + active = false; //Serial.println("GCodes constructor"); platform = p; move = m; @@ -32,28 +33,32 @@ GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w) void GCodes::Exit() { - + active = false; } void GCodes::Init() { lastTime = platform->Time(); gcodePointer = 0; + active = true; } void GCodes::ActOnGcode() { - platform->Message(HOST_MESSAGE, "\nGCode: "); + platform->Message(HOST_MESSAGE, "GCode: "); platform->Message(HOST_MESSAGE, gcodeBuffer); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, "
\n"); } void GCodes::Spin() { + if(!active) + return; + if(webserver->Available()) { gcodeBuffer[gcodePointer] = webserver->Read(); diff --git a/Heat.h b/Heat.h index 2957703..db0782c 100644 --- a/Heat.h +++ b/Heat.h @@ -44,6 +44,7 @@ class Heat private: Platform* platform; + boolean active; unsigned long lastTime; //float frac; //float inc; diff --git a/Heat.ino b/Heat.ino index 2b52eac..5322852 100644 --- a/Heat.ino +++ b/Heat.ino @@ -24,22 +24,27 @@ Heat::Heat(Platform* p) { //Serial.println("Heat constructor"); platform = p; + active = false; } void Heat::Init() { lastTime = platform->Time(); //frac = 0; - //inc = 0.01; + //inc = 0.01; + active = true; } void Heat::Exit() { - + active = false; } void Heat::Spin() { + if(!active) + return; + unsigned long t = platform->Time(); if(t - lastTime < 3000) return; diff --git a/Move.h b/Move.h index 67910b2..957f3f9 100644 --- a/Move.h +++ b/Move.h @@ -34,7 +34,7 @@ class Move Platform* platform; unsigned long lastTime; - + boolean active; }; #endif diff --git a/Move.ino b/Move.ino index 52e52b6..3085e47 100644 --- a/Move.ino +++ b/Move.ino @@ -24,6 +24,7 @@ Move::Move(Platform* p) { //Serial.println("Move constructor"); platform = p; + active = false; } void Move::Init() @@ -32,16 +33,20 @@ void Move::Init() platform->SetDirection(X_AXIS, FORWARDS); platform->SetDirection(Y_AXIS, FORWARDS); platform->SetDirection(Z_AXIS, FORWARDS); - platform->SetDirection(3, FORWARDS); + platform->SetDirection(3, FORWARDS); + active = true; } void Move::Exit() { - + active = false; } void Move::Spin() { + if(!active) + return; + unsigned long t = platform->Time(); if(t - lastTime < 300) return; diff --git a/Platform.h b/Platform.h index ec57a20..192e447 100644 --- a/Platform.h +++ b/Platform.h @@ -188,6 +188,7 @@ class Platform char* FileList(char* directory); // Returns a ;-separated list of all the files in the named directory (for example on an SD card). int OpenFile(char* fileName, boolean write); // Open a local file (for example on an SD card). + void GoToEnd(int file); // Position the file at the end (so you can write on the end). boolean Read(int file, unsigned char& b); // Read a single byte from a file into b, // returned value is false for EoF, true otherwise void WriteString(int file, char* s); // Write the string to a file. @@ -198,6 +199,7 @@ class Platform char* GetTempDir(); // Where temporary files are void Close(int file); // Close a file or device, writing any unwritten buffer contents first. boolean DeleteFile(char* fileName); // Delete a file + char* PrependRoot(char* root, char* fileName); unsigned char ClientRead(); // Read a byte from the client void SendToClient(char* message); // Send string to the host @@ -229,6 +231,8 @@ class Platform unsigned long lastTime; + boolean active; + // Load settings from local storage bool LoadFromStore(); @@ -278,6 +282,7 @@ class Platform char* sysDir; char* tempDir; char fileList[FILE_LIST_LENGTH]; + char scratchString[STRING_LENGTH]; // Network connection diff --git a/Platform.ino b/Platform.ino index 2f3225b..7124fd5 100644 --- a/Platform.ino +++ b/Platform.ino @@ -39,11 +39,7 @@ void loop() Platform::Platform(RepRap* r) { reprap = r; -} - -RepRap* Platform::GetRepRap() -{ - return reprap; + active = false; } void Platform::Init() @@ -164,11 +160,36 @@ void Platform::Init() if (!SD.begin(SD_SPI)) Serial.println("SD initialization failed."); // SD.begin() returns with the SPI disabled, so you need not disable it here + + // Reinitialise the message file + + DeleteFile(PrependRoot(GetWebDir(), MESSAGE_FILE)); + int m = OpenFile(PrependRoot(GetWebDir(), MESSAGE_TEMPLATE), false); + int n = OpenFile(PrependRoot(GetWebDir(), MESSAGE_FILE), true); + byte b; + while (Read(m, b)) + Write(n,b); + Close(m); + Close(n); + + active = true; } void Platform::Exit() { - + active = false; +} + +RepRap* Platform::GetRepRap() +{ + return reprap; +} + + +char* Platform::PrependRoot(char* root, char* fileName) +{ + strcpy(scratchString, root); + return strcat(scratchString, fileName); } @@ -256,7 +277,7 @@ char* Platform::FileList(char* directory) { Message(HOST_MESSAGE, "FileList - directory: "); Message(HOST_MESSAGE, directory); - Message(HOST_MESSAGE, " has too many files!"); + Message(HOST_MESSAGE, " has too many files!
\n"); return ""; } } @@ -284,7 +305,7 @@ boolean Platform::DeleteFile(char* fileName) int Platform::OpenFile(char* fileName, boolean write) { int result = -1; - for(int i=0; i < MAX_FILES; i++) + for(int i = 0; i < MAX_FILES; i++) if(!inUse[i]) { result = i; @@ -292,7 +313,7 @@ int Platform::OpenFile(char* fileName, boolean write) } if(result < 0) { - Message(HOST_MESSAGE, "Max open file count exceeded.\n"); + Message(HOST_MESSAGE, "Max open file count exceeded.
\n"); return -1; } @@ -300,15 +321,16 @@ int Platform::OpenFile(char* fileName, boolean write) { if(!write) { - Message(HOST_MESSAGE, "File not found for reading.\n"); + Message(HOST_MESSAGE, "File not found for reading.
\n"); return -1; } files[result] = SD.open(fileName, FILE_WRITE); } else { if(write) + { files[result] = SD.open(fileName, FILE_WRITE); - else + }else files[result] = SD.open(fileName, FILE_READ); } @@ -316,6 +338,17 @@ int Platform::OpenFile(char* fileName, boolean write) return result; } +void Platform::GoToEnd(int file) +{ + if(!inUse[file]) + { + Message(HOST_MESSAGE, "Attempt to seek on a non-open file.
\n"); + return; + } + unsigned long e = files[file].size(); + files[file].seek(e); +} + void Platform::Close(int file) { files[file].close(); @@ -327,7 +360,7 @@ boolean Platform::Read(int file, unsigned char& b) { if(!inUse[file]) { - Message(HOST_MESSAGE, "Attempt to read from a non-open file.\n"); + Message(HOST_MESSAGE, "Attempt to read from a non-open file.
\n"); return false; } @@ -341,7 +374,7 @@ void Platform::Write(int file, char b) { if(!inUse[file]) { - Message(HOST_MESSAGE, "Attempt to write byte to a non-open file.\n"); + Message(HOST_MESSAGE, "Attempt to write byte to a non-open file.
\n"); return; } @@ -352,7 +385,7 @@ void Platform::WriteString(int file, char* b) { if(!inUse[file]) { - Message(HOST_MESSAGE, "Attempt to write string to a non-open file.\n"); + Message(HOST_MESSAGE, "Attempt to write string to a non-open file.
\n"); return; } @@ -375,7 +408,12 @@ void Platform::Message(char type, char* message) case HOST_MESSAGE: default: + + int m = OpenFile(PrependRoot(GetWebDir(), MESSAGE_FILE), true); + GoToEnd(m); + WriteString(m, message); Serial.print(message); + Close(m); } } @@ -390,7 +428,7 @@ void Platform::SendToClient(char* message) //Serial.print("Sent: "); //Serial.print(message); } else - Message(HOST_MESSAGE, "Attempt to send string to disconnected client.\n"); + Message(HOST_MESSAGE, "Attempt to send string to disconnected client.
\n"); } // Where the php/htm etc files are @@ -429,6 +467,9 @@ char* Platform::GetTempDir() void Platform::Spin() { + if(!active) + return; + ClientMonitor(); if(Time() - lastTime < 2000000) return; diff --git a/RepRapFirmware.h b/RepRapFirmware.h index b98b5eb..8542cd1 100644 --- a/RepRapFirmware.h +++ b/RepRapFirmware.h @@ -54,6 +54,7 @@ class RepRap private: Platform* platform; + boolean active; Move* move; Heat* heat; GCodes* gcodes; @@ -71,6 +72,7 @@ class RepRap inline RepRap::RepRap() { + active = false; platform = new Platform(this); move = new Move(platform); heat = new Heat(platform); diff --git a/RepRapFirmware.ino b/RepRapFirmware.ino index 2fa66b3..13a0dfc 100644 --- a/RepRapFirmware.ino +++ b/RepRapFirmware.ino @@ -60,11 +60,13 @@ void RepRap::Init() heat->Init(); gcodes->Init(); webserver->Init(); - platform->Message(HOST_MESSAGE, "RepRapPro RepRap Firmware (Re)Started\n\n"); + platform->Message(HOST_MESSAGE, "RepRapPro RepRap Firmware (Re)Started
\n"); + active = true; } void RepRap::Exit() { + active = false; webserver->Exit(); gcodes->Exit(); heat->Exit(); @@ -74,6 +76,9 @@ void RepRap::Exit() void RepRap::Spin() { + if(!active) + return; + platform->Spin(); move->Spin(); heat->Spin(); diff --git a/SD-image/www/control.php b/SD-image/www/control.php index 592fe79..3002c05 100644 --- a/SD-image/www/control.php +++ b/SD-image/www/control.php @@ -18,6 +18,8 @@    Settings    + +    Messages       Logout    @@ -86,7 +88,7 @@ -

Send a G Code:
+

Send a G Code:


diff --git a/SD-image/www/delete.php b/SD-image/www/delete.php index 10b5e42..94ac59a 100644 --- a/SD-image/www/delete.php +++ b/SD-image/www/delete.php @@ -19,6 +19,8 @@    Settings    + +    Messages       Logout    diff --git a/SD-image/www/delete.php~ b/SD-image/www/delete.php~ index 5ccbde0..10b5e42 100644 --- a/SD-image/www/delete.php~ +++ b/SD-image/www/delete.php~ @@ -29,12 +29,62 @@

-

Click a file to delete it: +Click a file to delete it: +
+

- -

+

diff --git a/SD-image/www/messages.txt b/SD-image/www/messages.txt new file mode 100644 index 0000000..7b31c01 --- /dev/null +++ b/SD-image/www/messages.txt @@ -0,0 +1,30 @@ + + + + + + + +

RepRap: + +RepRapPro logo'; ?> +



+ +    Control    + +    Print    + +    Help    + + +    Settings    + +    Messages    + +    Logout    + + +

'; ?> + +

Messages:



+ diff --git a/SD-image/www/print.php b/SD-image/www/print.php index 3584e68..8736b4b 100644 --- a/SD-image/www/print.php +++ b/SD-image/www/print.php @@ -18,6 +18,7 @@    Settings    +    Messages       Logout    diff --git a/SD-image/www/print.php~ b/SD-image/www/print.php~ index 11fe1cb..3584e68 100644 --- a/SD-image/www/print.php~ +++ b/SD-image/www/print.php~ @@ -115,7 +115,7 @@ function checkFileName(uploadForm) var list = fileList(); for(var i = 0; i < list.length; i++) { - if(list[i] == uploadForm.datafile.value) + if(list[i].toUpperCase() == uploadForm.datafile.value.toUpperCase()) { return confirm("This will overwrite the file " + list[i] + " on ." + diff --git a/SD-image/www/settings.php b/SD-image/www/settings.php index 6a76fbd..18705cc 100644 --- a/SD-image/www/settings.php +++ b/SD-image/www/settings.php @@ -19,6 +19,8 @@    Settings    +    Messages    +    Logout    diff --git a/Webserver.h b/Webserver.h index 31aff4f..93836cf 100644 --- a/Webserver.h +++ b/Webserver.h @@ -52,6 +52,7 @@ class Webserver void WriteByte(); boolean StringEndsWith(char* string, char* ending); boolean StringStartsWith(char* string, char* starting); + boolean StringEquals(char* s1, char* s2); void ParseQualifier(); void CheckPassword(); boolean LoadGcodeBuffer(char* gc, boolean convertWeb); @@ -65,7 +66,6 @@ class Webserver void CallPHPString(char* phpRecord); void ProcessPHPByte(char b); void WritePHPByte(); - char* PrependRoot(char* root, char* fileName); void ParseGetPost(); void CharFromClient(char c); void BlankLineFromClient(); @@ -74,6 +74,7 @@ class Webserver boolean MatchBoundary(char c); Platform* platform; + boolean active; unsigned long lastTime; int fileBeingSent; boolean writing; @@ -89,7 +90,7 @@ class Webserver boolean clientLineIsBlank; unsigned long clientCloseTime; boolean needToCloseClient; - char scratchString[STRING_LENGTH]; + char clientLine[STRING_LENGTH]; char clientRequest[STRING_LENGTH]; char clientQualifier[STRING_LENGTH]; diff --git a/Webserver.ino b/Webserver.ino index d88c956..1633363 100644 --- a/Webserver.ino +++ b/Webserver.ino @@ -44,7 +44,20 @@ boolean Webserver::StringEndsWith(char* string, char* ending) if(k > j) return false; - return(!strcmp(&string[j - k], ending)); + return(StringEquals(&string[j - k], ending)); +} + +boolean Webserver::StringEquals(char* s1, char* s2) +{ + int i = 0; + while(s1[i] && s2[i]) + { + if(tolower(s1[i]) != tolower(s2[i])) + return false; + i++; + } + + return !(s1[i] || s2[i]); } boolean Webserver::StringStartsWith(char* string, char* starting) @@ -103,12 +116,6 @@ boolean Webserver::MatchBoundary(char c) return false; } -char* Webserver::PrependRoot(char* root, char* fileName) -{ - strcpy(scratchString, root); - return strcat(scratchString, fileName); -} - //**************************************************************************************************** @@ -140,7 +147,7 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb) if(strlen(gc) > GCODE_LENGTH-1) { - platform->Message(HOST_MESSAGE, "Webserver: GCode buffer overflow.\n"); + platform->Message(HOST_MESSAGE, "Webserver: GCode buffer overflow.
\n"); return false; } @@ -170,6 +177,8 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb) } gcodeBuffer[gcodePointer++] = c; } + while(isspace(gcodeBuffer[gcodePointer - 1]) && gcodePointer > 0) // Kill any trailing space + gcodePointer--; gcodeBuffer[gcodePointer] = 0; gcodePointer = 0; @@ -182,13 +191,13 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb) return; }*/ - if(StringStartsWith(gcodeBuffer, "M30")) // Delete file? + if(StringStartsWith(gcodeBuffer, "M30 ")) // Delete file? { if(!platform->DeleteFile(&gcodeBuffer[4])) { platform->Message(HOST_MESSAGE, "Unsuccsessful attempt to delete: "); platform->Message(HOST_MESSAGE, &gcodeBuffer[4]); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, "
\n"); } gcodePointer = 0; gcodeBuffer[gcodePointer] = 0; @@ -255,12 +264,12 @@ void Webserver::SendFile(char* nameOfFileToSend) //Serial.print("File requested: "); //Serial.println(nameOfFileToSend); - fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); + fileBeingSent = platform->OpenFile(platform->PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); if(fileBeingSent < 0) { sendTable = false; nameOfFileToSend = "html404.htm"; - fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); + fileBeingSent = platform->OpenFile(platform->PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); } inPHPFile = StringEndsWith(nameOfFileToSend, ".php"); @@ -275,7 +284,7 @@ void Webserver::WriteByte() if(platform->Read(fileBeingSent, b)) platform->SendToClient(b); else - { + { platform->Close(fileBeingSent); CloseClient(); } @@ -291,7 +300,7 @@ void Webserver::CheckPassword() return; gotPassword = true; - strcpy(clientRequest, "control.php"); + strcpy(clientRequest, INDEX_PAGE); } /* @@ -315,6 +324,10 @@ void Webserver::ParseGetPost() // Serial.print("HTTP request: "); // Serial.println(clientLine); + platform->Message(HOST_MESSAGE, "HTTP request: "); + platform->Message(HOST_MESSAGE, clientLine); + platform->Message(HOST_MESSAGE, "
\n"); + int i = 5; int j = 0; clientRequest[j] = 0; @@ -358,7 +371,10 @@ void Webserver::ParseClientLine() postSeen = false; getSeen = true; if(!clientRequest[0]) - strcpy(clientRequest, "control.php"); + strcpy(clientRequest, INDEX_PAGE); +// Serial.println(MESSAGE_FILE); +// Serial.println(clientRequest); +// Serial.println(gettingMessages); return; } @@ -369,7 +385,7 @@ void Webserver::ParseClientLine() postSeen = true; getSeen = false; if(!clientRequest[0]) - strcpy(clientRequest, "print.php"); + strcpy(clientRequest, PRINT_PAGE); return; } @@ -379,7 +395,7 @@ void Webserver::ParseClientLine() { if(strlen(&clientLine[bnd]) >= POST_LENGTH - 4) { - platform->Message(HOST_MESSAGE, "Post boundary buffer overflow.\n"); + platform->Message(HOST_MESSAGE, "Post boundary buffer overflow.
\n"); return; } postBoundary[0] = '-'; @@ -396,7 +412,7 @@ void Webserver::ParseClientLine() bnd = StringContains(clientLine, "filename=\""); if(bnd < 0) { - platform->Message(HOST_MESSAGE, "Post disposition gives no filename.\n"); + platform->Message(HOST_MESSAGE, "Post disposition gives no filename.
\n"); return; } int i = 0; @@ -406,7 +422,7 @@ void Webserver::ParseClientLine() if(i >= POST_LENGTH) { i = 0; - platform->Message(HOST_MESSAGE, "Post filename buffer overflow.\n"); + platform->Message(HOST_MESSAGE, "Post filename buffer overflow.
\n"); } } postFileName[i] = 0; @@ -430,8 +446,8 @@ void Webserver::ParseQualifier() if(StringStartsWith(clientQualifier, "gcode=")) { if(!LoadGcodeBuffer(&clientQualifier[6], true)) - platform->Message(HOST_MESSAGE, "Webserver: buffer not free!\n"); - //strcpy(clientRequest, "control.php"); + platform->Message(HOST_MESSAGE, "Webserver: buffer not free!
\n"); + //strcpy(clientRequest, INDEX_PAGE); } } @@ -462,12 +478,12 @@ void Webserver::BlankLineFromClient() if(receivingPost) { - postFile = platform->OpenFile(PrependRoot(platform->GetGcodeDir(), postFileName), true); + postFile = platform->OpenFile(platform->PrependRoot(platform->GetGcodeDir(), postFileName), true); if(postFile < 0 || !postBoundary[0]) { platform->Message(HOST_MESSAGE, "Can't open file for write or no post boundary: "); - platform->Message(HOST_MESSAGE, PrependRoot(platform->GetGcodeDir(), postFileName)); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, platform->PrependRoot(platform->GetGcodeDir(), postFileName)); + platform->Message(HOST_MESSAGE, "
\n"); InitialisePost(); } } @@ -498,7 +514,7 @@ void Webserver::CharFromClient(char c) clientLinePointer++; if(clientLinePointer >= STRING_LENGTH) { - platform->Message(HOST_MESSAGE,"Client read buffer overflow.\n"); + platform->Message(HOST_MESSAGE,"Client read buffer overflow.
\n"); clientLinePointer = 0; clientLine[clientLinePointer] = 0; } @@ -508,7 +524,10 @@ void Webserver::CharFromClient(char c) // Deal with input/output from/to the client (if any) one byte at a time. void Webserver::Spin() -{ +{ + if(!active) + return; + if(writing) { if(inPHPFile) @@ -523,7 +542,7 @@ void Webserver::Spin() if(platform->ClientStatus() & AVAILABLE) { char c = platform->ClientRead(); - Serial.write(c); + //Serial.write(c); if(receivingPost && postFile >= 0) { @@ -575,13 +594,13 @@ void Webserver::InitialisePHP() char Webserver::PHPParse(char* phpString) { - if(!strcmp(phpString, "if(")) + if(StringEquals(phpString, "if(")) return PHP_IF; - if(!strcmp(phpString, "echo")) + if(StringEquals(phpString, "echo")) return PHP_ECHO; - if(!strcmp(phpString, "print(")) + if(StringEquals(phpString, "print(")) return PHP_PRINT; return NO_PHP; @@ -592,15 +611,15 @@ boolean Webserver::PrintLinkTable() { boolean r = sendTable; sendTable = true; r boolean Webserver::CallPHPBoolean(char* phpRecord) { - if(!strcmp(phpRecord, "gotPassword(")) + if(StringEquals(phpRecord, "gotPassword(")) return gotPassword; - if(!strcmp(phpRecord, "printLinkTable(")) + if(StringEquals(phpRecord, "printLinkTable(")) return PrintLinkTable(); platform->Message(HOST_MESSAGE, "callPHPBoolean(): non-existent function - "); platform->Message(HOST_MESSAGE, phpRecord); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, "
\n"); return true; // Best default } @@ -612,28 +631,30 @@ void Webserver::GetGCodeList() void Webserver::CallPHPString(char* phpRecord) { - if(!strcmp(phpRecord, "getMyName(")) + if(StringEquals(phpRecord, "getMyName(")) { platform->SendToClient(myName); return; } - if(!strcmp(phpRecord, "getGCodeList(")) + if(StringEquals(phpRecord, "getGCodeList(")) { GetGCodeList(); return; } - if(!strcmp(phpRecord, "logout(")) + if(StringEquals(phpRecord, "logout(")) { gotPassword = false; - platform->SendToClient(""); + platform->SendToClient("SendToClient(PASSWORD_PAGE); + platform->SendToClient("\">"); return; } platform->Message(HOST_MESSAGE, "callPHPString(): non-existent function - "); platform->Message(HOST_MESSAGE, phpRecord); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, "
\n"); } void Webserver::ProcessPHPByte(char b) @@ -657,7 +678,7 @@ void Webserver::ProcessPHPByte(char b) phpRecord[phpRecordPointer++] = b; if(phpRecordPointer >= PHP_TAG_LENGTH) { - platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP record buffer overflow.\n"); + platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP record buffer overflow.
\n"); InitialisePHP(); } phpRecord[phpRecordPointer] = 0; @@ -714,7 +735,7 @@ void Webserver::ProcessPHPByte(char b) { platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP buffer overflow: "); platform->Message(HOST_MESSAGE, phpTag); - platform->Message(HOST_MESSAGE, "\n"); + platform->Message(HOST_MESSAGE, "
\n"); InitialisePHP(); return; } @@ -821,7 +842,7 @@ void Webserver::ProcessPHPByte(char b) // Should never get here... default: - platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP tag runout.\n"); + platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP tag runout.
\n"); platform->SendToClient(b); InitialisePHP(); } @@ -848,6 +869,7 @@ Webserver::Webserver(Platform* p) { //Serial.println("Webserver constructor"); platform = p; + active = false; } void Webserver::Init() @@ -872,12 +894,13 @@ void Webserver::Init() gcodePointer = 0; sendTable = true; phpRecordPointer = 0; - InitialisePost(); + InitialisePost(); + active = true; } void Webserver::Exit() { - + active = false; }