Skip to content

Commit 42fa6fb

Browse files
author
brentru
committed
perform wifi.setpins within setAirLiftPins, makes more sense there since its for setting up a breakout
1 parent d7999c1 commit 42fa6fb

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/AdafruitIO_AIRLIFT.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919
#include "Adafruit_MQTT.h"
2020
#include "Adafruit_MQTT_Client.h"
2121

22-
// Configure the pins used for the ESP32 connection
22+
// Configure some pins used for the ESP32 connection
2323
#if !defined(SPIWIFI_SS) // if the wifi definition isnt in the board variant
2424
#define BOARDEF 1
2525
#define SPIWIFI SPI
26-
#define SPIWIFI_SS airlift_ss // Chip select pin
27-
#define SPIWIFI_ACK airlift_ack // a.k.a BUSY or READY pin
28-
#define ESP32_RESETN airlift_rst // Reset pin
2926
#define ESP32_GPIO0 -1 // Not connected
3027
#endif
3128

@@ -109,14 +106,23 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
109106
return "AIRLIFT";
110107
}
111108

112-
void airLiftPins(uint16_t ss, uint16_t ack, uint16_t rst)
109+
/**************************************************************************/
110+
/*!
111+
@brief Defines pins for the ESP32's chip select, busy pin and reset pin.
112+
GPIO0 is not defined as it is disconnected by default.
113+
@param ss
114+
ESP32 chip select pin.
115+
@param ack
116+
ESP32 BUSY/READY pin.
117+
@param rst
118+
ESP32 RESET pin.
119+
*/
120+
/**************************************************************************/
121+
void setAirLiftPins(uint16_t ss, uint16_t ack, uint16_t rst)
113122
{
114-
airlift_ss = ss;
115-
airlift_ack = ack;
116-
airlift_rst = rst;
123+
WiFi.setPins(ss, ack, rst, ESP32_GPIO0, &SPIWIFI);
117124
}
118125

119-
uint16_t airlift_ss, airlift_ack, airlift_rst;
120126

121127
protected:
122128
const char *_ssid;
@@ -125,8 +131,6 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
125131
WiFiSSLClient *_http_client;
126132
WiFiSSLClient *_mqtt_client;
127133

128-
129-
130134
/**************************************************************************/
131135
/*!
132136
@brief Attempts to establish a WiFi connection with the wireless network,
@@ -135,11 +139,6 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
135139
/**************************************************************************/
136140
void _connect()
137141
{
138-
// for breakouts, check if the pins would be externally defined
139-
#ifdef BOARDEF
140-
WiFi.setPins(SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
141-
#endif
142-
143142
// check esp32 module status
144143
if (WiFi.status() == WL_NO_MODULE)
145144
{

0 commit comments

Comments
 (0)