diff --git a/GCodes.ino b/GCodes.ino index 8e7bf9e..2fca4a2 100644 --- a/GCodes.ino +++ b/GCodes.ino @@ -33,7 +33,7 @@ GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w) void GCodes::Init() { - lastTime = platform->time(); + lastTime = platform->Time(); gcodePointer = 0; } diff --git a/Heat.ino b/Heat.ino index 0dfc9d2..27cb934 100644 --- a/Heat.ino +++ b/Heat.ino @@ -29,14 +29,14 @@ Heat::Heat(Platform* p) void Heat::Init() { - lastTime = platform->time(); + lastTime = platform->Time(); //frac = 0; //inc = 0.01; } void Heat::Spin() { - unsigned long t = platform->time(); + unsigned long t = platform->Time(); if(t - lastTime < 3000) return; lastTime = t; diff --git a/Move.ino b/Move.ino index ea9e516..9436797 100644 --- a/Move.ino +++ b/Move.ino @@ -29,16 +29,16 @@ Move::Move(Platform* p) void Move::Init() { - lastTime = platform->time(); - platform->setDirection(X_AXIS, FORWARDS); - platform->setDirection(Y_AXIS, FORWARDS); - platform->setDirection(Z_AXIS, FORWARDS); - platform->setDirection(3, FORWARDS); + lastTime = platform->Time(); + platform->SetDirection(X_AXIS, FORWARDS); + platform->SetDirection(Y_AXIS, FORWARDS); + platform->SetDirection(Z_AXIS, FORWARDS); + platform->SetDirection(3, FORWARDS); } void Move::Spin() { - unsigned long t = platform->time(); + unsigned long t = platform->Time(); if(t - lastTime < 300) return; lastTime = t; diff --git a/Platform.h b/Platform.h index 7874e60..c519147 100644 --- a/Platform.h +++ b/Platform.h @@ -164,24 +164,24 @@ class Platform Platform(RepRap* r); - RepRap* getRepRap(); + RepRap* GetRepRap(); //------------------------------------------------------------------------------------------------------------- // These are the functions that form the interface between Platform and the rest of the firmware. - void init(); // Set the machine up after a restart. If called subsequently this should set the machine up as if + void Init(); // Set the machine up after a restart. If called subsequently this should set the machine up as if // it has just been restarted; it can do this by executing an actual restart if you like, but beware the // loop of death... - void spin(); // This gets called in the main loop and should do any housekeeping needed + void Spin(); // This gets called in the main loop and should do any housekeeping needed // Timing - unsigned long time(); // Returns elapsed microseconds since some arbitrary time + unsigned long Time(); // Returns elapsed microseconds since some arbitrary time - void setInterrupt(long t); // Set a regular interrupt going every t microseconds; if t is -ve turn interrupt off + void SetInterrupt(long t); // Set a regular interrupt going every t microseconds; if t is -ve turn interrupt off - void interrupt(); // The function that the interrupt calls + void Interrupt(); // The function that the interrupt calls // Communications and data storage; opening something unsupported returns -1. @@ -192,12 +192,12 @@ class Platform // returned value is false for EoF, true otherwise void WriteString(int file, char* s); // Write the string to a file. void Write(int file, char b); // Write the byte b to a file. - char* getWebDir(); // Where the php/htm etc files are - char* getGcodeDir(); // Where the gcodes are - char* getSystemDir(); // Where the system files are - char* getTemporaryDir(); // Where temporary files are + char* GetWebDir(); // Where the php/htm etc files are + char* GetGcodeDir(); // Where the gcodes are + char* GetSystemDir(); // Where the system files are + char* GetTemporaryDir(); // 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 + boolean DeleteFile(char* fileName); // Delete a file unsigned char ClientRead(); // Read a byte from the client void SendToClient(char* message); // Send string to the host @@ -210,15 +210,15 @@ class Platform // Movement - void setDirection(byte drive, bool direction); - void step(byte drive); - void disable(byte drive); // There is no drive enable; drives get enabled automatically the first time they are used. - void home(byte axis); + void SetDirection(byte drive, bool direction); + void Step(byte drive); + void Disable(byte drive); // There is no drive enable; drives get enabled automatically the first time they are used. + void Home(byte axis); // Heat and temperature - float getTemperature(byte heater); // Result is in degrees celsius - void setHeater(byte heater, const float& power); // power is a fraction in [0,1] + float GetTemperature(byte heater); // Result is in degrees celsius + void SetHeater(byte heater, const float& power); // power is a fraction in [0,1] //------------------------------------------------------------------------------------------------------- @@ -228,9 +228,9 @@ class Platform // Load settings from local storage - bool loadFromStore(); + bool LoadFromStore(); - int getRawTemperature(byte heater); + int GetRawTemperature(byte heater); RepRap* reprap; @@ -288,7 +288,7 @@ class Platform boolean EepromRead(unsigned char& b); }; -inline unsigned long Platform::time() +inline unsigned long Platform::Time() { return micros(); } @@ -361,12 +361,12 @@ inline void Platform::DisconnectClient() // Interrupts -inline void Platform::setInterrupt(long t) +inline void Platform::SetInterrupt(long t) { } -inline void Platform::interrupt() +inline void Platform::Interrupt() { reprap->Interrupt(); // Put nothing else in this function } @@ -375,17 +375,17 @@ inline void Platform::interrupt() // Drive the RepRap machine -inline void Platform::setDirection(byte drive, bool direction) +inline void Platform::SetDirection(byte drive, bool direction) { digitalWrite(directionPins[drive], direction); } -inline void Platform::step(byte drive) +inline void Platform::Step(byte drive) { digitalWrite(stepPins[drive], !digitalRead(stepPins[drive])); } -inline int Platform::getRawTemperature(byte heater) +inline int Platform::GetRawTemperature(byte heater) { return analogRead(tempSensePins[heater]); } diff --git a/Platform.ino b/Platform.ino index c1d2d9a..7219091 100644 --- a/Platform.ino +++ b/Platform.ino @@ -39,24 +39,24 @@ void loop() Platform::Platform(RepRap* r) { reprap = r; - init(); + Init(); } -RepRap* Platform::getRepRap() +RepRap* Platform::GetRepRap() { return reprap; } -void Platform::init() +void Platform::Init() { byte i; Serial.begin(BAUD_RATE); //Serial.println("\n\n\nPlatform constructor"); - lastTime = time(); + lastTime = Time(); - if(!loadFromStore()) + if(!LoadFromStore()) { // DRIVES @@ -169,7 +169,7 @@ void Platform::init() // Load settings from local storage; return true if successful, false otherwise -bool Platform::loadFromStore() +bool Platform::LoadFromStore() { return false; } @@ -194,9 +194,9 @@ bool Platform::loadFromStore() // Result is in degrees celsius -float Platform::getTemperature(byte heater) +float Platform::GetTemperature(byte heater) { - float r = (float)getRawTemperature(heater); + float r = (float)GetRawTemperature(heater); //Serial.println(r); return ABS_ZERO + thermistorBetas[heater]/log( (r*thermistorSeriesRs[heater]/(AD_RANGE - r))/thermistorInfRs[heater] ); } @@ -204,7 +204,7 @@ float Platform::getTemperature(byte heater) // power is a fraction in [0,1] -void Platform::setHeater(byte heater, const float& power) +void Platform::SetHeater(byte heater, const float& power) { if(power <= 0) { @@ -269,7 +269,7 @@ char* Platform::FileList(char* directory) } // Delete a file -boolean Platform::deleteFile(char* fileName) +boolean Platform::DeleteFile(char* fileName) { return SD.remove(fileName); } @@ -417,14 +417,14 @@ void Platform::SendToClient(char* message) // Where the php/htm etc files are -char* Platform::getWebDir() +char* Platform::GetWebDir() { return webDir; } // Where the gcodes are -char* Platform::getGcodeDir() +char* Platform::GetGcodeDir() { return gcodeDir; } @@ -434,12 +434,12 @@ char* Platform::getGcodeDir() -void Platform::spin() +void Platform::Spin() { ClientMonitor(); - if(time() - lastTime < 2000000) + if(Time() - lastTime < 2000000) return; - lastTime = time(); + lastTime = Time(); //Serial.print("Client status: "); //Serial.println(clientStatus); } diff --git a/RepRapFirmware.h b/RepRapFirmware.h index 350c8a6..88dc698 100644 --- a/RepRapFirmware.h +++ b/RepRapFirmware.h @@ -22,6 +22,7 @@ Licence: GPL #ifndef REPRAPFIRMWARE_H #define REPRAPFIRMWARE_H + #define NAME "RepRapFirmware" #define VERSION "0.1" #define DATE "2012-11-18" @@ -64,7 +65,7 @@ class RepRap #include "GCodes.h" #include "Webserver.h" -// Do nothing in the constructor; put what you want in RepRap:init() +// Do nothing in the constructor; put what you want in RepRap:Init() inline RepRap::RepRap() {} @@ -76,4 +77,7 @@ inline RepRap::RepRap() {} extern RepRap reprap; + #endif + + diff --git a/RepRapFirmware.ino b/RepRapFirmware.ino index 5d8ca65..cf36732 100644 --- a/RepRapFirmware.ino +++ b/RepRapFirmware.ino @@ -65,7 +65,7 @@ void RepRap::Init() void RepRap::Spin() { - platform->spin(); + platform->Spin(); move->Spin(); heat->Spin(); gcodes->Spin(); diff --git a/Webserver.ino b/Webserver.ino index 9d7e8c8..ff532cb 100644 --- a/Webserver.ino +++ b/Webserver.ino @@ -184,7 +184,7 @@ boolean Webserver::LoadGcodeBuffer(char* gc, boolean convertWeb) 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, &gcodeBuffer[4]); @@ -215,7 +215,7 @@ void Webserver::CloseClient() writing = false; inPHPFile = false; initialisePHP(); - clientCloseTime = platform->time(); + clientCloseTime = platform->Time(); needToCloseClient = true; } @@ -255,12 +255,12 @@ 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"); @@ -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(); } @@ -546,7 +546,7 @@ void Webserver::spin() { if(needToCloseClient) { - if(platform->time() - clientCloseTime < CLIENT_CLOSE_DELAY) + if(platform->Time() - clientCloseTime < CLIENT_CLOSE_DELAY) return; needToCloseClient = false; platform->DisconnectClient(); @@ -607,7 +607,7 @@ boolean Webserver::callPHPBoolean(char* phpRecord) void Webserver::getGCodeList() { - platform->SendToClient(platform->FileList(platform->getGcodeDir())); + platform->SendToClient(platform->FileList(platform->GetGcodeDir())); } void Webserver::callPHPString(char* phpRecord) @@ -848,7 +848,7 @@ Webserver::Webserver(Platform* p) { //Serial.println("Webserver constructor"); platform = p; - lastTime = platform->time(); + lastTime = platform->Time(); writing = false; receivingPost = false; postSeen = false;