Skip to content

Commit

Permalink
RF/RFBRIDGE Update (#1693)
Browse files Browse the repository at this point in the history
- remove optional RFRAW_SUPPORT
- enable module when RF_SUPPORT=1, optionally enable RCSwitch
- reorder ifdef checks to treat RFB_DIRECT and old RF_SUPPORT the same
- rename RF_PIN to RFB_RX_PIN
- depend on RF_SUPPORT instead of ITEAD_SONOFF_RFBRIDGE
- runtime TX & RX PIN setting
  • Loading branch information
mcspr authored May 8, 2019
1 parent bb33dfd commit 193cebd
Show file tree
Hide file tree
Showing 26 changed files with 23,161 additions and 22,981 deletions.
6 changes: 6 additions & 0 deletions code/espurna/config/deprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
#warning TELNET_PASSWORD is deprecated! Please replace it with TELNET_AUTHENTICATION
#define TELNET_AUTHENTICATION TELNET_PASSWORD
#endif

// 1.13.6 combines RF_SUPPORT with RFB_DIRECT
#ifdef RF_PIN
#warning RF_PIN is deprecated! Please use RFB_RX_PIN instead
#define RFB_RX_PIN RF_PIN
#endif
55 changes: 27 additions & 28 deletions code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -1223,10 +1223,21 @@
#endif

// -----------------------------------------------------------------------------
// RFBRIDGE
// This module is not compatible with RF_SUPPORT=1
// MQTT RF BRIDGE
// -----------------------------------------------------------------------------

#ifndef RF_SUPPORT
#define RF_SUPPORT 0
#endif

#ifndef RF_DEBOUNCE
#define RF_DEBOUNCE 500
#endif

#ifndef RF_LEARN_TIMEOUT
#define RF_LEARN_TIMEOUT 60000
#endif

#ifndef RF_SEND_TIMES
#define RF_SEND_TIMES 4 // How many times to send the message
#endif
Expand All @@ -1239,11 +1250,22 @@
#define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
#endif

#ifndef RF_RAW_SUPPORT
#define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1
// https://github.com/rhx/RF-Bridge-EFM8BB1
// Enable RCSwitch support
// Also possible to use with SONOFF RF BRIDGE, thanks to @wildwiz
// https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
#ifndef RFB_DIRECT
#define RFB_DIRECT 0
#endif

#ifndef RFB_RX_PIN
#define RFB_RX_PIN GPIO_NONE
#endif

#ifndef RFB_TX_PIN
#define RFB_TX_PIN GPIO_NONE
#endif


// -----------------------------------------------------------------------------
// IR Bridge
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -1455,29 +1477,6 @@
#define IR_BUTTON_COUNT 0
#endif

//--------------------------------------------------------------------------------
// Custom RF module
// Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
// Enable support by passing RF_SUPPORT=1 build flag
// This module is not compatible with RFBRIDGE or SONOFF RF
//--------------------------------------------------------------------------------

#ifndef RF_SUPPORT
#define RF_SUPPORT 0
#endif

#ifndef RF_PIN
#define RF_PIN 14
#endif

#ifndef RF_DEBOUNCE
#define RF_DEBOUNCE 500
#endif

#ifndef RF_LEARN_TIMEOUT
#define RF_LEARN_TIMEOUT 60000
#endif

//--------------------------------------------------------------------------------
// Custom RFM69 to MQTT bridge
// Check http://tinkerman.cat/rfm69-wifi-gateway/
Expand Down
30 changes: 13 additions & 17 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,19 +702,11 @@
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1

// RFB Direct hack thanks to @wildwiz
// https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
#ifndef RFB_DIRECT
#define RFB_DIRECT 0
#endif

#ifndef RFB_RX_PIN
#define RFB_RX_PIN 4 // GPIO for RX when RFB_DIRECT
#endif
#define RF_SUPPORT 1

#ifndef RFB_TX_PIN
#define RFB_TX_PIN 5 // GPIO for TX when RFB_DIRECT
#endif
// Only used when RFB_DIRECT=1
#define RFB_RX_PIN 4
#define RFB_TX_PIN 5

// When using un-modified harware, ESPurna communicates with the secondary
// MCU EFM8BB1 via UART at 19200 bps so we need to change the speed of
Expand Down Expand Up @@ -1294,7 +1286,8 @@

// RF
#define RF_SUPPORT 1
#define RF_PIN 4
#define RFB_DIRECT 1
#define RFB_RX_PIN 4

// -----------------------------------------------------------------------------
// HUACANXING H801 & H802
Expand Down Expand Up @@ -2430,10 +2423,9 @@
#endif
#define DALLAS_PIN 2

#ifndef RF_SUPPORT
#define RF_SUPPORT 1
#endif
#define RF_PIN 14
#define RFB_DIRECT 1
#define RFB_RX_PIN 14

#ifndef DIGITAL_SUPPORT
#define DIGITAL_SUPPORT 1
Expand Down Expand Up @@ -3674,7 +3666,11 @@
#define NOFUSS_SUPPORT 1
#define UART_MQTT_SUPPORT 1
#define INFLUXDB_SUPPORT 1
#define IR_SUPPORT 1
#define IR_SUPPORT 1
#define RF_SUPPORT 1

#define RFB_DIRECT 1
#define RFB_RX_PIN 4

#elif defined(TRAVIS03)

Expand Down
2 changes: 1 addition & 1 deletion code/espurna/config/progmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ PROGMEM const char espurna_modules[] =
#if RFM69_SUPPORT
"RFM69 "
#endif
#if RF_SUPPORT || defined(ITEAD_SONOFF_RFBRIDGE)
#if RF_SUPPORT
"RF "
#endif
#if SCHEDULER_SUPPORT
Expand Down
2 changes: 1 addition & 1 deletion code/espurna/config/webui.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#endif
#endif

#if defined(ITEAD_SONOFF_RFBRIDGE)
#if RF_SUPPORT == 1
#ifndef WEBUI_IMAGE
#define WEBUI_IMAGE WEBUI_IMAGE_RFBRIDGE
#else
Expand Down
Binary file modified code/espurna/data/index.all.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.light.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.lightfox.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfbridge.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfm69.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.sensor.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.small.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.thermostat.html.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion code/espurna/espurna.ino
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void setup() {
#if I2C_SUPPORT
i2cSetup();
#endif
#if defined(ITEAD_SONOFF_RFBRIDGE) || RF_SUPPORT
#if RF_SUPPORT
rfbSetup();
#endif
#if ALEXA_SUPPORT
Expand Down
Loading

0 comments on commit 193cebd

Please sign in to comment.