From 816e626dacb107f17daf8f6ef34ba888b98d183a Mon Sep 17 00:00:00 2001 From: reprappro Date: Fri, 1 Mar 2013 23:24:35 +0000 Subject: [PATCH] Finished regularising function names. --- RepRapFirmware.ino | 2 +- SD-image/www/control.php | 89 +++++++++++++-------------------------- SD-image/www/control.php~ | 12 +++--- Webserver.h | 16 +++---- Webserver.ino | 50 +++++++++++----------- 5 files changed, 69 insertions(+), 100 deletions(-) diff --git a/RepRapFirmware.ino b/RepRapFirmware.ino index cf36732..35a9e37 100644 --- a/RepRapFirmware.ino +++ b/RepRapFirmware.ino @@ -69,7 +69,7 @@ void RepRap::Spin() move->Spin(); heat->Spin(); gcodes->Spin(); - webserver->spin(); + webserver->Spin(); } void RepRap::Interrupt() diff --git a/SD-image/www/control.php b/SD-image/www/control.php index 739bf0b..592fe79 100644 --- a/SD-image/www/control.php +++ b/SD-image/www/control.php @@ -49,39 +49,39 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -92,39 +92,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%20X10%0AG90";} - function xm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X100%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%20Y10%0AG90";} - function ym100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y100%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%20Z10%0AG90";} - function zm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z100%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";}

diff --git a/SD-image/www/control.php~ b/SD-image/www/control.php~ index 739bf0b..20e12d9 100644 --- a/SD-image/www/control.php~ +++ b/SD-image/www/control.php~ @@ -103,8 +103,8 @@ 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%20X10%0AG90";} - function xm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20X100%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";} @@ -113,8 +113,8 @@ 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%20Y10%0AG90";} - function ym100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Y100%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";} @@ -123,8 +123,8 @@ 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%20Z10%0AG90";} - function zm100mm(){ window.location.href = "control.php?gcode=G91%0AG1%20Z100%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";}

