Messages webpage added with session log.
This commit is contained in:
parent
31399c9efa
commit
b207f31dc7
22 changed files with 387 additions and 134 deletions
|
@ -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
|
||||
|
|
1
GCodes.h
1
GCodes.h
|
@ -36,6 +36,7 @@ class GCodes
|
|||
void ActOnGcode();
|
||||
|
||||
Platform* platform;
|
||||
boolean active;
|
||||
Move* move;
|
||||
Heat* heat;
|
||||
Webserver* webserver;
|
||||
|
|
11
GCodes.ino
11
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, "<br>\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GCodes::Spin()
|
||||
{
|
||||
if(!active)
|
||||
return;
|
||||
|
||||
if(webserver->Available())
|
||||
{
|
||||
gcodeBuffer[gcodePointer] = webserver->Read();
|
||||
|
|
1
Heat.h
1
Heat.h
|
@ -44,6 +44,7 @@ class Heat
|
|||
private:
|
||||
|
||||
Platform* platform;
|
||||
boolean active;
|
||||
unsigned long lastTime;
|
||||
//float frac;
|
||||
//float inc;
|
||||
|
|
9
Heat.ino
9
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;
|
||||
|
|
2
Move.h
2
Move.h
|
@ -34,7 +34,7 @@ class Move
|
|||
|
||||
Platform* platform;
|
||||
unsigned long lastTime;
|
||||
|
||||
boolean active;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
9
Move.ino
9
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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
71
Platform.ino
71
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!<br>\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.<br>\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.<br>\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.<br>\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.<br>\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.<br>\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.<br>\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.<br>\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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<br>\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();
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
|
@ -86,7 +88,7 @@
|
|||
|
||||
</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">
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
|
@ -49,39 +51,39 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button type="button" onclick="return homex()">Home X</button></td>
|
||||
<td><button type="button" onclick="return xm100mm()"><--- X</button></td>
|
||||
<td><button type="button" onclick="return xm10mm()"><-- X</button></td>
|
||||
<td><button type="button" onclick="return xm1mm()"><- X</button></td>
|
||||
<td><button type="button" onclick="return xm01mm()">< X</button></td>
|
||||
<td><button type="button" onclick="return xp01mm()">X ></button></td>
|
||||
<td><button type="button" onclick="return xp1mm()">X --></button></td>
|
||||
<td><button type="button" onclick="return xp10mm()">X --></button></td>
|
||||
<td><button type="button" onclick="return xp100mm()">X ---></button></td>
|
||||
<td><button type="button" onclick="return home('X')">Home X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -100)"><--- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -10)"><-- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -1)"><- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -0.1)">< X</button></td>
|
||||
<td><button type="button" onclick="return move('X', 0.1)">X ></button></td>
|
||||
<td><button type="button" onclick="return move('X', 1)">X --></button></td>
|
||||
<td><button type="button" onclick="return move('X', 10)">X --></button></td>
|
||||
<td><button type="button" onclick="return move('X', 100)">X ---></button></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button type="button" onclick="return homey()">Home Y</button></td>
|
||||
<td><button type="button" onclick="return ym100mm()"><--- Y</button></td>
|
||||
<td><button type="button" onclick="return ym10mm()"><-- Y</button></td>
|
||||
<td><button type="button" onclick="return ym1mm()"><- Y</button></td>
|
||||
<td><button type="button" onclick="return ym01mm()">< Y</button></td>
|
||||
<td><button type="button" onclick="return yp01mm()">Y ></button></td>
|
||||
<td><button type="button" onclick="return yp1mm()">Y -></button></td>
|
||||
<td><button type="button" onclick="return yp10mm()">Y --></button></td>
|
||||
<td><button type="button" onclick="return yp100mm()">Y ---></button></td>
|
||||
<td><button type="button" onclick="return home('Y')">Home Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -100)"><--- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -10)"><-- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -1)"><- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -0.1)">< Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', 0.1)">Y ></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 1)">Y -></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 10)">Y --></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 100)">Y ---></button></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><button type="button" onclick="return homez()">Home Z</button></td>
|
||||
<td><button type="button" onclick="return zm100mm()"><--- Z</button></td>
|
||||
<td><button type="button" onclick="return zm10mm()"><-- Z</button></td>
|
||||
<td><button type="button" onclick="return zm1mm()"><- Z</button></td>
|
||||
<td><button type="button" onclick="return zm01mm()">< Z</button></td>
|
||||
<td><button type="button" onclick="return zp01mm()">Z ></button></td>
|
||||
<td><button type="button" onclick="return zp1mm()">Z -></button></td>
|
||||
<td><button type="button" onclick="return zp10mm()">Z --></button></td>
|
||||
<td><button type="button" onclick="return zp100mm()">Z ---></button></td>
|
||||
<td><button type="button" onclick="return home('Z')">Home Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -100)"><--- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -10)"><-- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -1)"><- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -0.1)">< Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', 0.1)">Z ></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 1)">Z -></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 10)">Z --></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 100)">Z ---></button></td>
|
||||
</tr>
|
||||
|
||||
</div></table>
|
||||
|
@ -92,39 +94,8 @@
|
|||
|
||||
|
||||
function homea(){ window.location.href = "control.php?gcode=G28";}
|
||||
function homex(){ window.location.href = "control.php?gcode=G28%20X0";}
|
||||
function homey(){ window.location.href = "control.php?gcode=G28%20Y0";}
|
||||
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";}
|
||||
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>
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
|
|
|
@ -29,12 +29,62 @@
|
|||
|
||||
|
||||
<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> <button type=\"button\" onclick=\"return deleteFile('";
|
||||
result += "gcodes/" + fileName; // Need PHP in here
|
||||
result += "')\">";
|
||||
result += fileName;
|
||||
result += "</button> </td>";
|
||||
k++;
|
||||
if(k >= count)
|
||||
break;
|
||||
}
|
||||
result += "</tr>";
|
||||
if(k >= count)
|
||||
break;
|
||||
}
|
||||
result += "</table>";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
document.write(printGCodeTable());
|
||||
</script>
|
||||
<br><br>
|
||||
|
||||
<?php print(deleteGCodeTable()); ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
|
99
SD-image/www/message.txt~
Normal file
99
SD-image/www/message.txt~
Normal 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 ' <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> <a href="control.php">Control</a> </td>
|
||||
|
||||
<td> <a href="print.php">Print</a> </td>
|
||||
|
||||
<td> <a href="http://reprap.org/wiki/RepRapPro_RepRap_Firmware" target="_blank">Help</a> </td>
|
||||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </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)"><--- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -10)"><-- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -1)"><- X</button></td>
|
||||
<td><button type="button" onclick="return move('X', -0.1)">< X</button></td>
|
||||
<td><button type="button" onclick="return move('X', 0.1)">X ></button></td>
|
||||
<td><button type="button" onclick="return move('X', 1)">X --></button></td>
|
||||
<td><button type="button" onclick="return move('X', 10)">X --></button></td>
|
||||
<td><button type="button" onclick="return move('X', 100)">X ---></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)"><--- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -10)"><-- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -1)"><- Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', -0.1)">< Y</button></td>
|
||||
<td><button type="button" onclick="return move('Y', 0.1)">Y ></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 1)">Y -></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 10)">Y --></button></td>
|
||||
<td><button type="button" onclick="return move('Y', 100)">Y ---></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)"><--- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -10)"><-- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -1)"><- Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', -0.1)">< Z</button></td>
|
||||
<td><button type="button" onclick="return move('Z', 0.1)">Z ></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 1)">Z -></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 10)">Z --></button></td>
|
||||
<td><button type="button" onclick="return move('Z', 100)">Z ---></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
30
SD-image/www/messages.txt
Normal 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 ' <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> <a href="control.php">Control</a> </td>
|
||||
|
||||
<td> <a href="print.php">Print</a> </td>
|
||||
|
||||
<td> <a href="http://reprap.org/wiki/RepRapPro_RepRap_Firmware" target="_blank">Help</a> </td>
|
||||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
</tr></table>
|
||||
<br><br>'; ?>
|
||||
|
||||
<H3>Messages:</H3><br><br>
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
|
|
|
@ -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 <?php print(getMyName()); ?>." +
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
<td> <a href="settings.php">Settings</a> </td>
|
||||
|
||||
<td> <a href="messages.php">Messages</a> </td>
|
||||
|
||||
<td> <a href="logout.php">Logout</a> </td>
|
||||
|
||||
</tr></table>
|
||||
|
|
|
@ -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];
|
||||
|
|
109
Webserver.ino
109
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.<br>\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, "<br>\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, "<br>\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.<br>\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.<br>\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.<br>\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!<br>\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, "<br>\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.<br>\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, "<br>\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("<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;
|
||||
}
|
||||
|
||||
platform->Message(HOST_MESSAGE, "callPHPString(): non-existent function - ");
|
||||
platform->Message(HOST_MESSAGE, phpRecord);
|
||||
platform->Message(HOST_MESSAGE, "\n");
|
||||
platform->Message(HOST_MESSAGE, "<br>\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.<br>\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, "<br>\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.<br>\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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue