Make Sonoff Sc optional by define

Make Sonoff Sc optional by define (#6640)
This commit is contained in:
Theo Arends 2019-10-14 18:15:43 +02:00
parent d57153630f
commit f5b932a6d5
6 changed files with 16 additions and 6 deletions

View File

@ -308,6 +308,7 @@
// #define SUPPORT_MQTT_EVENT // Support trigger event with MQTT subscriptions (+3k5 code) // #define SUPPORT_MQTT_EVENT // Support trigger event with MQTT subscriptions (+3k5 code)
// -- Optional modules ---------------------------- // -- 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_BUZZER // Add support for a buzzer (+0k6 code)
#define USE_SONOFF_IFAN // Add support for Sonoff iFan02 and iFan03 (+2k 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 USE_TUYA_MCU // Add support for Tuya Serial MCU

View File

@ -1211,6 +1211,7 @@ void SerialInput(void)
} }
} }
#ifdef USE_SONOFF_SC
/*-------------------------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------------------------*\
* Sonoff SC 19200 baud serial interface * Sonoff SC 19200 baud serial interface
\*-------------------------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------------------------*/
@ -1222,11 +1223,11 @@ void SerialInput(void)
Serial.flush(); Serial.flush();
return; 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 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; 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); AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), serial_in_buffer);
@ -1400,11 +1401,13 @@ void GpioInit(void)
devices_present = 4; devices_present = 4;
baudrate = 19200; baudrate = 19200;
} }
#ifdef USE_SONOFF_SC
else if (SONOFF_SC == my_module_type) { else if (SONOFF_SC == my_module_type) {
Settings.flag.mqtt_serial = 0; Settings.flag.mqtt_serial = 0;
devices_present = 0; devices_present = 0;
baudrate = 19200; baudrate = 19200;
} }
#endif // USE_SONOFF_SC
if (!light_type) { if (!light_type) {
for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only

View File

@ -768,7 +768,9 @@ const uint8_t kModuleNiceList[] PROGMEM = {
#endif #endif
SONOFF_B1, // Sonoff Light Bulbs SONOFF_B1, // Sonoff Light Bulbs
SLAMPHER, SLAMPHER,
#ifdef USE_SONOFF_SC
SONOFF_SC, // Sonoff Environmemtal Sensor SONOFF_SC, // Sonoff Environmemtal Sensor
#endif
#ifdef USE_SONOFF_IFAN #ifdef USE_SONOFF_IFAN
SONOFF_IFAN02, // Sonoff Fan SONOFF_IFAN02, // Sonoff Fan
SONOFF_IFAN03, SONOFF_IFAN03,

View File

@ -465,8 +465,9 @@ void GetFeatures(void)
#ifdef USE_DEEPSLEEP #ifdef USE_DEEPSLEEP
feature5 |= 0x00000800; // Xdrv_029_deepsleep.ino feature5 |= 0x00000800; // Xdrv_029_deepsleep.ino
#endif #endif
#ifdef USE_SONOFF_SC
// feature5 |= 0x00001000; feature5 |= 0x00001000;
#endif
// feature5 |= 0x00002000; // feature5 |= 0x00002000;
// feature5 |= 0x00004000; // feature5 |= 0x00004000;
// feature5 |= 0x00008000; // feature5 |= 0x00008000;

View File

@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef USE_SONOFF_SC
/*********************************************************************************************\ /*********************************************************************************************\
Sonoff Sc Sonoff Sc
@ -173,3 +174,5 @@ bool Xsns04(uint8_t function)
} }
return result; return result;
} }
#endif // USE_SONOFF_SC

View File

@ -172,7 +172,7 @@ a_features = [[
"USE_BUZZER","USE_RDM6300","USE_IBEACON","USE_SML_M", "USE_BUZZER","USE_RDM6300","USE_IBEACON","USE_SML_M",
"USE_INA226","USE_A4988_Stepper","USE_DDS2382","USE_SM2135", "USE_INA226","USE_A4988_Stepper","USE_DDS2382","USE_SM2135",
"USE_SHUTTER","USE_PCF8574","USE_DDSU666","USE_DEEPSLEEP", "USE_SHUTTER","USE_PCF8574","USE_DDSU666","USE_DEEPSLEEP",
"","","","", "USE_SONOFF_SC","","","",
"","","","", "","","","",
"","","","", "","","","",
"","","","", "","","","",