32
32
#define SPIWIFI SPI
33
33
#define ESP32_GPIO0 -1 // Not connected
34
34
#endif
35
+ #define NINAFWVER " 1.0.0"
35
36
36
37
/* ***************************************************************************/
37
38
/* !
@@ -83,7 +84,23 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
83
84
84
85
/* *******************************************************/
85
86
/* !
86
- @brief Returns the network status of an AirLift module.
87
+ @brief Checks the version of an ESP32 module against
88
+ NINAFWVER. Raises an error if the firmware needs to be
89
+ upgraded.
90
+ */
91
+ /* *******************************************************/
92
+ void firmwareCheck ()
93
+ {
94
+ _fv = WiFi.firmwareVersion ();
95
+ if (_fv < NINAFWVER)
96
+ {
97
+ AIO_DEBUG_PRINTLN (" Please upgrade the firmware on the ESP module" );
98
+ }
99
+ }
100
+
101
+ /* *******************************************************/
102
+ /* !
103
+ @brief Returns the network status of an ESP32 module.
87
104
@return aio_status_t
88
105
*/
89
106
/* *******************************************************/
@@ -134,6 +151,7 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
134
151
protected:
135
152
const char *_ssid;
136
153
const char *_pass;
154
+ String _fv;
137
155
138
156
WiFiSSLClient *_http_client;
139
157
WiFiSSLClient *_mqtt_client;
@@ -146,17 +164,19 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
146
164
/* *************************************************************************/
147
165
void _connect ()
148
166
{
167
+ // check esp32 module version against NINAFWVER
168
+ firmwareCheck ();
169
+
149
170
// check esp32 module status
150
171
if (WiFi.status () == WL_NO_MODULE)
151
172
{
152
- Serial. println (" No Module! !" );
153
- Serial. print (WiFi. status ()) ;
173
+ AIO_DEBUG_PRINTLN (" No ESP32 module detected !" );
174
+ return ;
154
175
}
155
176
156
177
WiFi.begin (_ssid, _pass);
157
178
_status = AIO_NET_DISCONNECTED;
158
179
}
159
180
};
160
181
161
-
162
182
#endif // ADAFRUITIO_AIRLIFT_H
0 commit comments