Messages webpage added with session log.

This commit is contained in:
reprappro 2013-03-04 21:56:42 +00:00
parent 31399c9efa
commit b207f31dc7
22 changed files with 387 additions and 134 deletions

View file

@ -43,6 +43,8 @@ Licence: GPL
#define PASSWORD_PAGE "passwd.php" #define PASSWORD_PAGE "passwd.php"
#define INDEX_PAGE "control.php" #define INDEX_PAGE "control.php"
#define PRINT_PAGE "print.php" #define PRINT_PAGE "print.php"
#define MESSAGE_FILE "messages.php"
#define MESSAGE_TEMPLATE "messages.txt"
#define STRING_LENGTH 1000 #define STRING_LENGTH 1000
#define PHP_TAG_LENGTH 200 #define PHP_TAG_LENGTH 200
#define POST_LENGTH 200 #define POST_LENGTH 200

View file

@ -36,6 +36,7 @@ class GCodes
void ActOnGcode(); void ActOnGcode();
Platform* platform; Platform* platform;
boolean active;
Move* move; Move* move;
Heat* heat; Heat* heat;
Webserver* webserver; Webserver* webserver;

View file

@ -23,6 +23,7 @@ Licence: GPL
GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w) GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w)
{ {
active = false;
//Serial.println("GCodes constructor"); //Serial.println("GCodes constructor");
platform = p; platform = p;
move = m; move = m;
@ -32,28 +33,32 @@ GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w)
void GCodes::Exit() void GCodes::Exit()
{ {
active = false;
} }
void GCodes::Init() void GCodes::Init()
{ {
lastTime = platform->Time(); lastTime = platform->Time();
gcodePointer = 0; gcodePointer = 0;
active = true;
} }
void GCodes::ActOnGcode() void GCodes::ActOnGcode()
{ {
platform->Message(HOST_MESSAGE, "\nGCode: "); platform->Message(HOST_MESSAGE, "GCode: ");
platform->Message(HOST_MESSAGE, gcodeBuffer); platform->Message(HOST_MESSAGE, gcodeBuffer);
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
} }
void GCodes::Spin() void GCodes::Spin()
{ {
if(!active)
return;
if(webserver->Available()) if(webserver->Available())
{ {
gcodeBuffer[gcodePointer] = webserver->Read(); gcodeBuffer[gcodePointer] = webserver->Read();

1
Heat.h
View file

@ -44,6 +44,7 @@ class Heat
private: private:
Platform* platform; Platform* platform;
boolean active;
unsigned long lastTime; unsigned long lastTime;
//float frac; //float frac;
//float inc; //float inc;

View file

@ -24,6 +24,7 @@ Heat::Heat(Platform* p)
{ {
//Serial.println("Heat constructor"); //Serial.println("Heat constructor");
platform = p; platform = p;
active = false;
} }
void Heat::Init() void Heat::Init()
@ -31,15 +32,19 @@ void Heat::Init()
lastTime = platform->Time(); lastTime = platform->Time();
//frac = 0; //frac = 0;
//inc = 0.01; //inc = 0.01;
active = true;
} }
void Heat::Exit() void Heat::Exit()
{ {
active = false;
} }
void Heat::Spin() void Heat::Spin()
{ {
if(!active)
return;
unsigned long t = platform->Time(); unsigned long t = platform->Time();
if(t - lastTime < 3000) if(t - lastTime < 3000)
return; return;

2
Move.h
View file

@ -34,7 +34,7 @@ class Move
Platform* platform; Platform* platform;
unsigned long lastTime; unsigned long lastTime;
boolean active;
}; };
#endif #endif

View file

@ -24,6 +24,7 @@ Move::Move(Platform* p)
{ {
//Serial.println("Move constructor"); //Serial.println("Move constructor");
platform = p; platform = p;
active = false;
} }
void Move::Init() void Move::Init()
@ -33,15 +34,19 @@ void Move::Init()
platform->SetDirection(Y_AXIS, FORWARDS); platform->SetDirection(Y_AXIS, FORWARDS);
platform->SetDirection(Z_AXIS, FORWARDS); platform->SetDirection(Z_AXIS, FORWARDS);
platform->SetDirection(3, FORWARDS); platform->SetDirection(3, FORWARDS);
active = true;
} }
void Move::Exit() void Move::Exit()
{ {
active = false;
} }
void Move::Spin() void Move::Spin()
{ {
if(!active)
return;
unsigned long t = platform->Time(); unsigned long t = platform->Time();
if(t - lastTime < 300) if(t - lastTime < 300)
return; return;

View file

@ -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). 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). 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, boolean Read(int file, unsigned char& b); // Read a single byte from a file into b,
// returned value is false for EoF, true otherwise // returned value is false for EoF, true otherwise
void WriteString(int file, char* s); // Write the string to a file. void WriteString(int file, char* s); // Write the string to a file.
@ -198,6 +199,7 @@ class Platform
char* GetTempDir(); // Where temporary files are char* GetTempDir(); // Where temporary files are
void Close(int file); // Close a file or device, writing any unwritten buffer contents first. void Close(int file); // Close a file or device, writing any unwritten buffer contents first.
boolean DeleteFile(char* fileName); // Delete a file boolean DeleteFile(char* fileName); // Delete a file
char* PrependRoot(char* root, char* fileName);
unsigned char ClientRead(); // Read a byte from the client unsigned char ClientRead(); // Read a byte from the client
void SendToClient(char* message); // Send string to the host void SendToClient(char* message); // Send string to the host
@ -229,6 +231,8 @@ class Platform
unsigned long lastTime; unsigned long lastTime;
boolean active;
// Load settings from local storage // Load settings from local storage
bool LoadFromStore(); bool LoadFromStore();
@ -278,6 +282,7 @@ class Platform
char* sysDir; char* sysDir;
char* tempDir; char* tempDir;
char fileList[FILE_LIST_LENGTH]; char fileList[FILE_LIST_LENGTH];
char scratchString[STRING_LENGTH];
// Network connection // Network connection

View file

@ -39,11 +39,7 @@ void loop()
Platform::Platform(RepRap* r) Platform::Platform(RepRap* r)
{ {
reprap = r; reprap = r;
} active = false;
RepRap* Platform::GetRepRap()
{
return reprap;
} }
void Platform::Init() void Platform::Init()
@ -164,11 +160,36 @@ void Platform::Init()
if (!SD.begin(SD_SPI)) if (!SD.begin(SD_SPI))
Serial.println("SD initialization failed."); Serial.println("SD initialization failed.");
// SD.begin() returns with the SPI disabled, so you need not disable it here // 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() 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, "FileList - directory: ");
Message(HOST_MESSAGE, directory); Message(HOST_MESSAGE, directory);
Message(HOST_MESSAGE, " has too many files!"); Message(HOST_MESSAGE, " has too many files!<br>\n");
return ""; return "";
} }
} }
@ -284,7 +305,7 @@ boolean Platform::DeleteFile(char* fileName)
int Platform::OpenFile(char* fileName, boolean write) int Platform::OpenFile(char* fileName, boolean write)
{ {
int result = -1; int result = -1;
for(int i=0; i < MAX_FILES; i++) for(int i = 0; i < MAX_FILES; i++)
if(!inUse[i]) if(!inUse[i])
{ {
result = i; result = i;
@ -292,7 +313,7 @@ int Platform::OpenFile(char* fileName, boolean write)
} }
if(result < 0) if(result < 0)
{ {
Message(HOST_MESSAGE, "Max open file count exceeded.\n"); Message(HOST_MESSAGE, "Max open file count exceeded.<br>\n");
return -1; return -1;
} }
@ -300,15 +321,16 @@ int Platform::OpenFile(char* fileName, boolean write)
{ {
if(!write) if(!write)
{ {
Message(HOST_MESSAGE, "File not found for reading.\n"); Message(HOST_MESSAGE, "File not found for reading.<br>\n");
return -1; return -1;
} }
files[result] = SD.open(fileName, FILE_WRITE); files[result] = SD.open(fileName, FILE_WRITE);
} else } else
{ {
if(write) if(write)
{
files[result] = SD.open(fileName, FILE_WRITE); files[result] = SD.open(fileName, FILE_WRITE);
else }else
files[result] = SD.open(fileName, FILE_READ); files[result] = SD.open(fileName, FILE_READ);
} }
@ -316,6 +338,17 @@ int Platform::OpenFile(char* fileName, boolean write)
return result; return result;
} }
void Platform::GoToEnd(int file)
{
if(!inUse[file])
{
Message(HOST_MESSAGE, "Attempt to seek on a non-open file.<br>\n");
return;
}
unsigned long e = files[file].size();
files[file].seek(e);
}
void Platform::Close(int file) void Platform::Close(int file)
{ {
files[file].close(); files[file].close();
@ -327,7 +360,7 @@ boolean Platform::Read(int file, unsigned char& b)
{ {
if(!inUse[file]) 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.<br>\n");
return false; return false;
} }
@ -341,7 +374,7 @@ void Platform::Write(int file, char b)
{ {
if(!inUse[file]) 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.<br>\n");
return; return;
} }
@ -352,7 +385,7 @@ void Platform::WriteString(int file, char* b)
{ {
if(!inUse[file]) 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.<br>\n");
return; return;
} }
@ -375,7 +408,12 @@ void Platform::Message(char type, char* message)
case HOST_MESSAGE: case HOST_MESSAGE:
default: default:
int m = OpenFile(PrependRoot(GetWebDir(), MESSAGE_FILE), true);
GoToEnd(m);
WriteString(m, message);
Serial.print(message); Serial.print(message);
Close(m);
} }
} }
@ -390,7 +428,7 @@ void Platform::SendToClient(char* message)
//Serial.print("Sent: "); //Serial.print("Sent: ");
//Serial.print(message); //Serial.print(message);
} else } else
Message(HOST_MESSAGE, "Attempt to send string to disconnected client.\n"); Message(HOST_MESSAGE, "Attempt to send string to disconnected client.<br>\n");
} }
// Where the php/htm etc files are // Where the php/htm etc files are
@ -429,6 +467,9 @@ char* Platform::GetTempDir()
void Platform::Spin() void Platform::Spin()
{ {
if(!active)
return;
ClientMonitor(); ClientMonitor();
if(Time() - lastTime < 2000000) if(Time() - lastTime < 2000000)
return; return;

View file

@ -54,6 +54,7 @@ class RepRap
private: private:
Platform* platform; Platform* platform;
boolean active;
Move* move; Move* move;
Heat* heat; Heat* heat;
GCodes* gcodes; GCodes* gcodes;
@ -71,6 +72,7 @@ class RepRap
inline RepRap::RepRap() inline RepRap::RepRap()
{ {
active = false;
platform = new Platform(this); platform = new Platform(this);
move = new Move(platform); move = new Move(platform);
heat = new Heat(platform); heat = new Heat(platform);

View file

@ -60,11 +60,13 @@ void RepRap::Init()
heat->Init(); heat->Init();
gcodes->Init(); gcodes->Init();
webserver->Init(); webserver->Init();
platform->Message(HOST_MESSAGE, "RepRapPro RepRap Firmware (Re)Started\n\n"); platform->Message(HOST_MESSAGE, "RepRapPro RepRap Firmware (Re)Started<br>\n");
active = true;
} }
void RepRap::Exit() void RepRap::Exit()
{ {
active = false;
webserver->Exit(); webserver->Exit();
gcodes->Exit(); gcodes->Exit();
heat->Exit(); heat->Exit();
@ -74,6 +76,9 @@ void RepRap::Exit()
void RepRap::Spin() void RepRap::Spin()
{ {
if(!active)
return;
platform->Spin(); platform->Spin();
move->Spin(); move->Spin();
heat->Spin(); heat->Spin();

View file

@ -19,6 +19,8 @@
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table> </tr></table>
@ -86,7 +88,7 @@
</div></table> </div></table>
<br><br><form name="input" action="gather.asp" method="get">Send a G Code: <input type="text" name="gcode"><input type="submit" value="Send"></form> <br><br><form name="input" action="control.php" method="get">Send a G Code: <input type="text" name="gcode"><input type="submit" value="Send"></form>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">

View file

@ -19,6 +19,8 @@
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table> </tr></table>
@ -49,39 +51,39 @@
</tr> </tr>
<tr> <tr>
<td><button type="button" onclick="return homex()">Home X</button></td> <td><button type="button" onclick="return home('X')">Home X</button></td>
<td><button type="button" onclick="return xm100mm()">&lt;--- X</button></td> <td><button type="button" onclick="return move('X', -100)">&lt;--- X</button></td>
<td><button type="button" onclick="return xm10mm()">&lt;-- X</button></td> <td><button type="button" onclick="return move('X', -10)">&lt;-- X</button></td>
<td><button type="button" onclick="return xm1mm()">&lt;- X</button></td> <td><button type="button" onclick="return move('X', -1)">&lt;- X</button></td>
<td><button type="button" onclick="return xm01mm()">&lt; X</button></td> <td><button type="button" onclick="return move('X', -0.1)">&lt; X</button></td>
<td><button type="button" onclick="return xp01mm()">X &gt;</button></td> <td><button type="button" onclick="return move('X', 0.1)">X &gt;</button></td>
<td><button type="button" onclick="return xp1mm()">X --&gt;</button></td> <td><button type="button" onclick="return move('X', 1)">X --&gt;</button></td>
<td><button type="button" onclick="return xp10mm()">X --&gt;</button></td> <td><button type="button" onclick="return move('X', 10)">X --&gt;</button></td>
<td><button type="button" onclick="return xp100mm()">X ---&gt;</button></td> <td><button type="button" onclick="return move('X', 100)">X ---&gt;</button></td>
</tr> </tr>
<tr> <tr>
<td><button type="button" onclick="return homey()">Home Y</button></td> <td><button type="button" onclick="return home('Y')">Home Y</button></td>
<td><button type="button" onclick="return ym100mm()">&lt;--- Y</button></td> <td><button type="button" onclick="return move('Y', -100)">&lt;--- Y</button></td>
<td><button type="button" onclick="return ym10mm()">&lt;-- Y</button></td> <td><button type="button" onclick="return move('Y', -10)">&lt;-- Y</button></td>
<td><button type="button" onclick="return ym1mm()">&lt;- Y</button></td> <td><button type="button" onclick="return move('Y', -1)">&lt;- Y</button></td>
<td><button type="button" onclick="return ym01mm()">&lt; Y</button></td> <td><button type="button" onclick="return move('Y', -0.1)">&lt; Y</button></td>
<td><button type="button" onclick="return yp01mm()">Y &gt;</button></td> <td><button type="button" onclick="return move('Y', 0.1)">Y &gt;</button></td>
<td><button type="button" onclick="return yp1mm()">Y -&gt;</button></td> <td><button type="button" onclick="return move('Y', 1)">Y -&gt;</button></td>
<td><button type="button" onclick="return yp10mm()">Y --&gt;</button></td> <td><button type="button" onclick="return move('Y', 10)">Y --&gt;</button></td>
<td><button type="button" onclick="return yp100mm()">Y ---&gt;</button></td> <td><button type="button" onclick="return move('Y', 100)">Y ---&gt;</button></td>
</tr> </tr>
<tr> <tr>
<td><button type="button" onclick="return homez()">Home Z</button></td> <td><button type="button" onclick="return home('Z')">Home Z</button></td>
<td><button type="button" onclick="return zm100mm()">&lt;--- Z</button></td> <td><button type="button" onclick="return move('Z', -100)">&lt;--- Z</button></td>
<td><button type="button" onclick="return zm10mm()">&lt;-- Z</button></td> <td><button type="button" onclick="return move('Z', -10)">&lt;-- Z</button></td>
<td><button type="button" onclick="return zm1mm()">&lt;- Z</button></td> <td><button type="button" onclick="return move('Z', -1)">&lt;- Z</button></td>
<td><button type="button" onclick="return zm01mm()">&lt; Z</button></td> <td><button type="button" onclick="return move('Z', -0.1)">&lt; Z</button></td>
<td><button type="button" onclick="return zp01mm()">Z &gt;</button></td> <td><button type="button" onclick="return move('Z', 0.1)">Z &gt;</button></td>
<td><button type="button" onclick="return zp1mm()">Z -&gt;</button></td> <td><button type="button" onclick="return move('Z', 1)">Z -&gt;</button></td>
<td><button type="button" onclick="return zp10mm()">Z --&gt;</button></td> <td><button type="button" onclick="return move('Z', 10)">Z --&gt;</button></td>
<td><button type="button" onclick="return zp100mm()">Z ---&gt;</button></td> <td><button type="button" onclick="return move('Z', 100)">Z ---&gt;</button></td>
</tr> </tr>
</div></table> </div></table>
@ -92,39 +94,8 @@
function homea(){ window.location.href = "control.php?gcode=G28";} function homea(){ window.location.href = "control.php?gcode=G28";}
function homex(){ window.location.href = "control.php?gcode=G28%20X0";} function home(axis){ window.location.href = "control.php?gcode=G28%20" + axis + "0";}
function homey(){ window.location.href = "control.php?gcode=G28%20Y0";} function move(axis, d){ window.location.href = "control.php?gcode=G91%0AG1%20" + axis + d + "%0AG90";}
function homez(){ window.location.href = "control.php?gcode=G28%20Z0";}
function xp01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X0.1%0AG90";}
function xp1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X1%0AG90";}
function xp10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X10%0AG90";}
function xp100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X100%0AG90";}
function xm01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X-0.1%0AG90";}
function xm1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X-1%0AG90";}
function xm10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X-10%0AG90";}
function xm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X-100%0AG90";}
function yp01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y0.1%0AG90";}
function yp1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y1%0AG90";}
function yp10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y10%0AG90";}
function yp100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y100%0AG90";}
function ym01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y-0.1%0AG90";}
function ym1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y-1%0AG90";}
function ym10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y-10%0AG90";}
function ym100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y-100%0AG90";}
function zp01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z0.1%0AG90";}
function zp1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z1%0AG90";}
function zp10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z10%0AG90";}
function zp100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z100%0AG90";}
function zm01mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z-0.1%0AG90";}
function zm1mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z-1%0AG90";}
function zm10mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z-10%0AG90";}
function zm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z-100%0AG90";}
</script> </script>
<br><br></html> <br><br></html>

View file

@ -20,6 +20,8 @@
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table> </tr></table>

View file

@ -29,12 +29,62 @@
<br><br> <br><br>
<br><br>Click a file to delete it: Click a file to delete it:
<br>
<script language="javascript" type="text/javascript">
function fileList()
{
var files = [<?php print(getGCodeList()); ?>];
return files;
}
function printGCodeTable()
{
var list = fileList();
var count = list.length;
if(count <= 0)
return "<br>No GCode files present.<br>";
var cols = Math.floor(Math.sqrt(count)) + 1;
var rows = Math.floor(count/cols) + 1;
var result = "<table>";
var k = 0;
for(var i = 0; i < cols; i++)
{
result += "<tr>";
for(var j = 0; j < rows; j++)
{
var fileName = list[i*rows + j];
result += "<td>&nbsp;<button type=\"button\" onclick=\"return deleteFile('";
result += "gcodes/" + fileName; // Need PHP in here
result += "')\">";
result += fileName;
result += "</button>&nbsp;</td>";
k++;
if(k >= count)
break;
}
result += "</tr>";
if(k >= count)
break;
}
result += "</table>";
return result;
}
document.write(printGCodeTable());
</script>
<br><br> <br><br>
<?php print(deleteGCodeTable()); ?>
<br><br>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">

99
SD-image/www/message.txt~ Normal file
View file

@ -0,0 +1,99 @@
<!DOCTYPE HTML>
<head>
<style type="text/css">td { text-align: center; } </style>
</head>
<html>
<h2>RepRap:
<?php print(getMyName()); ?>
<?php if(gotPassword()) echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://reprappro.com" target="_blank"><img src="logo.png" alt="RepRapPro logo"></a>'; ?>
</h2><br><br>
<?php if(printLinkTable()) echo '<table><tr>
<td>&nbsp;&nbsp;&nbsp;<a href="control.php">Control</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="print.php">Print</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="http://reprap.org/wiki/RepRapPro_RepRap_Firmware" target="_blank">Help</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table>
<br><br>'; ?>
<H3>Messages:</H3><br><br>
<tr>
<th colspan="9">Move X Y Z</th>
</tr>
<tr>
<td rowspan="2"><button type="button" onclick="return homea()">Home<br>All</button></td>
<td colspan="4">- mm</td>
<td colspan="4">+ mm</td>
</tr>
<tr>
<td>-100</td>
<td>-10</td>
<td>-1</td>
<td>-0.1</td>
<td>0.1</td>
<td>1</td>
<td>10</td>
<td>100</td>
</tr>
<tr>
<td><button type="button" onclick="return home('X')">Home X</button></td>
<td><button type="button" onclick="return move('X', -100)">&lt;--- X</button></td>
<td><button type="button" onclick="return move('X', -10)">&lt;-- X</button></td>
<td><button type="button" onclick="return move('X', -1)">&lt;- X</button></td>
<td><button type="button" onclick="return move('X', -0.1)">&lt; X</button></td>
<td><button type="button" onclick="return move('X', 0.1)">X &gt;</button></td>
<td><button type="button" onclick="return move('X', 1)">X --&gt;</button></td>
<td><button type="button" onclick="return move('X', 10)">X --&gt;</button></td>
<td><button type="button" onclick="return move('X', 100)">X ---&gt;</button></td>
</tr>
<tr>
<td><button type="button" onclick="return home('Y')">Home Y</button></td>
<td><button type="button" onclick="return move('Y', -100)">&lt;--- Y</button></td>
<td><button type="button" onclick="return move('Y', -10)">&lt;-- Y</button></td>
<td><button type="button" onclick="return move('Y', -1)">&lt;- Y</button></td>
<td><button type="button" onclick="return move('Y', -0.1)">&lt; Y</button></td>
<td><button type="button" onclick="return move('Y', 0.1)">Y &gt;</button></td>
<td><button type="button" onclick="return move('Y', 1)">Y -&gt;</button></td>
<td><button type="button" onclick="return move('Y', 10)">Y --&gt;</button></td>
<td><button type="button" onclick="return move('Y', 100)">Y ---&gt;</button></td>
</tr>
<tr>
<td><button type="button" onclick="return home('Z')">Home Z</button></td>
<td><button type="button" onclick="return move('Z', -100)">&lt;--- Z</button></td>
<td><button type="button" onclick="return move('Z', -10)">&lt;-- Z</button></td>
<td><button type="button" onclick="return move('Z', -1)">&lt;- Z</button></td>
<td><button type="button" onclick="return move('Z', -0.1)">&lt; Z</button></td>
<td><button type="button" onclick="return move('Z', 0.1)">Z &gt;</button></td>
<td><button type="button" onclick="return move('Z', 1)">Z -&gt;</button></td>
<td><button type="button" onclick="return move('Z', 10)">Z --&gt;</button></td>
<td><button type="button" onclick="return move('Z', 100)">Z ---&gt;</button></td>
</tr>
</div></table>
<br><br><form name="input" action="gather.asp" method="get">Send a G Code: <input type="text" name="gcode"><input type="submit" value="Send"></form>
<script language="javascript" type="text/javascript">
function homea(){ window.location.href = "control.php?gcode=G28";}
function home(axis){ window.location.href = "control.php?gcode=G28%20" + axis + "0";}
function move(axis, d){ window.location.href = "control.php?gcode=G91%0AG1%20" + axis + d + "%0AG90";}
</script>
<br><br></html>

30
SD-image/www/messages.txt Normal file
View file

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<head>
<style type="text/css">td { text-align: center; } </style>
</head>
<html>
<h2>RepRap:
<?php print(getMyName()); ?>
<?php if(gotPassword()) echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://reprappro.com" target="_blank"><img src="logo.png" alt="RepRapPro logo"></a>'; ?>
</h2><br><br>
<?php if(printLinkTable()) echo '<table><tr>
<td>&nbsp;&nbsp;&nbsp;<a href="control.php">Control</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="print.php">Print</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="http://reprap.org/wiki/RepRapPro_RepRap_Firmware" target="_blank">Help</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table>
<br><br>'; ?>
<H3>Messages:</H3><br><br>

View file

@ -18,6 +18,7 @@
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>

View file

@ -115,7 +115,7 @@ function checkFileName(uploadForm)
var list = fileList(); var list = fileList();
for(var i = 0; i < list.length; i++) 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 " + return confirm("This will overwrite the file " +
list[i] + " on <?php print(getMyName()); ?>." + list[i] + " on <?php print(getMyName()); ?>." +

View file

@ -19,6 +19,8 @@
<td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="settings.php">Settings</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="messages.php">Messages</a>&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td> <td>&nbsp;&nbsp;&nbsp;<a href="logout.php">Logout</a>&nbsp;&nbsp;&nbsp;</td>
</tr></table> </tr></table>

View file

@ -52,6 +52,7 @@ class Webserver
void WriteByte(); void WriteByte();
boolean StringEndsWith(char* string, char* ending); boolean StringEndsWith(char* string, char* ending);
boolean StringStartsWith(char* string, char* starting); boolean StringStartsWith(char* string, char* starting);
boolean StringEquals(char* s1, char* s2);
void ParseQualifier(); void ParseQualifier();
void CheckPassword(); void CheckPassword();
boolean LoadGcodeBuffer(char* gc, boolean convertWeb); boolean LoadGcodeBuffer(char* gc, boolean convertWeb);
@ -65,7 +66,6 @@ class Webserver
void CallPHPString(char* phpRecord); void CallPHPString(char* phpRecord);
void ProcessPHPByte(char b); void ProcessPHPByte(char b);
void WritePHPByte(); void WritePHPByte();
char* PrependRoot(char* root, char* fileName);
void ParseGetPost(); void ParseGetPost();
void CharFromClient(char c); void CharFromClient(char c);
void BlankLineFromClient(); void BlankLineFromClient();
@ -74,6 +74,7 @@ class Webserver
boolean MatchBoundary(char c); boolean MatchBoundary(char c);
Platform* platform; Platform* platform;
boolean active;
unsigned long lastTime; unsigned long lastTime;
int fileBeingSent; int fileBeingSent;
boolean writing; boolean writing;
@ -89,7 +90,7 @@ class Webserver
boolean clientLineIsBlank; boolean clientLineIsBlank;
unsigned long clientCloseTime; unsigned long clientCloseTime;
boolean needToCloseClient; boolean needToCloseClient;
char scratchString[STRING_LENGTH];
char clientLine[STRING_LENGTH]; char clientLine[STRING_LENGTH];
char clientRequest[STRING_LENGTH]; char clientRequest[STRING_LENGTH];
char clientQualifier[STRING_LENGTH]; char clientQualifier[STRING_LENGTH];

View file

@ -44,7 +44,20 @@ boolean Webserver::StringEndsWith(char* string, char* ending)
if(k > j) if(k > j)
return false; 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) boolean Webserver::StringStartsWith(char* string, char* starting)
@ -103,12 +116,6 @@ boolean Webserver::MatchBoundary(char c)
return false; 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) if(strlen(gc) > GCODE_LENGTH-1)
{ {
platform->Message(HOST_MESSAGE, "Webserver: GCode buffer overflow.\n"); platform->Message(HOST_MESSAGE, "Webserver: GCode buffer overflow.<br>\n");
return false; return false;
} }
@ -170,6 +177,8 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb)
} }
gcodeBuffer[gcodePointer++] = c; gcodeBuffer[gcodePointer++] = c;
} }
while(isspace(gcodeBuffer[gcodePointer - 1]) && gcodePointer > 0) // Kill any trailing space
gcodePointer--;
gcodeBuffer[gcodePointer] = 0; gcodeBuffer[gcodePointer] = 0;
gcodePointer = 0; gcodePointer = 0;
@ -182,13 +191,13 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb)
return; return;
}*/ }*/
if(StringStartsWith(gcodeBuffer, "M30")) // Delete file? if(StringStartsWith(gcodeBuffer, "M30 ")) // Delete file?
{ {
if(!platform->DeleteFile(&gcodeBuffer[4])) if(!platform->DeleteFile(&gcodeBuffer[4]))
{ {
platform->Message(HOST_MESSAGE, "Unsuccsessful attempt to delete: "); platform->Message(HOST_MESSAGE, "Unsuccsessful attempt to delete: ");
platform->Message(HOST_MESSAGE, &gcodeBuffer[4]); platform->Message(HOST_MESSAGE, &gcodeBuffer[4]);
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
} }
gcodePointer = 0; gcodePointer = 0;
gcodeBuffer[gcodePointer] = 0; gcodeBuffer[gcodePointer] = 0;
@ -255,12 +264,12 @@ void Webserver::SendFile(char* nameOfFileToSend)
//Serial.print("File requested: "); //Serial.print("File requested: ");
//Serial.println(nameOfFileToSend); //Serial.println(nameOfFileToSend);
fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); fileBeingSent = platform->OpenFile(platform->PrependRoot(platform->GetWebDir(), nameOfFileToSend), false);
if(fileBeingSent < 0) if(fileBeingSent < 0)
{ {
sendTable = false; sendTable = false;
nameOfFileToSend = "html404.htm"; nameOfFileToSend = "html404.htm";
fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); fileBeingSent = platform->OpenFile(platform->PrependRoot(platform->GetWebDir(), nameOfFileToSend), false);
} }
inPHPFile = StringEndsWith(nameOfFileToSend, ".php"); inPHPFile = StringEndsWith(nameOfFileToSend, ".php");
@ -291,7 +300,7 @@ void Webserver::CheckPassword()
return; return;
gotPassword = true; gotPassword = true;
strcpy(clientRequest, "control.php"); strcpy(clientRequest, INDEX_PAGE);
} }
/* /*
@ -315,6 +324,10 @@ void Webserver::ParseGetPost()
// Serial.print("HTTP request: "); // Serial.print("HTTP request: ");
// Serial.println(clientLine); // Serial.println(clientLine);
platform->Message(HOST_MESSAGE, "HTTP request: ");
platform->Message(HOST_MESSAGE, clientLine);
platform->Message(HOST_MESSAGE, "<br>\n");
int i = 5; int i = 5;
int j = 0; int j = 0;
clientRequest[j] = 0; clientRequest[j] = 0;
@ -358,7 +371,10 @@ void Webserver::ParseClientLine()
postSeen = false; postSeen = false;
getSeen = true; getSeen = true;
if(!clientRequest[0]) if(!clientRequest[0])
strcpy(clientRequest, "control.php"); strcpy(clientRequest, INDEX_PAGE);
// Serial.println(MESSAGE_FILE);
// Serial.println(clientRequest);
// Serial.println(gettingMessages);
return; return;
} }
@ -369,7 +385,7 @@ void Webserver::ParseClientLine()
postSeen = true; postSeen = true;
getSeen = false; getSeen = false;
if(!clientRequest[0]) if(!clientRequest[0])
strcpy(clientRequest, "print.php"); strcpy(clientRequest, PRINT_PAGE);
return; return;
} }
@ -379,7 +395,7 @@ void Webserver::ParseClientLine()
{ {
if(strlen(&clientLine[bnd]) >= POST_LENGTH - 4) if(strlen(&clientLine[bnd]) >= POST_LENGTH - 4)
{ {
platform->Message(HOST_MESSAGE, "Post boundary buffer overflow.\n"); platform->Message(HOST_MESSAGE, "Post boundary buffer overflow.<br>\n");
return; return;
} }
postBoundary[0] = '-'; postBoundary[0] = '-';
@ -396,7 +412,7 @@ void Webserver::ParseClientLine()
bnd = StringContains(clientLine, "filename=\""); bnd = StringContains(clientLine, "filename=\"");
if(bnd < 0) if(bnd < 0)
{ {
platform->Message(HOST_MESSAGE, "Post disposition gives no filename.\n"); platform->Message(HOST_MESSAGE, "Post disposition gives no filename.<br>\n");
return; return;
} }
int i = 0; int i = 0;
@ -406,7 +422,7 @@ void Webserver::ParseClientLine()
if(i >= POST_LENGTH) if(i >= POST_LENGTH)
{ {
i = 0; i = 0;
platform->Message(HOST_MESSAGE, "Post filename buffer overflow.\n"); platform->Message(HOST_MESSAGE, "Post filename buffer overflow.<br>\n");
} }
} }
postFileName[i] = 0; postFileName[i] = 0;
@ -430,8 +446,8 @@ void Webserver::ParseQualifier()
if(StringStartsWith(clientQualifier, "gcode=")) if(StringStartsWith(clientQualifier, "gcode="))
{ {
if(!LoadGcodeBuffer(&clientQualifier[6], true)) if(!LoadGcodeBuffer(&clientQualifier[6], true))
platform->Message(HOST_MESSAGE, "Webserver: buffer not free!\n"); platform->Message(HOST_MESSAGE, "Webserver: buffer not free!<br>\n");
//strcpy(clientRequest, "control.php"); //strcpy(clientRequest, INDEX_PAGE);
} }
} }
@ -462,12 +478,12 @@ void Webserver::BlankLineFromClient()
if(receivingPost) if(receivingPost)
{ {
postFile = platform->OpenFile(PrependRoot(platform->GetGcodeDir(), postFileName), true); postFile = platform->OpenFile(platform->PrependRoot(platform->GetGcodeDir(), postFileName), true);
if(postFile < 0 || !postBoundary[0]) if(postFile < 0 || !postBoundary[0])
{ {
platform->Message(HOST_MESSAGE, "Can't open file for write or no post boundary: "); 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, platform->PrependRoot(platform->GetGcodeDir(), postFileName));
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
InitialisePost(); InitialisePost();
} }
} }
@ -498,7 +514,7 @@ void Webserver::CharFromClient(char c)
clientLinePointer++; clientLinePointer++;
if(clientLinePointer >= STRING_LENGTH) if(clientLinePointer >= STRING_LENGTH)
{ {
platform->Message(HOST_MESSAGE,"Client read buffer overflow.\n"); platform->Message(HOST_MESSAGE,"Client read buffer overflow.<br>\n");
clientLinePointer = 0; clientLinePointer = 0;
clientLine[clientLinePointer] = 0; clientLine[clientLinePointer] = 0;
} }
@ -509,6 +525,9 @@ void Webserver::CharFromClient(char c)
void Webserver::Spin() void Webserver::Spin()
{ {
if(!active)
return;
if(writing) if(writing)
{ {
if(inPHPFile) if(inPHPFile)
@ -523,7 +542,7 @@ void Webserver::Spin()
if(platform->ClientStatus() & AVAILABLE) if(platform->ClientStatus() & AVAILABLE)
{ {
char c = platform->ClientRead(); char c = platform->ClientRead();
Serial.write(c); //Serial.write(c);
if(receivingPost && postFile >= 0) if(receivingPost && postFile >= 0)
{ {
@ -575,13 +594,13 @@ void Webserver::InitialisePHP()
char Webserver::PHPParse(char* phpString) char Webserver::PHPParse(char* phpString)
{ {
if(!strcmp(phpString, "if(")) if(StringEquals(phpString, "if("))
return PHP_IF; return PHP_IF;
if(!strcmp(phpString, "echo")) if(StringEquals(phpString, "echo"))
return PHP_ECHO; return PHP_ECHO;
if(!strcmp(phpString, "print(")) if(StringEquals(phpString, "print("))
return PHP_PRINT; return PHP_PRINT;
return NO_PHP; return NO_PHP;
@ -592,15 +611,15 @@ boolean Webserver::PrintLinkTable() { boolean r = sendTable; sendTable = true; r
boolean Webserver::CallPHPBoolean(char* phpRecord) boolean Webserver::CallPHPBoolean(char* phpRecord)
{ {
if(!strcmp(phpRecord, "gotPassword(")) if(StringEquals(phpRecord, "gotPassword("))
return gotPassword; return gotPassword;
if(!strcmp(phpRecord, "printLinkTable(")) if(StringEquals(phpRecord, "printLinkTable("))
return PrintLinkTable(); return PrintLinkTable();
platform->Message(HOST_MESSAGE, "callPHPBoolean(): non-existent function - "); platform->Message(HOST_MESSAGE, "callPHPBoolean(): non-existent function - ");
platform->Message(HOST_MESSAGE, phpRecord); platform->Message(HOST_MESSAGE, phpRecord);
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
return true; // Best default return true; // Best default
} }
@ -612,28 +631,30 @@ void Webserver::GetGCodeList()
void Webserver::CallPHPString(char* phpRecord) void Webserver::CallPHPString(char* phpRecord)
{ {
if(!strcmp(phpRecord, "getMyName(")) if(StringEquals(phpRecord, "getMyName("))
{ {
platform->SendToClient(myName); platform->SendToClient(myName);
return; return;
} }
if(!strcmp(phpRecord, "getGCodeList(")) if(StringEquals(phpRecord, "getGCodeList("))
{ {
GetGCodeList(); GetGCodeList();
return; return;
} }
if(!strcmp(phpRecord, "logout(")) if(StringEquals(phpRecord, "logout("))
{ {
gotPassword = false; gotPassword = false;
platform->SendToClient("<meta http-equiv=\"REFRESH\" content=\"0;url=passwd.php\"></HEAD>"); platform->SendToClient("<meta http-equiv=\"REFRESH\" content=\"0;url=");
platform->SendToClient(PASSWORD_PAGE);
platform->SendToClient("\"></HEAD>");
return; return;
} }
platform->Message(HOST_MESSAGE, "callPHPString(): non-existent function - "); platform->Message(HOST_MESSAGE, "callPHPString(): non-existent function - ");
platform->Message(HOST_MESSAGE, phpRecord); platform->Message(HOST_MESSAGE, phpRecord);
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
} }
void Webserver::ProcessPHPByte(char b) void Webserver::ProcessPHPByte(char b)
@ -657,7 +678,7 @@ void Webserver::ProcessPHPByte(char b)
phpRecord[phpRecordPointer++] = b; phpRecord[phpRecordPointer++] = b;
if(phpRecordPointer >= PHP_TAG_LENGTH) if(phpRecordPointer >= PHP_TAG_LENGTH)
{ {
platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP record buffer overflow.\n"); platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP record buffer overflow.<br>\n");
InitialisePHP(); InitialisePHP();
} }
phpRecord[phpRecordPointer] = 0; phpRecord[phpRecordPointer] = 0;
@ -714,7 +735,7 @@ void Webserver::ProcessPHPByte(char b)
{ {
platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP buffer overflow: "); platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP buffer overflow: ");
platform->Message(HOST_MESSAGE, phpTag); platform->Message(HOST_MESSAGE, phpTag);
platform->Message(HOST_MESSAGE, "\n"); platform->Message(HOST_MESSAGE, "<br>\n");
InitialisePHP(); InitialisePHP();
return; return;
} }
@ -821,7 +842,7 @@ void Webserver::ProcessPHPByte(char b)
// Should never get here... // Should never get here...
default: default:
platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP tag runout.\n"); platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP tag runout.<br>\n");
platform->SendToClient(b); platform->SendToClient(b);
InitialisePHP(); InitialisePHP();
} }
@ -848,6 +869,7 @@ Webserver::Webserver(Platform* p)
{ {
//Serial.println("Webserver constructor"); //Serial.println("Webserver constructor");
platform = p; platform = p;
active = false;
} }
void Webserver::Init() void Webserver::Init()
@ -873,11 +895,12 @@ void Webserver::Init()
sendTable = true; sendTable = true;
phpRecordPointer = 0; phpRecordPointer = 0;
InitialisePost(); InitialisePost();
active = true;
} }
void Webserver::Exit() void Webserver::Exit()
{ {
active = false;
} }