diff --git a/Webserver.h b/Webserver.h index 777b4a9..19596ae 100644 --- a/Webserver.h +++ b/Webserver.h @@ -51,7 +51,7 @@ class Webserver Webserver(Platform* p); boolean Available(); byte Read(); - void spin(); + void Spin(); private: @@ -64,16 +64,16 @@ class Webserver void CheckPassword(); boolean LoadGcodeBuffer(char* gc, boolean convertWeb); void CloseClient(); - void initialisePHP(); + void InitialisePHP(); char PHPParse(char* phpString); - boolean printHeadString(); - boolean printLinkTable(); - void getGCodeList(); - boolean callPHPBoolean(char* phpRecord); - void callPHPString(char* phpRecord); + boolean PrintHeadString(); + boolean PrintLinkTable(); + void GetGCodeList(); + boolean CallPHPBoolean(char* phpRecord); + void CallPHPString(char* phpRecord); void ProcessPHPByte(char b); void WritePHPByte(); - char* prependRoot(char* root, char* fileName); + char* PrependRoot(char* root, char* fileName); void ParseGetPost(); void CharFromClient(char c); void BlankLineFromClient(); diff --git a/Webserver.ino b/Webserver.ino index ff532cb..acb0f99 100644 --- a/Webserver.ino +++ b/Webserver.ino @@ -103,7 +103,7 @@ boolean Webserver::MatchBoundary(char c) return false; } -char* Webserver::prependRoot(char* root, char* fileName) +char* Webserver::PrependRoot(char* root, char* fileName) { strcpy(scratchString, root); return strcat(scratchString, fileName); @@ -214,7 +214,7 @@ void Webserver::CloseClient() { writing = false; inPHPFile = false; - initialisePHP(); + InitialisePHP(); clientCloseTime = platform->Time(); needToCloseClient = true; } @@ -255,17 +255,17 @@ void Webserver::SendFile(char* nameOfFileToSend) //Serial.print("File requested: "); //Serial.println(nameOfFileToSend); - fileBeingSent = platform->OpenFile(prependRoot(platform->GetWebDir(), nameOfFileToSend), false); + fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); if(fileBeingSent < 0) { sendTable = false; nameOfFileToSend = "html404.htm"; - fileBeingSent = platform->OpenFile(prependRoot(platform->GetWebDir(), nameOfFileToSend), false); + fileBeingSent = platform->OpenFile(PrependRoot(platform->GetWebDir(), nameOfFileToSend), false); } inPHPFile = StringEndsWith(nameOfFileToSend, ".php"); if(inPHPFile) - initialisePHP(); + InitialisePHP(); writing = true; } @@ -462,11 +462,11 @@ void Webserver::BlankLineFromClient() if(receivingPost) { - postFile = platform->OpenFile(prependRoot(platform->GetGcodeDir(), postFileName), true); + postFile = platform->OpenFile(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, PrependRoot(platform->GetGcodeDir(), postFileName)); platform->Message(HOST_MESSAGE, "\n"); InitialisePost(); } @@ -507,7 +507,7 @@ void Webserver::CharFromClient(char c) // Deal with input/output from/to the client (if any) one byte at a time. -void Webserver::spin() +void Webserver::Spin() { if(writing) { @@ -558,7 +558,7 @@ void Webserver::spin() // PHP interpreter -void Webserver::initialisePHP() +void Webserver::InitialisePHP() { phpTag[0] = 0; inPHPString = 0; @@ -588,15 +588,15 @@ char Webserver::PHPParse(char* phpString) } -boolean Webserver::printLinkTable() { boolean r = sendTable; sendTable = true; return r; } +boolean Webserver::PrintLinkTable() { boolean r = sendTable; sendTable = true; return r; } -boolean Webserver::callPHPBoolean(char* phpRecord) +boolean Webserver::CallPHPBoolean(char* phpRecord) { if(!strcmp(phpRecord, "gotPassword(")) return gotPassword; if(!strcmp(phpRecord, "printLinkTable(")) - return printLinkTable(); + return PrintLinkTable(); platform->Message(HOST_MESSAGE, "callPHPBoolean(): non-existent function - "); platform->Message(HOST_MESSAGE, phpRecord); @@ -605,12 +605,12 @@ boolean Webserver::callPHPBoolean(char* phpRecord) return true; // Best default } -void Webserver::getGCodeList() +void Webserver::GetGCodeList() { platform->SendToClient(platform->FileList(platform->GetGcodeDir())); } -void Webserver::callPHPString(char* phpRecord) +void Webserver::CallPHPString(char* phpRecord) { if(!strcmp(phpRecord, "getMyName(")) { @@ -620,7 +620,7 @@ void Webserver::callPHPString(char* phpRecord) if(!strcmp(phpRecord, "getGCodeList(")) { - getGCodeList(); + GetGCodeList(); return; } @@ -658,7 +658,7 @@ void Webserver::ProcessPHPByte(char b) if(phpRecordPointer >= PHP_TAG_LENGTH) { platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP record buffer overflow.\n"); - initialisePHP(); + InitialisePHP(); } phpRecord[phpRecordPointer] = 0; return; @@ -672,7 +672,7 @@ void Webserver::ProcessPHPByte(char b) platform->SendToClient(b); } else { - initialisePHP(); + InitialisePHP(); eatInput = true; eatInputChar = '>'; } @@ -681,8 +681,8 @@ void Webserver::ProcessPHPByte(char b) if(phpIfing) { - boolean ifWas = callPHPBoolean(phpRecord); - initialisePHP(); + boolean ifWas = CallPHPBoolean(phpRecord); + InitialisePHP(); ifWasTrue = ifWas; inPHPString = 5; if(b != ')') @@ -695,8 +695,8 @@ void Webserver::ProcessPHPByte(char b) if(phpPrinting) { - callPHPString(phpRecord); - initialisePHP(); + CallPHPString(phpRecord); + InitialisePHP(); eatInput = true; eatInputChar = '>'; return; @@ -715,7 +715,7 @@ void Webserver::ProcessPHPByte(char b) platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP buffer overflow: "); platform->Message(HOST_MESSAGE, phpTag); platform->Message(HOST_MESSAGE, "\n"); - initialisePHP(); + InitialisePHP(); return; } @@ -823,7 +823,7 @@ void Webserver::ProcessPHPByte(char b) default: platform->Message(HOST_MESSAGE, "ProcessPHPByte: PHP tag runout.\n"); platform->SendToClient(b); - initialisePHP(); + InitialisePHP(); } } @@ -835,7 +835,7 @@ void Webserver::WritePHPByte() else { platform->Close(fileBeingSent); - initialisePHP(); + InitialisePHP(); CloseClient(); } } @@ -855,7 +855,7 @@ Webserver::Webserver(Platform* p) getSeen = false; postLength = 0L; inPHPFile = false; - initialisePHP(); + InitialisePHP(); clientLineIsBlank = true; needToCloseClient = false; clientLinePointer = 0;