Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2017-02-24 16:50:41 +0300
committerDavid Crocker <dcrocker@eschertech.com>2017-02-24 16:50:57 +0300
commit95bb29571661bc6782ff0f90c6be22599ece232d (patch)
tree4ef72995be336f2e07ec3e9c0456f67a58ebd15a /src
parentb226c7262f24155479556742c84d42875997f40d (diff)
1.18beta1 for Duet Ethernet
Reduced SPI speed to avoid data corruption when uploading files FTP directory listings now work on Duet Ethernet. File transfers still don't work.
Diffstat (limited to 'src')
-rw-r--r--src/DuetNG/DuetEthernet/Network.cpp7
-rw-r--r--src/DuetNG/DuetEthernet/Network.h16
-rw-r--r--src/DuetNG/DuetEthernet/Socket.cpp44
-rw-r--r--src/DuetNG/DuetEthernet/Socket.h1
-rw-r--r--src/DuetNG/DuetEthernet/Webserver.cpp4
-rw-r--r--src/DuetNG/DuetEthernet/Wiznet/Ethernet/WizSpi.cpp2
-rw-r--r--src/Movement/Move.cpp2
-rw-r--r--src/Version.h2
8 files changed, 26 insertions, 52 deletions
diff --git a/src/DuetNG/DuetEthernet/Network.cpp b/src/DuetNG/DuetEthernet/Network.cpp
index 863330d3..4bb45f3c 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 ef51dc72..7a847494 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 dcd281c4..b39b4c7e 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 c37a4e82..96154a53 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 20c8c1e2..fa11a56a 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 c11f41a5..a633046d 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 c3d74d9f..1e535845 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<floatc_t, MaxDeltaCalibrationPoints, DELTA_AXES> 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 03326bb3..bd240770 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"