One ether bug (starting the ether after reading config.g) fixed owing to Tony's brilliant debugging persistence. It still hangs if the ether is unplugged, so that's next on the list.
This commit is contained in:
parent
a26a9f705a
commit
88a929eef4
7 changed files with 69 additions and 36 deletions
11
Platform.cpp
11
Platform.cpp
|
@ -803,11 +803,6 @@ void Platform::ReturnFileStore(FileStore* fs)
|
|||
}
|
||||
}
|
||||
|
||||
void Platform::SetMessageIndent(uint8_t i)
|
||||
{
|
||||
messageIndent = i;
|
||||
}
|
||||
|
||||
void Platform::Message(char type, char* message)
|
||||
{
|
||||
switch(type)
|
||||
|
@ -960,6 +955,10 @@ void Network::Init()
|
|||
{
|
||||
CleanRing();
|
||||
Reset();
|
||||
// if(LinkIsUp())
|
||||
// reprap.GetPlatform()->SetHeater(0,1.0);
|
||||
// else
|
||||
// reprap.GetPlatform()->SetHeater(0,0.0);
|
||||
if(!NETWORK) // NETWORK needs to be true to turn on the ethernet. It is defined in Configuration.h
|
||||
return;
|
||||
init_ethernet(reprap.GetPlatform()->IPAddress(), reprap.GetPlatform()->NetMask(), reprap.GetPlatform()->GateWay());
|
||||
|
@ -1018,6 +1017,8 @@ bool Network::Read(char& b)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Webserver calls this to write bytes that need to go out to the network
|
||||
|
||||
void Network::Write(char b)
|
||||
|
|
24
Platform.h
24
Platform.h
|
@ -267,6 +267,8 @@ public:
|
|||
void ReceiveInput(char* data, int length, void* pb, void* pc, void* h);
|
||||
void InputBufferReleased(void* pb);
|
||||
void HttpStateReleased(void* h);
|
||||
bool Active();
|
||||
bool LinkIsUp();
|
||||
|
||||
friend class Platform;
|
||||
|
||||
|
@ -441,7 +443,8 @@ class Platform
|
|||
|
||||
void Message(char type, char* message); // Send a message. Messages may simply flash an LED, or,
|
||||
// say, display the messages on an LCD. This may also transmit the messages to the host.
|
||||
void SetMessageIndent(uint8_t i);
|
||||
void PushMessageIndent();
|
||||
void PopMessageIndent();
|
||||
|
||||
// Movement
|
||||
|
||||
|
@ -996,14 +999,29 @@ inline void Line::Write(long l)
|
|||
SerialUSB.print(scratchString);
|
||||
}
|
||||
|
||||
inline void Platform::PushMessageIndent()
|
||||
{
|
||||
messageIndent += 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void Platform::PopMessageIndent()
|
||||
{
|
||||
messageIndent -= 2;
|
||||
}
|
||||
|
||||
|
||||
//***************************************************************************************
|
||||
|
||||
//queries the PHY for link status, true = link is up, false, link is down or there is some other error
|
||||
inline bool Network::LinkIsUp()
|
||||
{
|
||||
return status_link_up();
|
||||
}
|
||||
|
||||
inline bool Network::Active()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
|
@ -177,8 +177,6 @@ void RepRap::Init()
|
|||
heat->Init();
|
||||
active = true;
|
||||
|
||||
platform->StartNetwork();
|
||||
|
||||
platform->Message(HOST_MESSAGE, NAME);
|
||||
platform->Message(HOST_MESSAGE, " Version ");
|
||||
platform->Message(HOST_MESSAGE, VERSION);
|
||||
|
@ -186,16 +184,17 @@ void RepRap::Init()
|
|||
platform->Message(HOST_MESSAGE, DATE);
|
||||
platform->Message(HOST_MESSAGE, ".\n\nExecuting ");
|
||||
platform->Message(HOST_MESSAGE, platform->GetConfigFile());
|
||||
platform->Message(HOST_MESSAGE, ":\n\n");
|
||||
platform->SetMessageIndent(2);
|
||||
platform->Message(HOST_MESSAGE, "...\n\n");
|
||||
|
||||
platform->PushMessageIndent();
|
||||
gCodes->RunConfigurationGCodes();
|
||||
while(gCodes->PrintingAFile()) // Wait till the file is finished
|
||||
Spin();
|
||||
platform->PopMessageIndent();
|
||||
|
||||
// platform->StartNetwork(); // Need to do this here, as the configuration GCodes may set IP address etc.
|
||||
platform->StartNetwork(); // Need to do this here, as the configuration GCodes may set IP address etc.
|
||||
|
||||
platform->Message(HOST_MESSAGE, "\n");
|
||||
platform->SetMessageIndent(0);
|
||||
platform->Message(HOST_MESSAGE, NAME);
|
||||
platform->Message(HOST_MESSAGE, " is up and running.\n");
|
||||
}
|
||||
|
|
|
@ -625,30 +625,33 @@ void Webserver::Spin()
|
|||
|
||||
char c;
|
||||
|
||||
if(platform->GetNetwork()->Status() & clientConnected)
|
||||
if(platform->GetNetwork()->Active())
|
||||
{
|
||||
if(platform->GetNetwork()->Status() & byteAvailable)
|
||||
{
|
||||
platform->GetNetwork()->Read(c);
|
||||
//SerialUSB.print(c);
|
||||
if(platform->GetNetwork()->Status() & clientConnected)
|
||||
{
|
||||
if(platform->GetNetwork()->Status() & byteAvailable)
|
||||
{
|
||||
platform->GetNetwork()->Read(c);
|
||||
//SerialUSB.print(c);
|
||||
|
||||
if(receivingPost && postFile != NULL)
|
||||
{
|
||||
if(MatchBoundary(c))
|
||||
{
|
||||
//Serial.println("Got to end of file.");
|
||||
postFile->Close();
|
||||
SendFile(clientRequest);
|
||||
clientRequest[0] = 0;
|
||||
InitialisePost();
|
||||
}
|
||||
platform->ClassReport("Webserver", longWait);
|
||||
return;
|
||||
}
|
||||
|
||||
CharFromClient(c);
|
||||
}
|
||||
}
|
||||
if(receivingPost && postFile != NULL)
|
||||
{
|
||||
if(MatchBoundary(c))
|
||||
{
|
||||
//Serial.println("Got to end of file.");
|
||||
postFile->Close();
|
||||
SendFile(clientRequest);
|
||||
clientRequest[0] = 0;
|
||||
InitialisePost();
|
||||
}
|
||||
platform->ClassReport("Webserver", longWait);
|
||||
return;
|
||||
}
|
||||
|
||||
CharFromClient(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (platform->GetNetwork()->Status() & clientLive)
|
||||
{
|
||||
|
|
|
@ -78,6 +78,16 @@
|
|||
/* Global variable containing MAC Config (hw addr, IP, GW, ...) */
|
||||
struct netif gs_net_if;
|
||||
|
||||
//*****************************AB
|
||||
//Pass through function for interface status
|
||||
//by including ethernetif.h directly and calling ethernetif_phy_link_status(); this function is not required
|
||||
bool status_link_up()
|
||||
{
|
||||
return ethernetif_phy_link_status();
|
||||
}
|
||||
//*****************************AB
|
||||
|
||||
|
||||
struct netif* GetConfiguration()
|
||||
{
|
||||
return &gs_net_if;
|
||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
|||
/**INDENT-ON**/
|
||||
/// @endcond
|
||||
|
||||
bool status_link_up();//*****************************AB
|
||||
|
||||
/**
|
||||
* \brief Initialize the ethernet interface.
|
||||
*
|
||||
|
|
Reference in a new issue