diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index d497605d4..c1845b540 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -308,6 +308,7 @@ // #define SUPPORT_MQTT_EVENT // Support trigger event with MQTT subscriptions (+3k5 code) // -- Optional modules ---------------------------- +#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 diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 26030c107..f3bd8bed0 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1211,6 +1211,7 @@ void SerialInput(void) } } +#ifdef USE_SONOFF_SC /*-------------------------------------------------------------------------------------------*\ * Sonoff SC 19200 baud serial interface \*-------------------------------------------------------------------------------------------*/ @@ -1222,11 +1223,11 @@ void SerialInput(void) Serial.flush(); return; } - } - + } else +#endif // USE_SONOFF_SC /*-------------------------------------------------------------------------------------------*/ - else if (!Settings.flag.mqtt_serial && (serial_in_byte == '\n')) { + if (!Settings.flag.mqtt_serial && (serial_in_byte == '\n')) { serial_in_buffer[serial_in_byte_counter] = 0; // Serial data completed seriallog_level = (Settings.seriallog_level < LOG_LEVEL_INFO) ? (uint8_t)LOG_LEVEL_INFO : Settings.seriallog_level; AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), serial_in_buffer); @@ -1400,11 +1401,13 @@ void GpioInit(void) devices_present = 4; baudrate = 19200; } +#ifdef USE_SONOFF_SC else if (SONOFF_SC == my_module_type) { Settings.flag.mqtt_serial = 0; devices_present = 0; baudrate = 19200; } +#endif // USE_SONOFF_SC if (!light_type) { for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 92ae9fd19..27532404f 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -768,7 +768,9 @@ const uint8_t kModuleNiceList[] PROGMEM = { #endif SONOFF_B1, // Sonoff Light Bulbs SLAMPHER, +#ifdef USE_SONOFF_SC SONOFF_SC, // Sonoff Environmemtal Sensor +#endif #ifdef USE_SONOFF_IFAN SONOFF_IFAN02, // Sonoff Fan SONOFF_IFAN03, diff --git a/sonoff/support_features.ino b/sonoff/support_features.ino index c3cba6874..3e92d7a93 100644 --- a/sonoff/support_features.ino +++ b/sonoff/support_features.ino @@ -465,8 +465,9 @@ void GetFeatures(void) #ifdef USE_DEEPSLEEP feature5 |= 0x00000800; // Xdrv_029_deepsleep.ino #endif - -// feature5 |= 0x00001000; +#ifdef USE_SONOFF_SC + feature5 |= 0x00001000; +#endif // feature5 |= 0x00002000; // feature5 |= 0x00004000; // feature5 |= 0x00008000; diff --git a/sonoff/xsns_04_snfsc.ino b/sonoff/xsns_04_snfsc.ino index 6d974e9f4..98e842c76 100644 --- a/sonoff/xsns_04_snfsc.ino +++ b/sonoff/xsns_04_snfsc.ino @@ -17,6 +17,7 @@ along with this program. If not, see . */ +#ifdef USE_SONOFF_SC /*********************************************************************************************\ Sonoff Sc @@ -173,3 +174,5 @@ bool Xsns04(uint8_t function) } return result; } + +#endif // USE_SONOFF_SC diff --git a/tools/decode-status.py b/tools/decode-status.py index f5fd3a2cf..0e7c75204 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","","","", "","","","", "","","","", "","","","",