Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v2.7.1 to auto-detect and set MAX_SIZE
Browse files Browse the repository at this point in the history
### Releases v2.7.1

1. Auto-detect `W5x00` and settings (`ETHERNET_LARGE_BUFFERS`, `MAX_SOCK_NUM`) to set `MAX_SIZE` to send. Check ['ETHERNET_SERVER_SEND_MAX_SIZE' was not declared in this scope #16](#16)
  • Loading branch information
khoih-prog authored Nov 15, 2022
1 parent a2750ed commit 198b027
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 101 deletions.
115 changes: 64 additions & 51 deletions README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


* [Changelog](#changelog)
* [Releases v2.7.1](#releases-v271)
* [Releases v2.7.0](#releases-v270)
* [Releases v2.6.2](#releases-v262)
* [Releases v2.6.1](#releases-v261)
Expand All @@ -38,6 +39,11 @@

## Changelog

### Releases v2.7.1

1. Auto-detect `W5x00` and settings (`ETHERNET_LARGE_BUFFERS`, `MAX_SOCK_NUM`) to set `MAX_SIZE` to send. Check ['ETHERNET_SERVER_SEND_MAX_SIZE' was not declared in this scope #16](https://github.com/khoih-prog/Ethernet_Generic/issues/16)


### Releases v2.7.0

1. Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Ethernet_Generic",
"version": "2.7.0",
"version": "2.7.1",
"keywords": "WebServer, Ethernet, SPI2, Teensy, SAMD, STM32, SAM DUE, nRF52, ESP32, ESP8266, rpi-pico, rp2040, W5x00, W5500, LAN, Wiznet, WIZ550io, WIZ850io, USR-ES1",
"description": "Simple Ethernet library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, W5100S. With this library, you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS. The h-only library now supporting SPI1/SPI2, EthernetLarge, Ethernet2 and Ethernet3 features by simply changing definitions in the sketch. RASPBERRY_PI_PICO using arduino-pico core now can use SPI1. Now STM32, Arduino_mbed boards can use any custom hardware / software SPI and with fix of severe limitation to permit sending much larger data than total 2/4/8/16K buffer",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Ethernet_Generic
version=2.7.0
version=2.7.1
author=Various (see AUTHORS file for details)
maintainer=Khoi Hoang <[email protected]>
sentence=Simple Ethernet library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, W5100S
Expand Down
3 changes: 2 additions & 1 deletion src/Dhcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

// DHCP Library v0.3 - April 25, 2009
Expand Down
3 changes: 2 additions & 1 deletion src/Dhcp_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

// DHCP Library v0.3 - April 25, 2009
Expand Down
3 changes: 2 additions & 1 deletion src/Dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

// Arduino DNS client for WizNet5100-based Ethernet shield
Expand Down
3 changes: 2 additions & 1 deletion src/Dns_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/
// Arduino DNS client for WizNet5100-based Ethernet shield
// (c) Copyright 2009-2010 MCQN Ltd.
Expand Down
3 changes: 2 additions & 1 deletion src/EthernetClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/
// This file is in the public domain. No copyright is claimed.

Expand Down
21 changes: 6 additions & 15 deletions src/EthernetClient_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -172,19 +173,6 @@ size_t EthernetClient::write(uint8_t b)

#define ETHERNET_CLIENT_MAX_WRITE_RETRY 100

// Don't use larger size or hang, max is 16K for 1 socket
#ifdef ETHERNET_LARGE_BUFFERS
#if MAX_SOCK_NUM <= 1
#define ETHERNET_CLIENT_SEND_MAX_SIZE 16384
#elif MAX_SOCK_NUM <= 2
#define ETHERNET_CLIENT_SEND_MAX_SIZE 8192
#elif MAX_SOCK_NUM <= 4
#define ETHERNET_CLIENT_SEND_MAX_SIZE 4096
#else
#define ETHERNET_CLIENT_SEND_MAX_SIZE 2048
#endif
#endif

////////////////////////////////////////

size_t EthernetClient::write(const uint8_t *buf, size_t size)
Expand All @@ -195,7 +183,10 @@ size_t EthernetClient::write(const uint8_t *buf, size_t size)
size_t totalBytesSent = 0;
size_t bytesRemaining = size;

ETG_LOGINFO1("EthernetClient::write: To write, size = ", size);
uint16_t ETHERNET_CLIENT_SEND_MAX_SIZE = W5100.SSIZE;

ETG_LOGINFO1("EthernetClient::write: chip = ", W5100.getChip());
ETG_LOGINFO3("EthernetClient::write: size = ", size, ", MAX_SIZE =", ETHERNET_CLIENT_SEND_MAX_SIZE);

if (_sockindex >= MAX_SOCK_NUM)
return 0;
Expand Down
3 changes: 2 additions & 1 deletion src/EthernetServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

// This file is in the public domain. No copyright is claimed.
Expand Down
21 changes: 6 additions & 15 deletions src/EthernetServer_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -324,19 +325,6 @@ size_t EthernetServer::write(uint8_t b)

#define ETHERNET_SERVER_MAX_WRITE_RETRY 100

// Don't use larger size or hang, max is 16K for 1 socket
#ifdef ETHERNET_LARGE_BUFFERS
#if MAX_SOCK_NUM <= 1
#define ETHERNET_SERVER_SEND_MAX_SIZE 16384
#elif MAX_SOCK_NUM <= 2
#define ETHERNET_SERVER_SEND_MAX_SIZE 8192
#elif MAX_SOCK_NUM <= 4
#define ETHERNET_SERVER_SEND_MAX_SIZE 4096
#else
#define ETHERNET_SERVER_SEND_MAX_SIZE 2048
#endif
#endif

////////////////////////////////////////

// Private function
Expand All @@ -345,10 +333,13 @@ size_t EthernetServer::_write(const uint8_t sockindex, const uint8_t *buf, size_
int written = 0;
int retry = ETHERNET_SERVER_MAX_WRITE_RETRY;

uint16_t ETHERNET_SERVER_SEND_MAX_SIZE = W5100.SSIZE;

size_t totalBytesSent = 0;
size_t bytesRemaining = size;

ETG_LOGINFO1("EthernetServer::write: To write, size = ", size);
ETG_LOGINFO1("EthernetServer::write: chip = ", W5100.getChip());
ETG_LOGINFO3("EthernetServer::write: size = ", size, ", MAX_SIZE =", ETHERNET_SERVER_SEND_MAX_SIZE);

if (size == 0)
{
Expand Down
3 changes: 2 additions & 1 deletion src/EthernetUdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/
/*
Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield.
Expand Down
3 changes: 2 additions & 1 deletion src/EthernetUdp_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/
/*
Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield.
Expand Down
9 changes: 5 additions & 4 deletions src/Ethernet_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand All @@ -61,13 +62,13 @@

////////////////////////////////////////

#define ETHERNET_GENERIC_VERSION "Ethernet_Generic v2.7.0"
#define ETHERNET_GENERIC_VERSION "Ethernet_Generic v2.7.1"

#define ETHERNET_GENERIC_VERSION_MAJOR 2
#define ETHERNET_GENERIC_VERSION_MINOR 7
#define ETHERNET_GENERIC_VERSION_PATCH 0
#define ETHERNET_GENERIC_VERSION_PATCH 1

#define ETHERNET_GENERIC_VERSION_INT 2007000
#define ETHERNET_GENERIC_VERSION_INT 2007001

////////////////////////////////////////

Expand Down
3 changes: 2 additions & 1 deletion src/Ethernet_Generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Ethernet_Generic_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Ethernet_Generic_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/socket_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -51,6 +51,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/utility/w5100.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
Version: 2.7.0
Version: 2.7.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -32,6 +32,7 @@
2.6.1 K Hoang 23/09/2022 Fix bug for W5200
2.6.2 K Hoang 26/10/2022 Add support to Seeed XIAO_NRF52840 and XIAO_NRF52840_SENSE using `mbed` or `nRF52` core
2.7.0 K Hoang 14/11/2022 Fix severe limitation to permit sending larger data than 2/4/8/16K buffer
2.7.1 K Hoang 15/11/2022 Auto-detect W5x00 and settings to set MAX_SIZE to send
*****************************************************************************************************************************/

// w5100.h contains private W5x00 hardware "driver" level definitions
Expand Down
Loading

0 comments on commit 198b027

Please sign in to comment.