Skip to content

Commit bdb8b39

Browse files
authored
Merge pull request #81 from iabdalkader/ninafw_bug_fixes
Ninafw bug fixes
2 parents 63823f9 + e8c3163 commit bdb8b39

File tree

4 files changed

+497
-27
lines changed

4 files changed

+497
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This firmware uses [Espressif's IDF](https://github.com/espressif/esp-idf)
1313
1. Use `esptool` to flash the compiled firmware
1414

1515
## Notes
16-
If updating **Arduino UNO WiFi Rev. 2** NINA firmware via [SerialNINAPassthrough](https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/Tools/SerialNINAPassthrough/SerialNINAPassthrough.ino) sketch then the `esptool` invocation needs to be changed slightly:
16+
If updating the NINA firmware for an **Arduino UNO WiFi Rev. 2** or **Arduino Nano RP2040** board via [SerialNINAPassthrough](https://github.com/arduino-libraries/WiFiNINA/blob/master/examples/Tools/SerialNINAPassthrough/SerialNINAPassthrough.ino) sketch, then the `esptool` invocation needs to be changed slightly:
1717
```diff
1818
- --baud 115200 --before default_reset
1919
+ --baud 115200 --before no_reset

arduino/libraries/WiFi/src/WiFiServer.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,48 @@
2626
#include "WiFiServer.h"
2727

2828
WiFiServer::WiFiServer() :
29-
WiFiServer(0)
30-
{
31-
}
32-
33-
WiFiServer::WiFiServer(uint16_t port) :
34-
_port(port),
29+
_port(0),
3530
_socket(-1)
3631
{
3732
for (int i = 0; i < CONFIG_LWIP_MAX_SOCKETS; i++) {
3833
_spawnedSockets[i] = -1;
3934
}
4035
}
4136

42-
void WiFiServer::begin()
37+
uint8_t WiFiServer::begin(uint16_t port)
4338
{
4439
_socket = lwip_socket(AF_INET, SOCK_STREAM, 0);
4540

4641
if (_socket < 0) {
47-
return;
42+
return 0;
4843
}
4944

5045
struct sockaddr_in addr;
5146
memset(&addr, 0x00, sizeof(addr));
5247

5348
addr.sin_family = AF_INET;
5449
addr.sin_addr.s_addr = (uint32_t)0;
55-
addr.sin_port = htons(_port);
50+
addr.sin_port = htons(port);
5651

5752
if (lwip_bind(_socket, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
5853
lwip_close_r(_socket);
5954
_socket = -1;
60-
return;
55+
return 0;
6156
}
6257

6358
if (lwip_listen(_socket, 1) < 0) {
6459
lwip_close_r(_socket);
6560
_socket = -1;
66-
return;
61+
return 0;
6762
}
6863

6964
int nonBlocking = 1;
7065
lwip_ioctl_r(_socket, FIONBIO, &nonBlocking);
7166

72-
return;
67+
// Set port.
68+
_port = port;
69+
70+
return 1;
7371
}
7472

7573
WiFiClient WiFiServer::available(uint8_t* status)

arduino/libraries/WiFi/src/WiFiServer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ class WiFiClient;
3030
class WiFiServer /*: public Server*/ {
3131
public:
3232
WiFiServer();
33-
WiFiServer(uint16_t);
3433
WiFiClient available(uint8_t* status = NULL);
35-
void begin();
34+
uint8_t begin(uint16_t port);
3635
virtual size_t write(uint8_t);
3736
virtual size_t write(const uint8_t *buf, size_t size);
3837
uint8_t status();

0 commit comments

Comments
 (0)