From 5f3be7ca87804ba917aa760b63f37b0c0575e74e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 16 Jun 2019 17:03:41 +0200 Subject: [PATCH] Add define USE_DHT to my_user_config.h to save space in sonoff-basic.bin Add define USE_DHT to my_user_config.h to save space in sonoff-basic.bin --- sonoff/_changelog.ino | 1 + sonoff/my_user_config.h | 2 ++ sonoff/sonoff.h | 1 - sonoff/sonoff_post.h | 8 +++++--- sonoff/sonoff_template.h | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index e03763981..2a0b5ee10 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -4,6 +4,7 @@ * Add using heap when more than 199 IRSend values need to be send. May need increase of define MQTT_MAX_PACKET_SIZE too (#5950) * Fix channel command for dual dimmers (#5940) * Add define USE_COUNTER to my_user_config.h to save space in sonoff-basic.bin and sonoff-minimal.bin + * Add define USE_DHT to my_user_config.h to save space in sonoff-basic.bin * * 6.5.0.15 20190606 * Change pubsubclient MQTT_KEEPALIVE from 10 to 30 seconds in preparation of AWS IoT support diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index a8e54db3a..e9bff1804 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -419,6 +419,8 @@ #define USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code) // -- Low level interface devices ----------------- +#define USE_DHT // Add support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor (1k6 code) + //#define USE_MAX31855 // Add support for MAX31855 K-Type thermocouple sensor using softSPI #define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k3 code, 0k3 mem, 48 iram) diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index c0d928091..1f16467a1 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -33,7 +33,6 @@ #define CODE_IMAGE 0 #define USE_LIGHT // Enable light control -#define USE_DHT // Default DHT11 sensor needs no external library #define USE_ENERGY_SENSOR // Use energy sensors (+14k code) #define USE_HLW8012 // Use energy sensor for Sonoff Pow and WolfBlitz #define USE_CSE7766 // Use energy sensor for Sonoff S31 and Pow R2 diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index caec3fd8e..86d96df98 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -147,6 +147,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #define USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code) #define USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code) #define USE_MCP39F501 // Add support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code) +#define USE_DHT // Add support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor #define USE_MAX31855 // Add support for MAX31855 K-Type thermocouple sensor using softSPI #define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k code, 0k3 mem, 48 iram) #define USE_IR_HVAC // Support for HVAC system using IR (+2k code) @@ -217,6 +218,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_PZEM_AC // Disable PZEM014,016 Energy monitor #undef USE_PZEM_DC // Disable PZEM003,017 Energy monitor #undef USE_MCP39F501 // Disable support for MCP39F501 Energy monitor as used in Shelly 2 (+3k1 code) +#define USE_DHT // Add support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor #undef USE_MAX31855 // Disable MAX31855 K-Type thermocouple sensor using softSPI #undef USE_IR_REMOTE // Disable IR remote commands using library IRremoteESP8266 and ArduinoJson #undef USE_IR_RECEIVE // Disable support for IR receiver @@ -326,7 +328,6 @@ void KNX_CB_Action(message_t const &msg, void *arg); //#undef USE_SUNRISE // Disable support for Sunrise and sunset tools //#undef USE_RULES // Disable support for rules #undef USE_COUNTER // Disable counters -#undef USE_DHT // Disable internal DHT sensor #undef USE_DS18x20 // Disable DS18x20 sensor #undef USE_DS18x20_LEGACY // Disable DS18x20 sensor #undef USE_DS18B20 // Disable internal DS18B20 sensor @@ -350,6 +351,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_PZEM_AC // Disable PZEM014,016 Energy monitor #undef USE_PZEM_DC // Disable PZEM003,017 Energy monitor //#undef USE_MCP39F501 // Disable MCP39F501 Energy monitor as used in Shelly 2 +#undef USE_DHT // Disable support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor #undef USE_MAX31855 // Disable MAX31855 K-Type thermocouple sensor using softSPI #undef USE_IR_REMOTE // Disable IR driver #undef USE_WS2812 // Disable WS2812 Led string @@ -397,7 +399,6 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_SCRIPT // Disable support for script #undef USE_LIGHT // Disable support for lights #undef USE_COUNTER // Disable counters -#undef USE_DHT // Disable internal DHT sensor #undef USE_DS18x20 // Disable DS18x20 sensor #undef USE_DS18x20_LEGACY // Disable DS18x20 sensor #undef USE_DS18B20 // Disable internal DS18B20 sensor @@ -421,7 +422,8 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_PZEM_AC // Disable PZEM014,016 Energy monitor #undef USE_PZEM_DC // Disable PZEM003,017 Energy monitor #undef USE_MCP39F501 // Disable MCP39F501 Energy monitor as used in Shelly 2 -#undef USE_MAX31855 // DIsable MAX31855 K-Type thermocouple sensor using softSPI +#undef USE_DHT // Disable support for DHT11, AM2301 (DHT21, DHT22, AM2302, AM2321) and SI7021 Temperature and Humidity sensor +#undef USE_MAX31855 // Disable MAX31855 K-Type thermocouple sensor using softSPI #undef USE_IR_REMOTE // Disable IR driver #undef USE_WS2812 // Disable WS2812 Led string #undef USE_ARILUX_RF // Disable support for Arilux RF remote controller diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 12687f58e..5945c1fdd 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -493,9 +493,11 @@ const uint8_t kGpioNiceList[] PROGMEM = { #ifdef USE_DISPLAY GPIO_BACKLIGHT, // Display backlight control #endif +#ifdef USE_DHT GPIO_DHT11, // DHT11 GPIO_DHT22, // DHT21, DHT22, AM2301, AM2302, AM2321 GPIO_SI7021, // iTead SI7021 +#endif #if defined(USE_DS18B20) || defined(USE_DS18x20) || defined(USE_DS18x20_LEGACY) GPIO_DSB, // Single wire DS18B20 or DS18S20 #endif