Added Exit() functions to all classes.

This commit is contained in:
reprappro 2013-03-02 18:25:44 +00:00
parent b433566c8d
commit 31399c9efa
12 changed files with 46 additions and 0 deletions

View file

@ -29,6 +29,7 @@ class GCodes
GCodes(Platform* p, Move* m, Heat* h, Webserver* w);
void Spin();
void Init();
void Exit();
private:

View file

@ -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: ");

1
Heat.h
View file

@ -39,6 +39,7 @@ class Heat
Heat(Platform* p);
void Spin();
void Init();
void Exit();
private:

View file

@ -33,6 +33,11 @@ void Heat::Init()
//inc = 0.01;
}
void Heat::Exit()
{
}
void Heat::Spin()
{
unsigned long t = platform->Time();

1
Move.h
View file

@ -28,6 +28,7 @@ class Move
Move(Platform* p);
void Init();
void Spin();
void Exit();
private:

View file

@ -35,6 +35,11 @@ void Move::Init()
platform->SetDirection(3, FORWARDS);
}
void Move::Exit()
{
}
void Move::Spin()
{
unsigned long t = platform->Time();

View file

@ -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

View file

@ -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

View file

@ -41,6 +41,8 @@ class RepRap
RepRap();
void Init();
void Spin();
void Exit();
// Platform* getPlatform();
// Move* getMove();
// Heat* getHeat();

View file

@ -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()
{

View file

@ -43,6 +43,7 @@ class Webserver
byte Read();
void Init();
void Spin();
void Exit();
private:

View file

@ -875,5 +875,10 @@ void Webserver::Init()
InitialisePost();
}
void Webserver::Exit()
{
}