Skip to content

Commit 7a11617

Browse files
committed
ESP32 fixes
1 parent 2f84cbf commit 7a11617

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

hampton_bay_fan_mqtt/hampton_bay_fan_mqtt.ino

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <ELECHOUSE_CC1101_SRC_DRV.h>
22
#include <RCSwitch.h>
3-
#include <ESP8266WiFi.h>
3+
#ifdef ESP32
4+
#include <WiFi.h>
5+
#elif ESP8266
6+
#include <ESP8266WiFi.h>
7+
#endif
48
#include <PubSubClient.h>
59

610
// Configure wifi settings
@@ -27,6 +31,10 @@
2731
#ifdef ESP32 // for esp32! Receiver on GPIO pin 4. Transmit on GPIO pin 2.
2832
#define RX_PIN 4
2933
#define TX_PIN 2
34+
#define SCK_PIN 18
35+
#define SS_PIN 5
36+
#define MISO_PIN 19
37+
#define MOSI_PIN 23
3038
#elif ESP8266 // for esp8266! Receiver on pin 4 = D2. Transmit on pin 5 = D1.
3139
#define RX_PIN 4
3240
#define TX_PIN 5
@@ -259,6 +267,10 @@ void setup() {
259267
fans[i].fanSpeed = FAN_OFF;
260268
}
261269

270+
#ifdef ESP32 // Override Spi pin assignments for ESP32 only
271+
ELECHOUSE_cc1101.setSpiPin(SCK_PIN, MISO_PIN, MOSI_PIN, SS_PIN);
272+
#endif
273+
262274
ELECHOUSE_cc1101.Init();
263275
ELECHOUSE_cc1101.setMHZ(FREQUENCY);
264276
ELECHOUSE_cc1101.SetRx();

0 commit comments

Comments
 (0)