diff --git a/Release/Duet-0.6-0.8.5/Edge/iap.bin b/Release/Duet-0.6-0.8.5/Edge/iap.bin new file mode 100644 index 0000000..0ccbce6 Binary files /dev/null and b/Release/Duet-0.6-0.8.5/Edge/iap.bin differ diff --git a/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.18beta1.bin b/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.18beta1.bin new file mode 100644 index 0000000..8ab9236 Binary files /dev/null and b/Release/Duet-Ethernet/Edge/DuetEthernetFirmware-1.18beta1.bin differ diff --git a/Release/Duet-Ethernet/Edge/iap4e.bin b/Release/Duet-Ethernet/Edge/iap4e.bin new file mode 100644 index 0000000..9e82953 Binary files /dev/null and b/Release/Duet-Ethernet/Edge/iap4e.bin differ diff --git a/Release/Duet-WiFi/Edge/iap4e.bin b/Release/Duet-WiFi/Edge/iap4e.bin new file mode 100644 index 0000000..9e82953 Binary files /dev/null and b/Release/Duet-WiFi/Edge/iap4e.bin differ diff --git a/src/DuetNG/DuetEthernet/Network.cpp b/src/DuetNG/DuetEthernet/Network.cpp index 863330d..4bb45f3 100644 --- a/src/DuetNG/DuetEthernet/Network.cpp +++ b/src/DuetNG/DuetEthernet/Network.cpp @@ -8,6 +8,7 @@ #include "Network.h" #include "NetworkTransaction.h" #include "Platform.h" +#include "RepRap.h" #include "wizchip_conf.h" #include "Wiznet/Internet/DHCP/dhcp.h" @@ -356,6 +357,10 @@ bool Network::AcquireTransaction(size_t socketNumber) { currentTransactionSocketNumber = socketNumber; } + else if (reprap.Debug(moduleNetwork)) + { + debugPrintf("Failed to acquire transaction for socket %u\n", socketNumber); + } return success; } @@ -381,7 +386,7 @@ void Network::TerminateSockets() void Network::Defer(NetworkTransaction *tr) { - const Socket *skt = tr->GetConnection(); + const Socket * const skt = tr->GetConnection(); if (skt != nullptr && skt->GetNumber() == currentTransactionSocketNumber) { ++currentTransactionSocketNumber; diff --git a/src/DuetNG/DuetEthernet/Network.h b/src/DuetNG/DuetEthernet/Network.h index ef51dc7..7a84749 100644 --- a/src/DuetNG/DuetEthernet/Network.h +++ b/src/DuetNG/DuetEthernet/Network.h @@ -81,18 +81,20 @@ public: private: enum class NetworkState { - disabled, // WiFi not active - enabled, // WiFi enabled but not started yet - establishingLink, // starting up (waiting for initialisation) - obtainingIP, - active + disabled, // Network disabled + enabled, // Network enabled but not started yet + establishingLink, // starting up, waiting for link + obtainingIP, // link established, waiting for DHCP + active // network running }; void InitSockets(); void TerminateSockets(); - bool AcquireTransaction(size_t socketNumber); - Platform *platform; + bool AcquireTransaction(size_t socketNumber) + pre(socketNumber < NumTcpSockets); + + Platform * const platform; float longWait; uint32_t lastTickMillis; diff --git a/src/DuetNG/DuetEthernet/Socket.cpp b/src/DuetNG/DuetEthernet/Socket.cpp index dcd281c..b39b4c7 100644 --- a/src/DuetNG/DuetEthernet/Socket.cpp +++ b/src/DuetNG/DuetEthernet/Socket.cpp @@ -17,8 +17,6 @@ //*************************************************************************************************** // Socket class -#define IMMEDIATE_ACQUIRE 1 - Socket::Socket() : currentTransaction(nullptr), receivedData(nullptr), state(SocketState::inactive) { } @@ -43,7 +41,6 @@ void Socket::ReInit() persistConnection = true; isTerminated = false; isSending = false; - needTransaction = false; state = SocketState::inactive; // Re-initialise the socket on the W5500 @@ -187,8 +184,7 @@ void Socket::Poll(bool full) if (state == SocketState::listening) // if it is a new connection { - needTransaction = false; - if (socketNum == FtpSocketNumber || socketNum == TelnetSocketNumber) + if (socketNum == FtpSocketNumber || socketNum == FtpDataSocketNumber || socketNum == TelnetSocketNumber) { // FTP and Telnet protocols need a connection reply, so tell the Webserver module about the new connection if (currentTransaction == nullptr) @@ -229,7 +225,6 @@ void Socket::Poll(bool full) } } -#ifdef IMMEDIATE_ACQUIRE if (currentTransaction == nullptr && receivedData != nullptr) { currentTransaction = NetworkTransaction::Allocate(); @@ -238,17 +233,6 @@ void Socket::Poll(bool full) currentTransaction->Set(this, TransactionStatus::receiving); } } -#else - if (currentTransaction == nullptr && (receivedData != nullptr || needTransaction)) - { - currentTransaction = NetworkTransaction::Allocate(); - if (currentTransaction != nullptr) - { - currentTransaction->Set(this, (needTransaction) ? TransactionStatus::acquired : TransactionStatus::receiving); - needTransaction = false; - } - } -#endif // See if we can send any data. // Currently we don't send if we are being called from hsmci because we don't want to risk releasing a buffer that we may be reading data into. @@ -298,27 +282,16 @@ void Socket::Poll(bool full) break; case SOCK_CLOSED: -#ifdef _HTTPSERVER_DEBUG_ - printf("> HTTPSocket[%d] : CLOSED\r\n", s); -#endif - reprap.GetWebserver()->ConnectionLost(this); // the webserver needs this to be called for both graceful and disgraceful disconnects - state = SocketState::inactive; - - if (socket(socketNum, Sn_MR_TCP, localPort, 0x00) == socketNum) // Reinitialize the socket + if (full) // don't make a call to webserver if we might be in it already { -#ifdef _HTTPSERVER_DEBUG_ - printf("> HTTPSocket[%d] : OPEN\r\n", socketNum); -#endif + reprap.GetWebserver()->ConnectionLost(this); // the webserver needs this to be called for both graceful and disgraceful disconnects + ReInit(); } break; default: break; - } // end of switch - -#ifdef _USE_WATCHDOG_ - HTTPServer_WDT_Reset(); -#endif + } } // Try to send data, returning true if all data has been sent and we ought to close the socket @@ -333,7 +306,7 @@ bool Socket::TrySendData() setSn_IR(socketNum, Sn_IR_SENDOK); // if yes isSending = false; } - else if(tmp & Sn_IR_TIMEOUT) // did it time out? + else if (tmp & Sn_IR_TIMEOUT) // did it time out? { isSending = false; disconnectNoWait(socketNum); // if so, close the socket @@ -406,17 +379,12 @@ bool Socket::AcquireTransaction() if (getSn_SR(socketNum) == SOCK_ESTABLISHED) { -#ifdef IMMEDIATE_ACQUIRE currentTransaction = NetworkTransaction::Allocate(); if (currentTransaction != nullptr) { currentTransaction->Set(this, TransactionStatus::acquired); return true; } -#else - needTransaction = true; - return true; -#endif } return false; } diff --git a/src/DuetNG/DuetEthernet/Socket.h b/src/DuetNG/DuetEthernet/Socket.h index c37a4e8..96154a5 100644 --- a/src/DuetNG/DuetEthernet/Socket.h +++ b/src/DuetNG/DuetEthernet/Socket.h @@ -61,7 +61,6 @@ private: SocketNumber socketNum; // The W5500 socket number we are using SocketState state; bool isSending; // True if we have written data to the W5500 to send and have not yet seen success or timeout - bool needTransaction; // True if the web server has asked for a transaction }; #endif /* SRC_DUETNG_DUETETHERNET_SOCKET_H_ */ diff --git a/src/DuetNG/DuetEthernet/Webserver.cpp b/src/DuetNG/DuetEthernet/Webserver.cpp index 20c8c1e..fa11a56 100644 --- a/src/DuetNG/DuetEthernet/Webserver.cpp +++ b/src/DuetNG/DuetEthernet/Webserver.cpp @@ -1955,7 +1955,7 @@ void Webserver::FtpInterpreter::ConnectionEstablished() } // Is this a new connection on the data port? - NetworkTransaction *transaction = webserver->currentTransaction; + NetworkTransaction * const transaction = webserver->currentTransaction; if (transaction->GetLocalPort() != FTP_PORT) { if (state == waitingForPasvPort) @@ -2343,7 +2343,7 @@ void Webserver::FtpInterpreter::ProcessLine() SendReply(150, "Here comes the directory listing."); // send directory listing via data port - NetworkTransaction *dataTransaction = network->GetTransaction(); + NetworkTransaction * const dataTransaction = network->GetTransaction(); FileInfo fileInfo; if (platform->GetMassStorage()->FindFirst(currentDir, fileInfo)) diff --git a/src/DuetNG/DuetEthernet/Wiznet/Ethernet/WizSpi.cpp b/src/DuetNG/DuetEthernet/Wiznet/Ethernet/WizSpi.cpp index c11f41a..a633046 100644 --- a/src/DuetNG/DuetEthernet/Wiznet/Ethernet/WizSpi.cpp +++ b/src/DuetNG/DuetEthernet/Wiznet/Ethernet/WizSpi.cpp @@ -25,7 +25,7 @@ #include "matrix.h" // Functions called by the W5500 module to transfer data to/from the W5500 via SPI -const uint32_t SpiClockFrequency = 60000000; +const uint32_t SpiClockFrequency = 40000000; // tried 60MHz and we got some data corruption when uploading files, so try 40MHz instead const unsigned int SpiPeripheralChannelId = 0; // we use NPCS0 as the slave select signal #if USE_PDC diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index c3d74d9..1e53584 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -1063,7 +1063,7 @@ void Move::DoDeltaCalibration(size_t numFactors, StringRef& reply) // Transform the probing points to motor endpoints and store them in a matrix, so that we can do multiple iterations using the same data FixedMatrix probeMotorPositions; floatc_t corrections[MaxDeltaCalibrationPoints]; - float_t initialSumOfSquares = 0.0; + float initialSumOfSquares = 0.0; for (size_t i = 0; i < numPoints; ++i) { corrections[i] = 0.0; diff --git a/src/Version.h b/src/Version.h index 03326bb..bd24077 100644 --- a/src/Version.h +++ b/src/Version.h @@ -13,7 +13,7 @@ #endif #ifndef DATE -# define DATE "2017-02-21" +# define DATE "2017-02-24" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman"