diff --git a/GCodes.h b/GCodes.h index b3f0b49..90f2698 100644 --- a/GCodes.h +++ b/GCodes.h @@ -29,6 +29,7 @@ class GCodes GCodes(Platform* p, Move* m, Heat* h, Webserver* w); void Spin(); void Init(); + void Exit(); private: diff --git a/GCodes.ino b/GCodes.ino index 2297336..9198527 100644 --- a/GCodes.ino +++ b/GCodes.ino @@ -30,12 +30,19 @@ GCodes::GCodes(Platform* p, Move* m, Heat* h, Webserver* w) webserver = w; } +void GCodes::Exit() +{ + +} + void GCodes::Init() { lastTime = platform->Time(); gcodePointer = 0; } + + void GCodes::ActOnGcode() { platform->Message(HOST_MESSAGE, "\nGCode: "); diff --git a/Heat.h b/Heat.h index 9fe90e4..2957703 100644 --- a/Heat.h +++ b/Heat.h @@ -39,6 +39,7 @@ class Heat Heat(Platform* p); void Spin(); void Init(); + void Exit(); private: diff --git a/Heat.ino b/Heat.ino index de2a264..2b52eac 100644 --- a/Heat.ino +++ b/Heat.ino @@ -33,6 +33,11 @@ void Heat::Init() //inc = 0.01; } +void Heat::Exit() +{ + +} + void Heat::Spin() { unsigned long t = platform->Time(); diff --git a/Move.h b/Move.h index 8a5db54..67910b2 100644 --- a/Move.h +++ b/Move.h @@ -28,6 +28,7 @@ class Move Move(Platform* p); void Init(); void Spin(); + void Exit(); private: diff --git a/Move.ino b/Move.ino index 033442b..52e52b6 100644 --- a/Move.ino +++ b/Move.ino @@ -35,6 +35,11 @@ void Move::Init() platform->SetDirection(3, FORWARDS); } +void Move::Exit() +{ + +} + void Move::Spin() { unsigned long t = platform->Time(); diff --git a/Platform.h b/Platform.h index 1586e7e..ec57a20 100644 --- a/Platform.h +++ b/Platform.h @@ -174,6 +174,8 @@ class Platform // loop of death... void Spin(); // This gets called in the main loop and should do any housekeeping needed + void Exit(); // Shut down tidily. Calling Init after calling this should reset to the beginning + // Timing unsigned long Time(); // Returns elapsed microseconds since some arbitrary time diff --git a/Platform.ino b/Platform.ino index d254940..2f3225b 100644 --- a/Platform.ino +++ b/Platform.ino @@ -166,6 +166,11 @@ void Platform::Init() // SD.begin() returns with the SPI disabled, so you need not disable it here } +void Platform::Exit() +{ + +} + // Load settings from local storage; return true if successful, false otherwise diff --git a/RepRapFirmware.h b/RepRapFirmware.h index 5584a51..b98b5eb 100644 --- a/RepRapFirmware.h +++ b/RepRapFirmware.h @@ -41,6 +41,8 @@ class RepRap RepRap(); void Init(); void Spin(); + void Exit(); + // Platform* getPlatform(); // Move* getMove(); // Heat* getHeat(); diff --git a/RepRapFirmware.ino b/RepRapFirmware.ino index e9e5f3c..2fa66b3 100644 --- a/RepRapFirmware.ino +++ b/RepRapFirmware.ino @@ -63,6 +63,15 @@ void RepRap::Init() platform->Message(HOST_MESSAGE, "RepRapPro RepRap Firmware (Re)Started\n\n"); } +void RepRap::Exit() +{ + webserver->Exit(); + gcodes->Exit(); + heat->Exit(); + move->Exit(); + platform->Exit(); +} + void RepRap::Spin() { platform->Spin(); @@ -72,6 +81,8 @@ void RepRap::Spin() webserver->Spin(); } + + void RepRap::Interrupt() { diff --git a/Webserver.h b/Webserver.h index cfd696e..31aff4f 100644 --- a/Webserver.h +++ b/Webserver.h @@ -43,6 +43,7 @@ class Webserver byte Read(); void Init(); void Spin(); + void Exit(); private: diff --git a/Webserver.ino b/Webserver.ino index eabcca2..d88c956 100644 --- a/Webserver.ino +++ b/Webserver.ino @@ -875,5 +875,10 @@ void Webserver::Init() InitialisePost(); } +void Webserver::Exit() +{ + +} +