From 6df0e09c41eb73c209593a4e23aaec048090feeb Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 12 Jan 2021 21:48:06 -0800 Subject: [PATCH 1/4] Add CI workflow to check for commonly misspelled words On every push, pull request, and periodically, use the codespell-project/actions-codespell action to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the ignore-words-list field of ./.codespellrc. Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces. --- .codespellrc | 6 ++++++ .github/workflows/spell-check.yml | 24 ++++++++++++++++++++++++ README.adoc | 1 + 3 files changed, 31 insertions(+) create mode 100644 .codespellrc create mode 100644 .github/workflows/spell-check.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..3dd012ad --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = endianess +check-filenames = +check-hidden = +skip = ./.git diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml new file mode 100644 index 00000000..7ad14758 --- /dev/null +++ b/.github/workflows/spell-check.yml @@ -0,0 +1,24 @@ +name: Spell Check + +on: + pull_request: + push: + schedule: + # Run every Saturday at 3 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 3 * * 6" + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#repository_dispatch + repository_dispatch: + +jobs: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # See: https://github.com/codespell-project/actions-codespell/blob/master/README.md + - name: Spell check + uses: codespell-project/actions-codespell@master diff --git a/README.adoc b/README.adoc index 8dfd4600..cba68605 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,5 @@ = WiFiNINA Library for Arduino = += {repository-name} library for Arduino = image:https://travis-ci.org/arduino-libraries/WiFiNINA.svg?branch=master["Build Status", link="https://travis-ci.org/arduino-libraries/WiFiNINA"] From 395d1475e8c8d3b62fe123b49a85f7b29407c5ca Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 12 Jan 2021 21:16:49 -0800 Subject: [PATCH 2/4] Fix typos in comments and Serial prints --- .../AP_SimpleWebServer/AP_SimpleWebServer.ino | 6 +++--- .../ConnectNoEncryption.ino | 7 +++---- examples/ConnectWithWEP/ConnectWithWEP.ino | 11 +++++----- examples/ConnectWithWPA/ConnectWithWPA.ino | 9 ++++---- .../ConnectWithWPA2Enterprise.ino | 11 +++++----- examples/ScanNetworks/ScanNetworks.ino | 5 ++--- .../ScanNetworksAdvanced.ino | 1 - .../SimpleWebServerWiFi.ino | 10 ++++----- .../CheckFirmwareVersion.ino | 5 ++--- examples/Tools/FirmwareUpdater/Endianess.ino | 1 - .../Tools/FirmwareUpdater/FirmwareUpdater.ino | 2 +- examples/WiFiChatServer/WiFiChatServer.ino | 12 +++++------ examples/WiFiPing/WiFiPing.ino | 5 ++--- examples/WiFiSSLClient/WiFiSSLClient.ino | 4 ++-- examples/WiFiSSLClient/arduino_secrets.h | 1 - examples/WiFiStorage/WiFiStorage.ino | 2 +- .../WiFiUdpNtpClient/WiFiUdpNtpClient.ino | 21 +++++-------------- .../WiFiUdpSendReceiveString.ino | 13 ++++-------- examples/WiFiWebClient/WiFiWebClient.ino | 16 +++++--------- .../WiFiWebClientRepeating.ino | 10 ++++----- examples/WiFiWebServer/WiFiWebServer.ino | 13 ++++++------ src/WiFi.h | 6 +++--- src/WiFiStorage.cpp | 2 +- src/WiFiStorage.h | 2 +- src/utility/spi_drv.cpp | 2 +- src/utility/wifi_drv.h | 14 ++++++------- src/utility/wl_definitions.h | 2 +- 27 files changed, 79 insertions(+), 114 deletions(-) diff --git a/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino b/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino index f4a3405a..c264d936 100644 --- a/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino +++ b/examples/AP_SimpleWebServer/AP_SimpleWebServer.ino @@ -4,7 +4,7 @@ A simple web server that lets you blink an LED via the web. This sketch will create a new access point (with no password). It will then launch a new server and print out the IP address - to the Serial monitor. From there, you can open that address in a web browser + to the Serial Monitor. From there, you can open that address in a web browser to turn on and off the LED on pin 13. If the IP address of your board is yourAddress: @@ -22,7 +22,7 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int led = LED_BUILTIN; int status = WL_IDLE_STATUS; @@ -51,7 +51,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // by default the local IP address of will be 192.168.4.1 + // by default the local IP address will be 192.168.4.1 // you can override it with the following: // WiFi.config(IPAddress(10, 0, 0, 1)); diff --git a/examples/ConnectNoEncryption/ConnectNoEncryption.ino b/examples/ConnectNoEncryption/ConnectNoEncryption.ino index c18a2d7e..22ba35ad 100644 --- a/examples/ConnectNoEncryption/ConnectNoEncryption.ino +++ b/examples/ConnectNoEncryption/ConnectNoEncryption.ino @@ -1,6 +1,5 @@ /* - - This example connects to an unencrypted Wifi network. + This example connects to an unencrypted WiFi network. Then it prints the MAC address of the board, the IP address obtained, and other network details. @@ -15,7 +14,7 @@ #include "arduino_secrets.h" ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) -int status = WL_IDLE_STATUS; // the Wifi radio's status +int status = WL_IDLE_STATUS; // the WiFi radio's status void setup() { //Initialize serial and wait for port to open: @@ -35,7 +34,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to open SSID: "); Serial.println(ssid); diff --git a/examples/ConnectWithWEP/ConnectWithWEP.ino b/examples/ConnectWithWEP/ConnectWithWEP.ino index 22ddd1e5..5f65ce4b 100644 --- a/examples/ConnectWithWEP/ConnectWithWEP.ino +++ b/examples/ConnectWithWEP/ConnectWithWEP.ino @@ -1,7 +1,6 @@ /* - - This example connects to a WEP-encrypted Wifi network. - Then it prints the MAC address of the Wifi module, + This example connects to a WEP-encrypted WiFi network. + Then it prints the MAC address of the WiFi module, the IP address obtained, and other network details. If you use 40-bit WEP, you need a key that is 10 characters long, @@ -26,8 +25,8 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number -int status = WL_IDLE_STATUS; // the Wifi radio's status +int keyIndex = 0; // your network key index number +int status = WL_IDLE_STATUS; // the WiFi radio's status void setup() { //Initialize serial and wait for port to open: @@ -48,7 +47,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to WEP network, SSID: "); Serial.println(ssid); diff --git a/examples/ConnectWithWPA/ConnectWithWPA.ino b/examples/ConnectWithWPA/ConnectWithWPA.ino index 8b114e1b..2e2b95e1 100644 --- a/examples/ConnectWithWPA/ConnectWithWPA.ino +++ b/examples/ConnectWithWPA/ConnectWithWPA.ino @@ -1,7 +1,6 @@ /* - - This example connects to an unencrypted Wifi network. - Then it prints the MAC address of the Wifi module, + This example connects to an unencrypted WiFi network. + Then it prints the MAC address of the WiFi module, the IP address obtained, and other network details. created 13 July 2010 @@ -16,7 +15,7 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int status = WL_IDLE_STATUS; // the Wifi radio's status +int status = WL_IDLE_STATUS; // the WiFi radio's status void setup() { //Initialize serial and wait for port to open: @@ -37,7 +36,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to WPA SSID: "); Serial.println(ssid); diff --git a/examples/ConnectWithWPA2Enterprise/ConnectWithWPA2Enterprise.ino b/examples/ConnectWithWPA2Enterprise/ConnectWithWPA2Enterprise.ino index 77644e89..fcf090ba 100644 --- a/examples/ConnectWithWPA2Enterprise/ConnectWithWPA2Enterprise.ino +++ b/examples/ConnectWithWPA2Enterprise/ConnectWithWPA2Enterprise.ino @@ -1,6 +1,6 @@ /* - This example connects to an WPA2 Enterprise WiFi network. - Then it prints the MAC address of the WiFi module, + This example connects to a WPA2 Enterprise WiFi network. + Then it prints the MAC address of the WiFi module, the IP address obtained, and other network details. Based on ConnectWithWPA.ino by dlf (Metodo2 srl) and Tom Igoe @@ -13,7 +13,7 @@ char ssid[] = SECRET_SSID; // your WPA2 enterprise network SSID (name) char user[] = SECRET_USER; // your WPA2 enterprise username char pass[] = SECRET_PASS; // your WPA2 enterprise password -int status = WL_IDLE_STATUS; // the Wifi radio's status +int status = WL_IDLE_STATUS; // the WiFi radio's status void setup() { //Initialize serial and wait for port to open: @@ -34,14 +34,13 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to WPA SSID: "); Serial.println(ssid); // Connect to WPA2 enterprise network: - // - You can optionally provide additional identity and CA cert (string) parameters: + // - You can optionally provide additional identity and CA cert (string) parameters if your network requires them: // WiFi.beginEnterprise(ssid, user, pass, identity, caCert) - // . if your network requires them. status = WiFi.beginEnterprise(ssid, user, pass); // wait 10 seconds for connection: diff --git a/examples/ScanNetworks/ScanNetworks.ino b/examples/ScanNetworks/ScanNetworks.ino index c70c1334..e90bc7ec 100644 --- a/examples/ScanNetworks/ScanNetworks.ino +++ b/examples/ScanNetworks/ScanNetworks.ino @@ -1,7 +1,6 @@ /* - This example prints the board's MAC address, and - scans for available Wifi networks using the NINA module. + scans for available WiFi networks using the NINA module. Every ten seconds, it scans again. It doesn't actually connect to any network, so no encryption scheme is specified. @@ -56,7 +55,7 @@ void listNetworks() { Serial.println("** Scan Networks **"); int numSsid = WiFi.scanNetworks(); if (numSsid == -1) { - Serial.println("Couldn't get a wifi connection"); + Serial.println("Couldn't get a WiFi connection"); while (true); } diff --git a/examples/ScanNetworksAdvanced/ScanNetworksAdvanced.ino b/examples/ScanNetworksAdvanced/ScanNetworksAdvanced.ino index f95792bc..9a32862e 100644 --- a/examples/ScanNetworksAdvanced/ScanNetworksAdvanced.ino +++ b/examples/ScanNetworksAdvanced/ScanNetworksAdvanced.ino @@ -1,5 +1,4 @@ /* - This example prints the board's MAC address, and scans for available WiFi networks using the NINA module. Every ten seconds, it scans again. It doesn't actually diff --git a/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino b/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino index 11a9fdf9..35d7077f 100644 --- a/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino +++ b/examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino @@ -3,7 +3,7 @@ A simple web server that lets you blink an LED via the web. This sketch will print the IP address of your WiFi module (once connected) - to the Serial monitor. From there, you can open that address in a web browser + to the Serial Monitor. From there, you can open that address in a web browser to turn on and off the LED on pin 9. If the IP address of your board is yourAddress: @@ -11,7 +11,7 @@ http://yourAddress/L turns it off This example is written for a network using WPA encryption. For - WEP or WPA, change the Wifi.begin() call accordingly. + WEP or WPA, change the WiFi.begin() call accordingly. Circuit: * Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2) @@ -27,7 +27,7 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; WiFiServer server(80); @@ -48,7 +48,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to Network named: "); Serial.println(ssid); // print the network name (SSID); @@ -110,7 +110,7 @@ void loop() { } // close the connection: client.stop(); - Serial.println("client disonnected"); + Serial.println("client disconnected"); } } diff --git a/examples/Tools/CheckFirmwareVersion/CheckFirmwareVersion.ino b/examples/Tools/CheckFirmwareVersion/CheckFirmwareVersion.ino index d17370d5..1a30163e 100644 --- a/examples/Tools/CheckFirmwareVersion/CheckFirmwareVersion.ino +++ b/examples/Tools/CheckFirmwareVersion/CheckFirmwareVersion.ino @@ -1,5 +1,5 @@ /* - * This example check if the firmware loaded on the NINA module + * This example checks if the firmware loaded on the NINA module * is updated. * * Circuit: @@ -47,7 +47,7 @@ void setup() { Serial.println("Check result: PASSED"); } else { Serial.println("Check result: NOT PASSED"); - Serial.println(" - The firmware version on the module do not match the"); + Serial.println(" - The firmware version on the module does not match the"); Serial.println(" version required by the library, you may experience"); Serial.println(" issues or failures."); } @@ -56,4 +56,3 @@ void setup() { void loop() { // do nothing } - diff --git a/examples/Tools/FirmwareUpdater/Endianess.ino b/examples/Tools/FirmwareUpdater/Endianess.ino index 2fcf146a..d55cacb6 100644 --- a/examples/Tools/FirmwareUpdater/Endianess.ino +++ b/examples/Tools/FirmwareUpdater/Endianess.ino @@ -58,4 +58,3 @@ uint32_t toNetwork32(uint32_t to) { uint16_t toNetwork16(uint16_t to) { return fromNetwork16(to); } - diff --git a/examples/Tools/FirmwareUpdater/FirmwareUpdater.ino b/examples/Tools/FirmwareUpdater/FirmwareUpdater.ino index a2ba7614..acf80fd7 100644 --- a/examples/Tools/FirmwareUpdater/FirmwareUpdater.ino +++ b/examples/Tools/FirmwareUpdater/FirmwareUpdater.ino @@ -27,7 +27,7 @@ typedef struct __attribute__((__packed__)) { uint32_t arg1; uint16_t payloadLength; - // payloadLenght bytes of data follows... + // payloadLength bytes of data follows... } UartPacket; static const int MAX_PAYLOAD_SIZE = 1024; diff --git a/examples/WiFiChatServer/WiFiChatServer.ino b/examples/WiFiChatServer/WiFiChatServer.ino index f9aa198c..c608016f 100644 --- a/examples/WiFiChatServer/WiFiChatServer.ino +++ b/examples/WiFiChatServer/WiFiChatServer.ino @@ -2,11 +2,11 @@ Chat Server A simple server that distributes any incoming messages to all - connected clients. To use telnet to your device's IP address and type. + connected clients. To use, telnet to your device's IP address and type. You can see the client's input in the serial monitor as well. This example is written for a network using WPA encryption. For - WEP or WPA, change the Wifi.begin() call accordingly. + WEP or WPA, change the WiFi.begin() call accordingly. Circuit: @@ -27,7 +27,7 @@ char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; @@ -54,7 +54,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -80,7 +80,7 @@ void loop() { // when the client sends the first byte, say hello: if (client) { if (!alreadyConnected) { - // clead out the input buffer: + // clear out the input buffer: client.flush(); Serial.println("We have a new client"); client.println("Hello, client!"); @@ -115,5 +115,3 @@ void printWifiStatus() { Serial.print(rssi); Serial.println(" dBm"); } - - diff --git a/examples/WiFiPing/WiFiPing.ino b/examples/WiFiPing/WiFiPing.ino index cae37da1..48ad458a 100644 --- a/examples/WiFiPing/WiFiPing.ino +++ b/examples/WiFiPing/WiFiPing.ino @@ -1,7 +1,6 @@ /* - - This example connects to a encrypted WiFi network (WPA/WPA2). - Then it prints the MAC address of the board, + This example connects to an encrypted WiFi network (WPA/WPA2). + Then it prints the MAC address of the board, the IP address obtained, and other network details. Then it continuously pings given host specified by IP Address or name. diff --git a/examples/WiFiSSLClient/WiFiSSLClient.ino b/examples/WiFiSSLClient/WiFiSSLClient.ino index 09a6b9f5..003fbf07 100644 --- a/examples/WiFiSSLClient/WiFiSSLClient.ino +++ b/examples/WiFiSSLClient/WiFiSSLClient.ino @@ -17,7 +17,7 @@ last revision November 2015 ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; // if you don't want to use DNS (and reduce your sketch size) @@ -59,7 +59,7 @@ void setup() { // wait 10 seconds for connection: delay(10000); } - Serial.println("Connected to wifi"); + Serial.println("Connected to WiFi"); printWiFiStatus(); Serial.println("\nStarting connection to server..."); diff --git a/examples/WiFiSSLClient/arduino_secrets.h b/examples/WiFiSSLClient/arduino_secrets.h index a8ff904d..0c9fdd55 100644 --- a/examples/WiFiSSLClient/arduino_secrets.h +++ b/examples/WiFiSSLClient/arduino_secrets.h @@ -1,3 +1,2 @@ #define SECRET_SSID "" #define SECRET_PASS "" - diff --git a/examples/WiFiStorage/WiFiStorage.ino b/examples/WiFiStorage/WiFiStorage.ino index 71ef56ef..5fd627b2 100644 --- a/examples/WiFiStorage/WiFiStorage.ino +++ b/examples/WiFiStorage/WiFiStorage.ino @@ -1,5 +1,5 @@ /* - This example shows how to interact with NiNa internal memory partition + This example shows how to interact with NINA internal memory partition APIs are modeled on SerialFlash library (not on SD) to speedup operations and avoid buffers. */ diff --git a/examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino b/examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino index 8f56acd2..354cfa76 100644 --- a/examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino +++ b/examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino @@ -1,5 +1,4 @@ /* - Udp NTP Client Get the time from a Network Time Protocol (NTP) time server @@ -25,13 +24,13 @@ int status = WL_IDLE_STATUS; ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) unsigned int localPort = 2390; // local port to listen for UDP packets IPAddress timeServer(129, 6, 15, 28); // time.nist.gov NTP server -const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message +const int NTP_PACKET_SIZE = 48; // NTP timestamp is in the first 48 bytes of the message byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets @@ -57,7 +56,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -68,7 +67,7 @@ void setup() { delay(10000); } - Serial.println("Connected to wifi"); + Serial.println("Connected to WiFi"); printWifiStatus(); Serial.println("\nStarting connection to server..."); @@ -85,7 +84,7 @@ void loop() { Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer //the timestamp starts at byte 40 of the received packet and is four bytes, - // or two words, long. First, esxtract the two words: + // or two words, long. First, extract the two words: unsigned long highWord = word(packetBuffer[40], packetBuffer[41]); unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]); @@ -172,13 +171,3 @@ void printWifiStatus() { Serial.print(rssi); Serial.println(" dBm"); } - - - - - - - - - - diff --git a/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino b/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino index 78782c5d..d022e278 100644 --- a/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino +++ b/examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino @@ -1,8 +1,7 @@ - /* WiFi UDP Send and Receive String - This sketch wait an UDP packet on localPort using the WiFi module. + This sketch waits for a UDP packet on localPort using the WiFi module. When a packet is received an Acknowledge packet is sent to the client on port remotePort created 30 December 2012 @@ -20,7 +19,7 @@ int status = WL_IDLE_STATUS; ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) unsigned int localPort = 2390; // local port to listen on @@ -48,7 +47,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -58,7 +57,7 @@ void setup() { // wait 10 seconds for connection: delay(10000); } - Serial.println("Connected to wifi"); + Serial.println("Connected to WiFi"); printWifiStatus(); Serial.println("\nStarting connection to server..."); @@ -111,7 +110,3 @@ void printWifiStatus() { Serial.print(rssi); Serial.println(" dBm"); } - - - - diff --git a/examples/WiFiWebClient/WiFiWebClient.ino b/examples/WiFiWebClient/WiFiWebClient.ino index 22dd9129..86a1a46f 100644 --- a/examples/WiFiWebClient/WiFiWebClient.ino +++ b/examples/WiFiWebClient/WiFiWebClient.ino @@ -1,4 +1,3 @@ - /* Web client @@ -6,10 +5,10 @@ using the WiFi module. This example is written for a network using WPA encryption. For - WEP or WPA, change the Wifi.begin() call accordingly. + WEP or WPA, change the WiFi.begin() call accordingly. This example is written for a network using WPA encryption. For - WEP or WPA, change the Wifi.begin() call accordingly. + WEP or WPA, change the WiFi.begin() call accordingly. Circuit: * Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2) @@ -28,7 +27,7 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; // if you don't want to use DNS (and reduce your sketch size) @@ -60,7 +59,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -70,7 +69,7 @@ void setup() { // wait 10 seconds for connection: delay(10000); } - Serial.println("Connected to wifi"); + Serial.println("Connected to WiFi"); printWifiStatus(); Serial.println("\nStarting connection to server..."); @@ -121,8 +120,3 @@ void printWifiStatus() { Serial.print(rssi); Serial.println(" dBm"); } - - - - - diff --git a/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino b/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino index dfb32fb7..455ba255 100644 --- a/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino +++ b/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino @@ -1,5 +1,5 @@ /* - Repeating Wifi Web Client + Repeating WiFi Web Client This sketch connects to a a web server and makes a request using a WiFi equipped Arduino board. @@ -21,11 +21,11 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; -// Initialize the Wifi client library +// Initialize the WiFi client library WiFiClient client; // server address: @@ -54,7 +54,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -88,7 +88,7 @@ void loop() { // this method makes a HTTP connection to the server: void httpRequest() { // close any connection before send a new request. - // This will free the socket on the Nina module + // This will free the socket on the NINA module client.stop(); // if there's a successful connection: diff --git a/examples/WiFiWebServer/WiFiWebServer.ino b/examples/WiFiWebServer/WiFiWebServer.ino index 04e06a5a..9e1200bb 100644 --- a/examples/WiFiWebServer/WiFiWebServer.ino +++ b/examples/WiFiWebServer/WiFiWebServer.ino @@ -4,7 +4,7 @@ A simple web server that shows the value of the analog input pins. This example is written for a network using WPA encryption. For - WEP or WPA, change the Wifi.begin() call accordingly. + WEP or WPA, change the WiFi.begin() call accordingly. Circuit: * Analog inputs attached to pins A0 through A5 (optional) @@ -24,7 +24,7 @@ ///////please enter your sensitive data in the Secret tab/arduino_secrets.h char ssid[] = SECRET_SSID; // your network SSID (name) char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP) -int keyIndex = 0; // your network key Index number (needed only for WEP) +int keyIndex = 0; // your network key index number (needed only for WEP) int status = WL_IDLE_STATUS; @@ -49,7 +49,7 @@ void setup() { Serial.println("Please upgrade the firmware"); } - // attempt to connect to Wifi network: + // attempt to connect to WiFi network: while (status != WL_CONNECTED) { Serial.print("Attempting to connect to SSID: "); Serial.println(ssid); @@ -70,17 +70,17 @@ void loop() { WiFiClient client = server.available(); if (client) { Serial.println("new client"); - // an http request ends with a blank line + // an HTTP request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); // if you've gotten to the end of the line (received a newline - // character) and the line is blank, the http request has ended, + // character) and the line is blank, the HTTP request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { - // send a standard http response header + // send a standard HTTP response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); // the connection will be closed after completion of the response @@ -135,4 +135,3 @@ void printWifiStatus() { Serial.print(rssi); Serial.println(" dBm"); } - diff --git a/src/WiFi.h b/src/WiFi.h index 9ba4bf05..6824b2cd 100644 --- a/src/WiFi.h +++ b/src/WiFi.h @@ -51,13 +51,13 @@ class WiFiClass static const char* firmwareVersion(); - /* Start Wifi connection for OPEN networks + /* Start WiFi connection for OPEN networks * * param ssid: Pointer to the SSID string. */ int begin(const char* ssid); - /* Start Wifi connection with WEP encryption. + /* Start WiFi connection with WEP encryption. * Configure a key into the device. The key type (WEP-40, WEP-104) * is determined by the size of the key (5 bytes for WEP-40, 13 bytes for WEP-104). * @@ -67,7 +67,7 @@ class WiFiClass */ int begin(const char* ssid, uint8_t key_idx, const char* key); - /* Start Wifi connection with passphrase + /* Start WiFi connection with passphrase * the most secure supported mode will be automatically selected * * param ssid: Pointer to the SSID string. diff --git a/src/WiFiStorage.cpp b/src/WiFiStorage.cpp index 9d3d13ea..21b50c99 100644 --- a/src/WiFiStorage.cpp +++ b/src/WiFiStorage.cpp @@ -1,5 +1,5 @@ /* - WiFiStorage.cpp - Library for Arduino boards based on NINA wifi module. + WiFiStorage.cpp - Library for Arduino boards based on NINA WiFi module. Copyright (c) 2018 Arduino SA. All rights reserved. This library is free software; you can redistribute it and/or diff --git a/src/WiFiStorage.h b/src/WiFiStorage.h index fdccfc41..30a62765 100644 --- a/src/WiFiStorage.h +++ b/src/WiFiStorage.h @@ -1,5 +1,5 @@ /* - WiFiStorage.h - Library for Arduino boards based on NINA wifi module. + WiFiStorage.h - Library for Arduino boards based on NINA WiFi module. Copyright (c) 2018 Arduino SA. All rights reserved. This library is free software; you can redistribute it and/or diff --git a/src/utility/spi_drv.cpp b/src/utility/spi_drv.cpp index ce73ef9e..77b95a7d 100644 --- a/src/utility/spi_drv.cpp +++ b/src/utility/spi_drv.cpp @@ -30,7 +30,7 @@ // yes, so use the existing VidorFPGA include #include #else -// otherwise, fallback to VidorPeripherals and it's bistream +// otherwise, fallback to VidorPeripherals and it's bitstream #include #endif diff --git a/src/utility/wifi_drv.h b/src/utility/wifi_drv.h index 4127d475..b641301c 100644 --- a/src/utility/wifi_drv.h +++ b/src/utility/wifi_drv.h @@ -81,32 +81,32 @@ class WiFiDrv * The ssid of the desired network should be specified. * * param ssid: The ssid of the desired network. - * param ssid_len: Lenght of ssid string. + * param ssid_len: Length of ssid string. * return: WL_SUCCESS or WL_FAILURE */ static int8_t wifiSetNetwork(const char* ssid, uint8_t ssid_len); - /* Start Wifi connection with passphrase + /* Start WiFi connection with passphrase * the most secure supported mode will be automatically selected * * param ssid: Pointer to the SSID string. - * param ssid_len: Lenght of ssid string. + * param ssid_len: Length of ssid string. * param passphrase: Passphrase. Valid characters in a passphrase * must be between ASCII 32-126 (decimal). - * param len: Lenght of passphrase string. + * param len: Length of passphrase string. * return: WL_SUCCESS or WL_FAILURE */ static int8_t wifiSetPassphrase(const char* ssid, uint8_t ssid_len, const char *passphrase, const uint8_t len); - /* Start Wifi connection with WEP encryption. + /* Start WiFi connection with WEP encryption. * Configure a key into the device. The key type (WEP-40, WEP-104) * is determined by the size of the key (5 bytes for WEP-40, 13 bytes for WEP-104). * * param ssid: Pointer to the SSID string. - * param ssid_len: Lenght of ssid string. + * param ssid_len: Length of ssid string. * param key_idx: The key index to set. Valid values are 0-3. * param key: Key input buffer. - * param len: Lenght of key string. + * param len: Length of key string. * return: WL_SUCCESS or WL_FAILURE */ static int8_t wifiSetKey(const char* ssid, uint8_t ssid_len, uint8_t key_idx, const void *key, const uint8_t len); diff --git a/src/utility/wl_definitions.h b/src/utility/wl_definitions.h index 2cad3ec4..dc140455 100644 --- a/src/utility/wl_definitions.h +++ b/src/utility/wl_definitions.h @@ -43,7 +43,7 @@ #define WIFI_MAX_SOCK_NUM 10 // Socket not available constant #define SOCK_NOT_AVAIL 255 -// Default state value for Wifi state field +// Default state value for WiFi state field #define NA_STATE -1 typedef enum { From 83ccb3228b486a36d40257bdd3732b60bc28a360 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 12 Jan 2021 22:15:41 -0800 Subject: [PATCH 3/4] Add "smoke test" examples compilation CI workflow On every push or pull request that affects library source or example files, compile all example sketches for the specified boards. --- .github/workflows/compile-examples.yml | 50 ++++++++++++++++++++++++++ .travis.yml | 48 ------------------------- README.adoc | 10 ++++-- 3 files changed, 57 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/compile-examples.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml new file mode 100644 index 00000000..9691a607 --- /dev/null +++ b/.github/workflows/compile-examples.yml @@ -0,0 +1,50 @@ +name: Compile Examples + +on: + pull_request: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + push: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + # Scheduled trigger checks for breakage caused by changes to external resources (libraries, platforms) + schedule: + # run every Saturday at 3 AM UTC + - cron: "0 3 * * 6" + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#repository_dispatch + repository_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + board: + - fqbn: arduino:samd:mkrwifi1010 + - fqbn: arduino:samd:mkrvidor4000 + - fqbn: arduino:megaavr:uno2018:mode=on + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Compile examples + uses: arduino/compile-sketches@main + with: + fqbn: ${{ matrix.board.fqbn }} + libraries: | + # Install the library from the local path. + - source-path: ./ + # Install library dependencies. + - name: VidorPeripherals + sketch-paths: | + - ./examples/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index acfbccce..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: generic -env: - global: - - IDE_VERSION=1.8.5 - matrix: - - BOARD="arduino:samd:mkrwifi1010" - - BOARD="arduino:samd_beta:mkrvidor4000" - - BOARD="arduino:megaavr:uno2018:mode=on" -before_install: - - wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz - - tar xf arduino-$IDE_VERSION-linux64.tar.xz - - mv arduino-$IDE_VERSION $HOME/arduino-ide - - export PATH=$PATH:$HOME/arduino-ide - - if [[ "$BOARD" =~ "arduino:samd:" ]]; then - arduino --install-boards arduino:samd; - fi - - if [[ "$BOARD" =~ "arduino:samd_beta:" ]]; then - arduino --install-boards arduino:samd_beta; - arduino --install-library VidorPeripherals; - fi - - if [[ "$BOARD" =~ "arduino:megaavr:" ]]; then - arduino --install-boards arduino:megaavr; - fi - - buildExampleSketch() { arduino --verbose-build --verify --board $BOARD $PWD/examples/$1/$1.ino; } - - buildExampleToolsSketch() { arduino --verbose-build --verify --board $BOARD $PWD/examples/Tools/$1/$1.ino; } -install: - - mkdir -p $HOME/Arduino/libraries - - ln -s $PWD $HOME/Arduino/libraries/. -script: - - buildExampleSketch AP_SimpleWebServer - - buildExampleSketch ConnectNoEncryption - - buildExampleSketch ConnectWithWEP - - buildExampleSketch ConnectWithWPA - - buildExampleSketch ConnectWithWPA2Enterprise - - buildExampleSketch ScanNetworks - - buildExampleSketch ScanNetworksAdvanced - - buildExampleSketch SimpleWebServerWiFi - - buildExampleSketch WiFiChatServer - - buildExampleSketch WiFiPing - - buildExampleSketch WiFiSSLClient - - buildExampleSketch WiFiUdpNtpClient - - buildExampleSketch WiFiUdpSendReceiveString - - buildExampleSketch WiFiWebClient - - buildExampleSketch WiFiWebClientRepeating - - buildExampleSketch WiFiWebServer - - buildExampleToolsSketch CheckFirmwareVersion - - buildExampleToolsSketch FirmwareUpdater; - - buildExampleToolsSketch SerialNINAPassthrough; diff --git a/README.adoc b/README.adoc index cba68605..783984f0 100644 --- a/README.adoc +++ b/README.adoc @@ -1,14 +1,18 @@ -= WiFiNINA Library for Arduino = +// Define the repository information in these attributes +:repository-owner: arduino-libraries +:repository-name: WiFiNINA + = {repository-name} library for Arduino = -image:https://travis-ci.org/arduino-libraries/WiFiNINA.svg?branch=master["Build Status", link="https://travis-ci.org/arduino-libraries/WiFiNINA"] +image:https://github.com/{repository-owner}/{repository-name}/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Compile+Examples"] +image:https://github.com/{repository-owner}/{repository-name}/workflows/Spell%20Check/badge.svg["Spell Check Status", link="https://github.com/{repository-owner}/{repository-name}/actions?workflow=Spell+Check"] Enables network connection (local and Internet) with the Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000 and Arduino UNO WiFi Rev.2. With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The board can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS. For more information about this library please visit us at -http://www.arduino.cc/en/Reference/WiFiNINA +https://www.arduino.cc/en/Reference/{repository-name} == License == From 81698959c978f6a4bac09e2c5e4ac8b701764cce Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 12 Jan 2021 22:21:03 -0800 Subject: [PATCH 4/4] Report changes in memory usage that would result from merging a PR On creation or commit to a pull request, a report of the resulting change in memory usage of the examples will be commented to the PR thread. --- .github/workflows/compile-examples.yml | 11 +++++++++++ .github/workflows/report-size-deltas.yml | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 9691a607..9a017a46 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -24,6 +24,9 @@ jobs: build: runs-on: ubuntu-latest + env: + SKETCHES_REPORTS_PATH: sketches-reports + strategy: fail-fast: false @@ -48,3 +51,11 @@ jobs: - name: VidorPeripherals sketch-paths: | - ./examples/ + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + + - name: Save memory usage change report as artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ env.SKETCHES_REPORTS_PATH }} + path: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml new file mode 100644 index 00000000..c69650f2 --- /dev/null +++ b/.github/workflows/report-size-deltas.yml @@ -0,0 +1,21 @@ +name: Report Size Deltas + +on: + schedule: + - cron: '*/5 * * * *' + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#repository_dispatch + repository_dispatch: + +jobs: + report: + runs-on: ubuntu-latest + + steps: + # See: https://github.com/arduino/actions/blob/master/libraries/report-size-deltas/README.md + - name: Comment size deltas reports to PRs + uses: arduino/report-size-deltas@main + with: + # The name of the workflow artifact created by the "Compile Examples" workflow + sketches-reports-source: sketches-reports