Skip to content

Commit e65f29d

Browse files
author
brentru
committed
save pins, perform wifi.setPins within _connect()
1 parent 13bb6ed commit e65f29d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/AdafruitIO_AIRLIFT.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,16 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
144144
/**************************************************************************/
145145
void setAirLiftPins(uint16_t ss, uint16_t ack, uint16_t rst)
146146
{
147-
WiFi.setPins(ss, ack, rst, ESP32_GPIO0, &SPIWIFI);
148-
AIO_DEBUG_PRINTLN("Pins Set!")
147+
_ssPin = ss;
148+
_ackPin = ack;
149+
_rstPin = rst;
149150
}
150151

151-
152152
protected:
153153
const char *_ssid;
154154
const char *_pass;
155-
String _fv;
155+
String _fv = "0.0.0";
156+
uint16_t _ssPin, _ackPin, _rstPin = 0;
156157

157158
WiFiSSLClient *_http_client;
158159
WiFiSSLClient *_mqtt_client;
@@ -165,10 +166,15 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
165166
/**************************************************************************/
166167
void _connect()
167168
{
169+
// setup ESP32 pins
170+
if (_ssPin != 0) {
171+
WiFi.setPins(10, 9, 6, ESP32_GPIO0, &SPIWIFI);
172+
}
173+
168174
// check esp32 module version against NINAFWVER
169175
firmwareCheck();
170176

171-
// check esp32 module status
177+
// check for shield
172178
if (WiFi.status() == WL_NO_MODULE)
173179
{
174180
AIO_DEBUG_PRINTLN("No ESP32 module detected!");

src/AdafruitIO_Definitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AdafruitIOGroupCallback {
4242
};
4343

4444
// Uncomment/comment to turn on/off debug output messages.
45-
#define AIO_DEBUG
45+
//#define AIO_DEBUG
4646
// Uncomment/comment to turn on/off error output
4747
#define AIO_ERROR
4848

0 commit comments

Comments
 (0)