File tree Expand file tree Collapse file tree 3 files changed +62
-0
lines changed
examples/CheckFirmwareVersion Expand file tree Collapse file tree 3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ script:
39
39
- buildExampleSketch WiFiWebClientRepeating
40
40
- buildExampleSketch WiFiWebServer
41
41
- if [[ "$BOARD" =~ "arduino:samd:" ]]; then
42
+ buildExampleToolsSketch CheckFirmwareVersion
42
43
buildExampleToolsSketch FirmwareUpdater;
43
44
buildExampleToolsSketch SerialNINAPassthrough;
44
45
fi
Original file line number Diff line number Diff line change
1
+ /*
2
+ * This example check if the firmware loaded on the NINA module
3
+ * is updated.
4
+ *
5
+ * Circuit:
6
+ * - Board with NINA module (Arduino MKR WiFi 1010, MKR VIDOR 4000 and UNO WiFi Rev.2)
7
+ *
8
+ * Created 17 October 2018 by Riccardo Rosario Rizzo
9
+ * This code is in the public domain.
10
+ */
11
+ #include < SPI.h>
12
+ #include < WiFiNINA.h>
13
+
14
+ void setup () {
15
+ // Initialize serial
16
+ Serial.begin (9600 );
17
+ while (!Serial) {
18
+ ; // wait for serial port to connect. Needed for native USB port only
19
+ }
20
+
21
+ // Print a welcome message
22
+ Serial.println (" WiFiNINA firmware check." );
23
+ Serial.println ();
24
+
25
+ // check for the WiFi module:
26
+ if (WiFi.status () == WL_NO_MODULE) {
27
+ Serial.println (" Communication with WiFi module failed!" );
28
+ // don't continue
29
+ while (true );
30
+ }
31
+
32
+ // Print firmware version on the module
33
+ String fv = WiFi.firmwareVersion ();
34
+ String latestFv;
35
+ Serial.print (" Firmware version installed: " );
36
+ Serial.println (fv);
37
+
38
+ latestFv = WIFI_FIRMWARE_LATEST_VERSION;
39
+
40
+ // Print required firmware version
41
+ Serial.print (" Latest firmware version available : " );
42
+ Serial.println (latestFv);
43
+
44
+ // Check if the latest version is installed
45
+ Serial.println ();
46
+ if (fv == latestFv) {
47
+ Serial.println (" Check result: PASSED" );
48
+ } else {
49
+ Serial.println (" Check result: NOT PASSED" );
50
+ Serial.println (" - The firmware version on the module do not match the" );
51
+ Serial.println (" version required by the library, you may experience" );
52
+ Serial.println (" issues or failures." );
53
+ }
54
+ }
55
+
56
+ void loop () {
57
+ // do nothing
58
+ }
59
+
Original file line number Diff line number Diff line change 21
21
#ifndef WiFi_h
22
22
#define WiFi_h
23
23
24
+ #define WIFI_FIRMWARE_LATEST_VERSION " 1.1.0"
25
+
24
26
#include < inttypes.h>
25
27
26
28
extern " C" {
You can’t perform that action at this time.
0 commit comments