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

Commit

Permalink
v1.8.14-6 to fix bug and add support to Teensy 4.x
Browse files Browse the repository at this point in the history
### Releases v1.8.14-6

1. Add support to `Teensy 4.x` using `Adafruit Airlift Featherwing Co-Processor`
2. Fix `WiFiStorageFile.flush()` linker error in some platform. Check [Flush method not implemented #22](#22)
3. Update `Packages' Patches`
  • Loading branch information
khoih-prog authored Aug 18, 2022
1 parent 122a121 commit 2f98435
Show file tree
Hide file tree
Showing 33 changed files with 181 additions and 87 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Arduino IDE version: 1.8.19
Arduino-mbed RP2040 v3.1.1
NANO_RP2040_CONNECT Module
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered an endless loop while trying to connect to Local WiFi.
Expand Down
81 changes: 41 additions & 40 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.8.14-6](#releases-v1814-6)
* [Releases v1.8.14-5](#releases-v1814-5)
* [Releases v1.8.14-4](#releases-v1814-4)
* [Releases v1.8.14-3](#releases-v1814-3)
* [Releases v1.8.14-2](#releases-v1814-2)
Expand Down Expand Up @@ -40,6 +42,12 @@

## Changelog

### Releases v1.8.14-6

1. Add support to `Teensy 4.x` using `Adafruit Airlift Featherwing Co-Processor`
2. Fix `WiFiStorageFile.flush()` linker error in some platform. Check [Flush method not implemented #22](https://github.com/khoih-prog/WiFiNINA_Generic/issues/22)
3. Update `Packages' Patches`

### Releases v1.8.14-5

1. Fix bug causing data lost when sending large files. Check [Thread: Teensy 4.1 - Adafruit Airlift Featherwing Co-Processor FTP Server not opening Port 21](https://forum.pjrc.com/threads/70062-Teensy-4-1-Adafruit-Airlift-Featherwing-Co-Processor-FTP-Server-not-opening-Port-21?p=306507&viewfull=1#post306507). This is just a kludge for temporary use, waiting for better and final fix, dealing with SPI driver, from Arduino.
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": "WiFiNINA_Generic",
"version": "1.8.14-5",
"version": "1.8.14-6",
"keywords": "wifi, wi-fi, WiFiNINA, NINA-B302-ublox, W101, W102, shield, Teensy, SAM DUE, SAMD, STM32, nRF52, rpi-pico, rp2040, Credentials, Manager, nano-rp2040-connect, raspberry-pi-pico, mega, 32u4",
"description": "Enables network connection (local and Internet) and WiFiStorage for SAM DUE, SAMD21, SAMD51, Teensy, AVR (328P, 32u4, 16u4, etc.), Mega, STM32F/L/H/G/WB/MP1, nRF52, NINA_B302_ublox, NINA_B112_ublox, RP2040-based boards, etc. in addition to Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000, Arduino UNO WiFi Rev.2, Nano 33 IoT, Nano RP2040 Connect",
"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=WiFiNINA_Generic
version=1.8.14-5
version=1.8.14-6
author=Arduino, Khoi Hoang <[email protected]>
maintainer=Khoi Hoang <[email protected]>
sentence=Enables network connection (local and Internet) and WiFiStorage for SAM DUE, SAMD21, SAMD51, Teensy, AVR (328P, 32u4, 16u4, etc.), Mega, STM32F/L/H/G/WB/MP1, nRF52, NINA_B302_ublox, NINA_B112_ublox, RP2040-based boards, etc. in addition to Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000, Arduino UNO WiFi Rev.2, Nano 33 IoT, Nano RP2040 Connect
Expand Down
4 changes: 2 additions & 2 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ lib_ldf_mode = chain+

lib_deps =
; PlatformIO 4.x
; WiFiMulti_Generic@>=1.1.1
; WiFiMulti_Generic@>=1.2.2

; PlatformIO 5.x
khoih-prog/WiFiMulti_Generic@>=1.1.1
khoih-prog/WiFiMulti_Generic@>=1.2.2

build_flags =
; set your debug output (default=Serial)
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiClient_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#define _WIFININA_LOGLEVEL_ 1
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiClient_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiNINA_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down
22 changes: 12 additions & 10 deletions src/WiFiNINA_Pinout_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -367,16 +368,17 @@

#if defined(__IMXRT1062__)
// For Teensy 4.0
#warning You have to modify pin usage according to actual connection for Teensy 4.0
#warning You have to modify pin usage according to actual connection for Teensy 4.0/4.1
#define PINS_COUNT (60u)
//NINA
#define NINA_GPIO0 (6u) //6
#define NINA_RESETN (2u)
#define NINA_ACK (5u)

#define SPIWIFI_SS 10 //PIN_SPI1_SS //10
#define SPIWIFI_ACK 5 //NINA_ACK //5
#define SPIWIFI_RESET 2 //NINA_RESETN //7
// T4.1 SPI pin defs for WiFiNINA AirLift.
#define NINA_GPIO0 (255u) //6
#define NINA_RESETN (6u)
#define NINA_ACK (9u)

// T4.1 SPI pin defs for WiFiNINA AirLift.
#define SPIWIFI_SS 5 //PIN_SPI1_SS //10
#define SPIWIFI_ACK 9 //NINA_ACK //7
#define SPIWIFI_RESET 6 //NINA_RESETN //5

#elif ( defined(__MKL26Z64__) || defined(ARDUINO_ARCH_AVR) )

Expand Down
3 changes: 2 additions & 1 deletion src/WiFiSSLClient_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#include "WiFiSSLClient_Generic.h"
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiSSLClient_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down
62 changes: 60 additions & 2 deletions src/WiFiServer_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,12 +37,13 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#include <string.h>
#include "utility/server_drv.h"

#define _WIFININA_LOGLEVEL_ 1
#define _WIFININA_LOGLEVEL_ 3

extern "C"
{
Expand Down Expand Up @@ -195,6 +196,8 @@ size_t WiFiServer::write(uint8_t b)
return write(&b, 1);
}

#if 1

size_t WiFiServer::write(const uint8_t *buffer, size_t size)
{
if (size == 0)
Expand All @@ -205,9 +208,26 @@ size_t WiFiServer::write(const uint8_t *buffer, size_t size)

size_t written = ServerDrv::sendData(_sock, buffer, size);

uint8_t timesResent = 0;

while ( (written != size) && (timesResent++ < 100) )
{
// Don't use too short delay so that NINA has some time to recover
// The fix is considered as kludge, and the correct place to fix is in ServerDrv::sendData()
delay(100);

written += ServerDrv::sendData(_sock, buffer + written, size - written);
}

NN_LOGINFO1("WiFiServer::write: loopSend => written = ", written);
NN_LOGINFO1("WiFiServer::write: loopSend => timesResent = ", timesResent);

if (!written)
{
setWriteError();

NN_LOGERROR("WiFiServer::write: !written error");

return 0;
}

Expand All @@ -217,5 +237,43 @@ size_t WiFiServer::write(const uint8_t *buffer, size_t size)
return 0;
}

if (written == size)
{
NN_LOGINFO1("WiFiServer::write: OK, written = ", written);
}
else
{
NN_LOGERROR3("WiFiServer::write: Not OK, size = ", size, ", written = ", written);
}

return written;
}

#else
size_t WiFiServer::write(const uint8_t *buffer, size_t size)
{
if (size == 0)
{
setWriteError();
return 0;
}
size_t written = ServerDrv::sendData(_sock, buffer, size);
if (!written)
{
setWriteError();
return 0;
}
if (!ServerDrv::checkDataSent(_sock))
{
setWriteError();
return 0;
}
return written;
}
#endif
3 changes: 2 additions & 1 deletion src/WiFiServer_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiStorage_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#include "WiFiStorage_Generic.h"
Expand Down
5 changes: 3 additions & 2 deletions src/WiFiStorage_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -212,7 +213,7 @@ class WiFiStorageFile
WiFiStorage.remove(filename);
}

void flush();
void flush() { };

void close()
{
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiUdp_Generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#include <string.h>
Expand Down
3 changes: 2 additions & 1 deletion src/WiFiUdp_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Version: 1.8.14-5
Version: 1.8.14-6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -37,6 +37,7 @@
1.8.14-3 K Hoang 31/12/2021 Fix issue with UDP for Nano_RP2040_Connect using arduino-pico core
1.8.14-4 K Hoang 01/05/2022 Fix bugs by using some PRs from original WiFiNINA. Add WiFiMulti-related examples
1.8.14-5 K Hoang 23/05/2022 Fix bug causing data lost when sending large files
1.8.14-6 K Hoang 17/08/2022 Add support to Teensy 4.x using WiFiNINA AirLift. Fix minor bug
***********************************************************************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit 2f98435

Please sign in to comment.