diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 6d4a19f53..2f1525827 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -4,6 +4,7 @@ * Add Zigbee additional commands and sending messages to control devices (#6095) * Fix Rules were not triggered with IR unknown protocol or in sonoff-it (#6629) * Add define USE_DEEPSLEEP and command DeepSleepTime 0 or 10..86400 (seconds) to enter deepsleep mode (#6638) + * Add define USE_SONOFF_RF to enable/disable Sonoff Rf support (#6648) * * 6.6.0.17 20191009 * Add command SetOption34 0..255 to set backlog delay. Default value is 200 (mSeconds) (#6562) diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index 8e4737437..5cb920bee 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -308,14 +308,17 @@ // #define SUPPORT_MQTT_EVENT // Support trigger event with MQTT subscriptions (+3k5 code) // -- Optional modules ---------------------------- +//#define ROTARY_V1 // Add support for MI Desk Lamp +#define USE_SONOFF_RF // Add support for Sonoff Rf Bridge (+3k2 code) + #define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+2k7 code) #define USE_SONOFF_SC // Add support for Sonoff Sc (+1k1 code) -#define USE_BUZZER // Add support for a buzzer (+0k6 code) -#define USE_SONOFF_IFAN // Add support for Sonoff iFan02 and iFan03 (+2k code) #define USE_TUYA_MCU // Add support for Tuya Serial MCU #define TUYA_DIMMER_ID 0 // Default dimmer Id #define USE_ARMTRONIX_DIMMERS // Add support for Armtronix Dimmers (+1k4 code) #define USE_PS_16_DZ // Add support for PS-16-DZ Dimmer and Sonoff L1 (+2k code) -//#define ROTARY_V1 // Add support for MI Desk Lamp +#define USE_SONOFF_IFAN // Add support for Sonoff iFan02 and iFan03 (+2k code) +#define USE_BUZZER // Add support for a buzzer (+0k6 code) +#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) //#define USE_SHUTTER // Add Shutter support for up to 4 shutter with different motortypes (+6k code) //#define USE_DEEPSLEEP // Add support for deepsleep (+1k code) @@ -523,17 +526,12 @@ // ------------------------------------------------ -#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) - #define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code) //#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code) #define USE_HX711 // Add support for HX711 load cell (+1k5 code) // #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code) -#define USE_RF_BRIDGE // Add support for Rf Bridge -#define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+3k code) - //#define USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k code) //#define USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code, 460 iram) diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index eceb972a0..c25b961c3 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -602,6 +602,10 @@ char* ToHex_P(const unsigned char * in, size_t insz, char * out, size_t outsz, c #undef NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions) #endif +#ifndef USE_SONOFF_RF +#undef USE_RF_FLASH // Disable RF firmware flash when SOnoff Rf is disabled +#endif + #ifndef SWITCH_MODE #define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state) #endif diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index e51f13663..3061ae366 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -775,9 +775,9 @@ const uint8_t kModuleNiceList[] PROGMEM = { SONOFF_IFAN02, // Sonoff Fan SONOFF_IFAN03, #endif -#ifdef USE_RF_BRIDGE +#ifdef USE_SONOFF_RF SONOFF_BRIDGE, // Sonoff Bridge -#endif +#endif SONOFF_SV, // Sonoff Development Devices SONOFF_DEV, CH1, // Relay Devices diff --git a/sonoff/support_features.ino b/sonoff/support_features.ino index 99ad95f21..0589433f7 100644 --- a/sonoff/support_features.ino +++ b/sonoff/support_features.ino @@ -448,28 +448,28 @@ void GetFeatures(void) feature5 |= 0x00000020; // xdrv_25_A4988.ino #endif #ifdef USE_DDS2382 - feature5 |= 0x00000040; // Xnrg_09_dds2382.ino + feature5 |= 0x00000040; // xnrg_09_dds2382.ino #endif #ifdef USE_SM2135 - feature5 |= 0x00000080; // Xdrv_026_sm2135.ino + feature5 |= 0x00000080; // xdrv_026_sm2135.ino #endif #ifdef USE_SHUTTER - feature5 |= 0x00000100; // Xdrv_027_shutter.ino + feature5 |= 0x00000100; // xdrv_027_shutter.ino #endif #ifdef USE_PCF8574 - feature5 |= 0x00000200; // Xdrv_028_pcf8574.ino + feature5 |= 0x00000200; // xdrv_028_pcf8574.ino #endif #ifdef USE_DDSU666 - feature5 |= 0x00000400; // Xnrg_11_ddsu666.ino + feature5 |= 0x00000400; // xnrg_11_ddsu666.ino #endif #ifdef USE_DEEPSLEEP - feature5 |= 0x00000800; // Xdrv_029_deepsleep.ino + feature5 |= 0x00000800; // xdrv_029_deepsleep.ino #endif #ifdef USE_SONOFF_SC - feature5 |= 0x00001000; + feature5 |= 0x00001000; // xsns_04_snfsc.ino #endif -#ifdef USE_RF_BRIDGE - feature5 |= 0x00002000; +#ifdef USE_SONOFF_RF + feature5 |= 0x00002000; // xdrv_06_snfbridge.ino #endif // feature5 |= 0x00004000; // feature5 |= 0x00008000; diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index a40564d47..474ce1289 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -91,7 +91,6 @@ const char HTTP_SCRIPT_COUNTER[] PROGMEM = "}" "wl(u);"; - const char HTTP_SCRIPT_ROOT[] PROGMEM = #ifdef USE_SCRIPT_WEB_DISPLAY "var rfsh=1;" @@ -1046,7 +1045,7 @@ void HandleRoot(void) #endif // USE_SONOFF_IFAN WSContentSend_P(PSTR("")); } -#ifdef USE_RF_BRIDGE +#ifdef USE_SONOFF_RF if (SONOFF_BRIDGE == my_module_type) { WSContentSend_P(HTTP_TABLE100); WSContentSend_P(PSTR("")); @@ -1060,8 +1059,8 @@ void HandleRoot(void) } WSContentSend_P(PSTR("")); } -#endif // USE_RF_BRIDGE - +#endif // USE_SONOFF_RF + #ifndef FIRMWARE_MINIMAL XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON); XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON); @@ -1139,12 +1138,13 @@ bool HandleRootStatusRefresh(void) } } #endif // USE_SHUTTER +#ifdef USE_SONOFF_RF WebGetArg("k", tmp, sizeof(tmp)); // 1 - 16 Pre defined RF keys if (strlen(tmp)) { snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_RFKEY "%s"), tmp); ExecuteWebCommand(svalue, SRC_WEBGUI); } - +#endif // USE_SONOFF_RF WSContentBegin(200, CT_HTML); WSContentSend_P(PSTR("{t}")); XsnsCall(FUNC_WEB_SENSOR); @@ -2102,7 +2102,7 @@ void HandleUploadLoop(void) Web.config_block_count = 0; } else { -#if (defined (USE_RF_FLASH) && defined(USE_RF_BRIDGE)) +#ifdef USE_RF_FLASH if ((SONOFF_BRIDGE == my_module_type) && (upload.buf[0] == ':')) { // Check if this is a RF bridge FW file Update.end(); // End esp8266 update session Web.upload_file_type = UPL_EFM8BB1; diff --git a/sonoff/xdrv_06_snfbridge.ino b/sonoff/xdrv_06_snfbridge.ino index 7afb5b450..fbd7a344a 100644 --- a/sonoff/xdrv_06_snfbridge.ino +++ b/sonoff/xdrv_06_snfbridge.ino @@ -17,12 +17,11 @@ along with this program. If not, see . */ +#ifdef USE_SONOFF_RF /*********************************************************************************************\ Sonoff RF Bridge 433 \*********************************************************************************************/ -#ifdef USE_RF_BRIDGE - #define XDRV_06 6 const uint32_t SFB_TIME_AVOID_DUPLICATE = 2000; // Milliseconds @@ -587,4 +586,4 @@ bool Xdrv06(uint8_t function) return result; } -#endif // USE_RF_BRIDGE +#endif // USE_SONOFF_RF diff --git a/tools/decode-status.py b/tools/decode-status.py index 04caaeae6..92437b864 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -172,7 +172,7 @@ a_features = [[ "USE_BUZZER","USE_RDM6300","USE_IBEACON","USE_SML_M", "USE_INA226","USE_A4988_Stepper","USE_DDS2382","USE_SM2135", "USE_SHUTTER","USE_PCF8574","USE_DDSU666","USE_DEEPSLEEP", - "USE_SONOFF_SC","USE_RF_BRIDGE","","", + "USE_SONOFF_SC","USE_SONOFF_RF","","", "","","","", "","","","", "","","","",