From da8b71a6a1e764048b5897b6d402e858a85107e3 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:00:05 +0100 Subject: [PATCH 1/8] Add '.example' files. Ref: #2232, add platformio_override.ini.example and custom.h.example files. --- custom.h.example | 95 +++++++++++++++++++++++++++++++++ platformio_override.ini.example | 37 +++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 custom.h.example create mode 100644 platformio_override.ini.example diff --git a/custom.h.example b/custom.h.example new file mode 100644 index 0000000000..f6e426a776 --- /dev/null +++ b/custom.h.example @@ -0,0 +1,95 @@ +// ------------------------------------------------------------------------------ +// Example file for custom.h +// Either copy and paste this file then rename removing the .example or create your +// own file: 'custom.h' +// This file allows users to create their own configurations. +// See 'code/espurna/config/general.h' for default settings. +// +// See: https://github.com/xoseperez/espurna/wiki/Software-features#enabling-features +// and 'code/platformio_override.ini.example' for more details. +// ------------------------------------------------------------------------------ + + +// Example of a Sonoff Basic board with some options disabled to reduce firmware size. + +#if defined(MY_SONOFF_BUILD01) // This matches the 'src_build_flags = -DMY_SONOFF_BUILD01' + // in 'platformio_override.ini' + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BUILD01" + + // Disable these + #define DEBUG_SERIAL_SUPPORT 0 + #define ALEXA_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + +// Example of the Sonoff Basic board above but with two buttons on different GPIOs. +// The two buttons both toggle the one RELAY but ALL button events send MQTT values. +// An MQTT based system can then carry out differnt functions depending on +// the 'DOUBLE CLICK, LONG CLICK OR LONG-LONG CLICK' trigger. A BMX280 environment +// sensor is also connected using I2C on GPIO 1 and 3. + +#elif defined(MY_SONOFF_BUILD02) + + // Info - Custom Basic with BMX280 I2C on GPIO 1 and 3 + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BMX280" // Your own name here + + // Disable these + #define DEBUG_SERIAL_SUPPORT 0 + #define ALEXA_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 + + + // Buttons + #define BUTTON_MQTT_SEND_ALL_EVENTS 1 + #define BUTTON1_PIN 0 // Built in button. + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + #define BUTTON1_PRESS BUTTON_MODE_NONE + #define BUTTON1_CLICK BUTTON_MODE_TOGGLE + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGCLICK BUTTON_MODE_OFF + #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE + #define BUTTON2_PIN 2 // External push button connected between IO2 and GND. + #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH + #define BUTTON2_RELAY 1 + #define BUTTON2_PRESS BUTTON_MODE_NONE + #define BUTTON2_CLICK BUTTON_MODE_TOGGLE + #define BUTTON2_DBLCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + // Extras + #define BMX280_SUPPORT 1 + #define BMX280_ADDRESS 0x76 + #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + +#endif \ No newline at end of file diff --git a/platformio_override.ini.example b/platformio_override.ini.example new file mode 100644 index 0000000000..07cf9566cc --- /dev/null +++ b/platformio_override.ini.example @@ -0,0 +1,37 @@ +# ------------------------------------------------------------------------------------------------------------- +# Example file for 'platformio_override.ini' use. +# Either copy and paste this file, then rename removing the .example or create your +# own file: 'platformio_override.ini' +# 'platformio_override.ini' allows users to create their own environments to add, remove or change +# firmware configurations. +# +# See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customize-build-settings +# for more details. +# ------------------------------------------------------------------------------------------------------------- + +// Example for a standard Sonoff Basic R2 or R3 but enabling DHT support on GPIO 2. +// It can be built from VSCode/PlatformIO by selecting the 'my-sonoff-build-dht' +// build selection. + +[env:my-sonoff-build-dht] +extends = env:esp8266-1m-base +src_build_flags = -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 -DDHT_PIN=2 + + +// Example for an environment based on a 1M byte esp8266 board. E.G. Sonoff Basic R2 or R3. +// The 'extends' key can be set to 'env:esp8266-1m-latest-base' which uses +// the latest platform build version or, 'env:esp8266-1m-base' to use the default base +// platform build version. +// This example environment also uses 'code/espurna/config/custom.h' allowing a more refined configuration. +// See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customh and 'code/espurna/config/custom.h.example' + +[env:my-sonoff-build01] +extends = env:esp8266-1m-latest-base +src_build_flags = -DMY_SONOFF_BUILD01 -DUSE_CUSTOM_H + + +// Example for an environment the same as 'my-sonoff-build01' but with a different 'custom.h' configuration. + +[env:my-sonoff-build02] +extends = env:esp8266-1m-latest-base +src_build_flags = -DMY_SONOFF_BUILD02 -DUSE_CUSTOM_H \ No newline at end of file From 8c382dc8042aaeb0e21f14c99849e40a5ca16890 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:08:20 +0100 Subject: [PATCH 2/8] Delete custom.h.example --- custom.h.example | 95 ------------------------------------------------ 1 file changed, 95 deletions(-) delete mode 100644 custom.h.example diff --git a/custom.h.example b/custom.h.example deleted file mode 100644 index f6e426a776..0000000000 --- a/custom.h.example +++ /dev/null @@ -1,95 +0,0 @@ -// ------------------------------------------------------------------------------ -// Example file for custom.h -// Either copy and paste this file then rename removing the .example or create your -// own file: 'custom.h' -// This file allows users to create their own configurations. -// See 'code/espurna/config/general.h' for default settings. -// -// See: https://github.com/xoseperez/espurna/wiki/Software-features#enabling-features -// and 'code/platformio_override.ini.example' for more details. -// ------------------------------------------------------------------------------ - - -// Example of a Sonoff Basic board with some options disabled to reduce firmware size. - -#if defined(MY_SONOFF_BUILD01) // This matches the 'src_build_flags = -DMY_SONOFF_BUILD01' - // in 'platformio_override.ini' - - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_BASIC_BUILD01" - - // Disable these - #define DEBUG_SERIAL_SUPPORT 0 - #define ALEXA_SUPPORT 0 - #define DOMOTICZ_SUPPORT 0 - #define HOMEASSISTANT_SUPPORT 0 - #define THINGSPEAK_SUPPORT 0 - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 - - -// Example of the Sonoff Basic board above but with two buttons on different GPIOs. -// The two buttons both toggle the one RELAY but ALL button events send MQTT values. -// An MQTT based system can then carry out differnt functions depending on -// the 'DOUBLE CLICK, LONG CLICK OR LONG-LONG CLICK' trigger. A BMX280 environment -// sensor is also connected using I2C on GPIO 1 and 3. - -#elif defined(MY_SONOFF_BUILD02) - - // Info - Custom Basic with BMX280 I2C on GPIO 1 and 3 - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_BASIC_BMX280" // Your own name here - - // Disable these - #define DEBUG_SERIAL_SUPPORT 0 - #define ALEXA_SUPPORT 0 - #define DOMOTICZ_SUPPORT 0 - #define HOMEASSISTANT_SUPPORT 0 - #define THINGSPEAK_SUPPORT 0 - - - // Buttons - #define BUTTON_MQTT_SEND_ALL_EVENTS 1 - #define BUTTON1_PIN 0 // Built in button. - #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - #define BUTTON1_PRESS BUTTON_MODE_NONE - #define BUTTON1_CLICK BUTTON_MODE_TOGGLE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_OFF - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - #define BUTTON2_PIN 2 // External push button connected between IO2 and GND. - #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON2_RELAY 1 - #define BUTTON2_PRESS BUTTON_MODE_NONE - #define BUTTON2_CLICK BUTTON_MODE_TOGGLE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 - - // Extras - #define BMX280_SUPPORT 1 - #define BMX280_ADDRESS 0x76 - #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** - #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** - -#endif \ No newline at end of file From 52faed8e2c8006b455051a6ff732ea0c545b35f7 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:08:30 +0100 Subject: [PATCH 3/8] Delete platformio_override.ini.example --- platformio_override.ini.example | 37 --------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 platformio_override.ini.example diff --git a/platformio_override.ini.example b/platformio_override.ini.example deleted file mode 100644 index 07cf9566cc..0000000000 --- a/platformio_override.ini.example +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------------------------------------------- -# Example file for 'platformio_override.ini' use. -# Either copy and paste this file, then rename removing the .example or create your -# own file: 'platformio_override.ini' -# 'platformio_override.ini' allows users to create their own environments to add, remove or change -# firmware configurations. -# -# See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customize-build-settings -# for more details. -# ------------------------------------------------------------------------------------------------------------- - -// Example for a standard Sonoff Basic R2 or R3 but enabling DHT support on GPIO 2. -// It can be built from VSCode/PlatformIO by selecting the 'my-sonoff-build-dht' -// build selection. - -[env:my-sonoff-build-dht] -extends = env:esp8266-1m-base -src_build_flags = -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 -DDHT_PIN=2 - - -// Example for an environment based on a 1M byte esp8266 board. E.G. Sonoff Basic R2 or R3. -// The 'extends' key can be set to 'env:esp8266-1m-latest-base' which uses -// the latest platform build version or, 'env:esp8266-1m-base' to use the default base -// platform build version. -// This example environment also uses 'code/espurna/config/custom.h' allowing a more refined configuration. -// See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customh and 'code/espurna/config/custom.h.example' - -[env:my-sonoff-build01] -extends = env:esp8266-1m-latest-base -src_build_flags = -DMY_SONOFF_BUILD01 -DUSE_CUSTOM_H - - -// Example for an environment the same as 'my-sonoff-build01' but with a different 'custom.h' configuration. - -[env:my-sonoff-build02] -extends = env:esp8266-1m-latest-base -src_build_flags = -DMY_SONOFF_BUILD02 -DUSE_CUSTOM_H \ No newline at end of file From c557d0e60807d0417138fb4a36f48a8b96c16174 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:09:39 +0100 Subject: [PATCH 4/8] Add files via upload --- code/platformio_override.ini.example | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 code/platformio_override.ini.example diff --git a/code/platformio_override.ini.example b/code/platformio_override.ini.example new file mode 100644 index 0000000000..07cf9566cc --- /dev/null +++ b/code/platformio_override.ini.example @@ -0,0 +1,37 @@ +# ------------------------------------------------------------------------------------------------------------- +# Example file for 'platformio_override.ini' use. +# Either copy and paste this file, then rename removing the .example or create your +# own file: 'platformio_override.ini' +# 'platformio_override.ini' allows users to create their own environments to add, remove or change +# firmware configurations. +# +# See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customize-build-settings +# for more details. +# ------------------------------------------------------------------------------------------------------------- + +// Example for a standard Sonoff Basic R2 or R3 but enabling DHT support on GPIO 2. +// It can be built from VSCode/PlatformIO by selecting the 'my-sonoff-build-dht' +// build selection. + +[env:my-sonoff-build-dht] +extends = env:esp8266-1m-base +src_build_flags = -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 -DDHT_PIN=2 + + +// Example for an environment based on a 1M byte esp8266 board. E.G. Sonoff Basic R2 or R3. +// The 'extends' key can be set to 'env:esp8266-1m-latest-base' which uses +// the latest platform build version or, 'env:esp8266-1m-base' to use the default base +// platform build version. +// This example environment also uses 'code/espurna/config/custom.h' allowing a more refined configuration. +// See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customh and 'code/espurna/config/custom.h.example' + +[env:my-sonoff-build01] +extends = env:esp8266-1m-latest-base +src_build_flags = -DMY_SONOFF_BUILD01 -DUSE_CUSTOM_H + + +// Example for an environment the same as 'my-sonoff-build01' but with a different 'custom.h' configuration. + +[env:my-sonoff-build02] +extends = env:esp8266-1m-latest-base +src_build_flags = -DMY_SONOFF_BUILD02 -DUSE_CUSTOM_H \ No newline at end of file From a811a18866e005beab1fa9185cb04e51986f0697 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:10:17 +0100 Subject: [PATCH 5/8] Add files via upload --- code/espurna/config/custom.h.example | 95 ++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 code/espurna/config/custom.h.example diff --git a/code/espurna/config/custom.h.example b/code/espurna/config/custom.h.example new file mode 100644 index 0000000000..f6e426a776 --- /dev/null +++ b/code/espurna/config/custom.h.example @@ -0,0 +1,95 @@ +// ------------------------------------------------------------------------------ +// Example file for custom.h +// Either copy and paste this file then rename removing the .example or create your +// own file: 'custom.h' +// This file allows users to create their own configurations. +// See 'code/espurna/config/general.h' for default settings. +// +// See: https://github.com/xoseperez/espurna/wiki/Software-features#enabling-features +// and 'code/platformio_override.ini.example' for more details. +// ------------------------------------------------------------------------------ + + +// Example of a Sonoff Basic board with some options disabled to reduce firmware size. + +#if defined(MY_SONOFF_BUILD01) // This matches the 'src_build_flags = -DMY_SONOFF_BUILD01' + // in 'platformio_override.ini' + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BUILD01" + + // Disable these + #define DEBUG_SERIAL_SUPPORT 0 + #define ALEXA_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + +// Example of the Sonoff Basic board above but with two buttons on different GPIOs. +// The two buttons both toggle the one RELAY but ALL button events send MQTT values. +// An MQTT based system can then carry out differnt functions depending on +// the 'DOUBLE CLICK, LONG CLICK OR LONG-LONG CLICK' trigger. A BMX280 environment +// sensor is also connected using I2C on GPIO 1 and 3. + +#elif defined(MY_SONOFF_BUILD02) + + // Info - Custom Basic with BMX280 I2C on GPIO 1 and 3 + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BMX280" // Your own name here + + // Disable these + #define DEBUG_SERIAL_SUPPORT 0 + #define ALEXA_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 + + + // Buttons + #define BUTTON_MQTT_SEND_ALL_EVENTS 1 + #define BUTTON1_PIN 0 // Built in button. + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + #define BUTTON1_PRESS BUTTON_MODE_NONE + #define BUTTON1_CLICK BUTTON_MODE_TOGGLE + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGCLICK BUTTON_MODE_OFF + #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE + #define BUTTON2_PIN 2 // External push button connected between IO2 and GND. + #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH + #define BUTTON2_RELAY 1 + #define BUTTON2_PRESS BUTTON_MODE_NONE + #define BUTTON2_CLICK BUTTON_MODE_TOGGLE + #define BUTTON2_DBLCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + // Extras + #define BMX280_SUPPORT 1 + #define BMX280_ADDRESS 0x76 + #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + +#endif \ No newline at end of file From 1e90391d352c3c9262d15501aa96082fbdfdd1f2 Mon Sep 17 00:00:00 2001 From: davebuk Date: Tue, 19 May 2020 22:22:38 +0100 Subject: [PATCH 6/8] Update custom.h.example --- code/espurna/config/custom.h.example | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/code/espurna/config/custom.h.example b/code/espurna/config/custom.h.example index f6e426a776..3c55a95893 100644 --- a/code/espurna/config/custom.h.example +++ b/code/espurna/config/custom.h.example @@ -25,7 +25,7 @@ #define HOMEASSISTANT_SUPPORT 0 #define THINGSPEAK_SUPPORT 0 - // Buttons + // Buttons #define BUTTON1_PIN 0 #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_RELAY 1 @@ -52,28 +52,28 @@ #define DEVICE "SONOFF_BASIC_BMX280" // Your own name here // Disable these - #define DEBUG_SERIAL_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 #define ALEXA_SUPPORT 0 #define DOMOTICZ_SUPPORT 0 #define HOMEASSISTANT_SUPPORT 0 #define THINGSPEAK_SUPPORT 0 - // Buttons - #define BUTTON_MQTT_SEND_ALL_EVENTS 1 + // Buttons + #define BUTTON_MQTT_SEND_ALL_EVENTS 1 #define BUTTON1_PIN 0 // Built in button. #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_RELAY 1 - #define BUTTON1_PRESS BUTTON_MODE_NONE - #define BUTTON1_CLICK BUTTON_MODE_TOGGLE + #define BUTTON1_PRESS BUTTON_MODE_NONE + #define BUTTON1_CLICK BUTTON_MODE_TOGGLE #define BUTTON1_DBLCLICK BUTTON_MODE_NONE #define BUTTON1_LNGCLICK BUTTON_MODE_OFF #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE #define BUTTON2_PIN 2 // External push button connected between IO2 and GND. #define BUTTON2_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH #define BUTTON2_RELAY 1 - #define BUTTON2_PRESS BUTTON_MODE_NONE - #define BUTTON2_CLICK BUTTON_MODE_TOGGLE + #define BUTTON2_PRESS BUTTON_MODE_NONE + #define BUTTON2_CLICK BUTTON_MODE_TOGGLE #define BUTTON2_DBLCLICK BUTTON_MODE_NONE #define BUTTON2_LNGCLICK BUTTON_MODE_NONE #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE @@ -87,9 +87,9 @@ #define LED1_PIN_INVERSE 1 // Extras - #define BMX280_SUPPORT 1 + #define BMX280_SUPPORT 1 #define BMX280_ADDRESS 0x76 #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** -#endif \ No newline at end of file +#endif From c7e20943fecc53d613123a0e4092193a001d7ca4 Mon Sep 17 00:00:00 2001 From: davebuk Date: Wed, 20 May 2020 22:32:27 +0100 Subject: [PATCH 7/8] Update custom.h.example --- code/espurna/config/custom.h.example | 35 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/code/espurna/config/custom.h.example b/code/espurna/config/custom.h.example index 3c55a95893..30360d25bd 100644 --- a/code/espurna/config/custom.h.example +++ b/code/espurna/config/custom.h.example @@ -12,18 +12,18 @@ // Example of a Sonoff Basic board with some options disabled to reduce firmware size. -#if defined(MY_SONOFF_BUILD01) // This matches the 'src_build_flags = -DMY_SONOFF_BUILD01' - // in 'platformio_override.ini' +#if defined(MY_SONOFF_BUILD01) // This section will be used when src_build_flags contains + // -DMY_SONOFF_BUILD01 in 'platformio_override.ini' - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_BASIC_BUILD01" + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BUILD01" // Disable these - #define DEBUG_SERIAL_SUPPORT 0 - #define ALEXA_SUPPORT 0 - #define DOMOTICZ_SUPPORT 0 - #define HOMEASSISTANT_SUPPORT 0 - #define THINGSPEAK_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 + #define ALEXA_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 // Buttons #define BUTTON1_PIN 0 @@ -45,14 +45,15 @@ // the 'DOUBLE CLICK, LONG CLICK OR LONG-LONG CLICK' trigger. A BMX280 environment // sensor is also connected using I2C on GPIO 1 and 3. -#elif defined(MY_SONOFF_BUILD02) +#elif defined(MY_SONOFF_BUILD02) // This section will be used when src_build_flags contains + // -DMY_SONOFF_BUILD02 in 'platformio_override.ini // Info - Custom Basic with BMX280 I2C on GPIO 1 and 3 - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_BASIC_BMX280" // Your own name here + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_BASIC_BMX280" // You can use your own name here // Disable these - #define DEBUG_SERIAL_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 #define ALEXA_SUPPORT 0 #define DOMOTICZ_SUPPORT 0 #define HOMEASSISTANT_SUPPORT 0 @@ -87,9 +88,9 @@ #define LED1_PIN_INVERSE 1 // Extras - #define BMX280_SUPPORT 1 - #define BMX280_ADDRESS 0x76 - #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** - #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + #define BMX280_SUPPORT 1 + #define BMX280_ADDRESS 0x76 + #define I2C_SDA_PIN 1 //TX PIN **DISABLE DEBUG_SERIAL_SUPPORT** + #define I2C_SCL_PIN 3 //RX PIN **DISABLE DEBUG_SERIAL_SUPPORT** #endif From a77f64b696a5ccb7d61719d16c9211869e3b5a87 Mon Sep 17 00:00:00 2001 From: davebuk Date: Wed, 20 May 2020 22:38:30 +0100 Subject: [PATCH 8/8] Update platformio_override.ini.example --- code/platformio_override.ini.example | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/platformio_override.ini.example b/code/platformio_override.ini.example index 07cf9566cc..dafb0bd345 100644 --- a/code/platformio_override.ini.example +++ b/code/platformio_override.ini.example @@ -9,29 +9,29 @@ # for more details. # ------------------------------------------------------------------------------------------------------------- -// Example for a standard Sonoff Basic R2 or R3 but enabling DHT support on GPIO 2. -// It can be built from VSCode/PlatformIO by selecting the 'my-sonoff-build-dht' -// build selection. +# Example for a standard Sonoff Basic R2 or R3 but enabling DHT support on GPIO 2. +# It can be built from VSCode/PlatformIO by selecting the 'Build: my-sonoff-build-dht' +# build selection. [env:my-sonoff-build-dht] extends = env:esp8266-1m-base src_build_flags = -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 -DDHT_PIN=2 -// Example for an environment based on a 1M byte esp8266 board. E.G. Sonoff Basic R2 or R3. -// The 'extends' key can be set to 'env:esp8266-1m-latest-base' which uses -// the latest platform build version or, 'env:esp8266-1m-base' to use the default base -// platform build version. -// This example environment also uses 'code/espurna/config/custom.h' allowing a more refined configuration. -// See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customh and 'code/espurna/config/custom.h.example' +# Example for an environment based on a 1M byte esp8266 board. E.G. Sonoff Basic R2 or R3. +# The 'extends' key can be set to 'env:esp8266-1m-latest-base' which uses +# the latest platform build version or, 'env:esp8266-1m-base' to use the default base +# platform build version. +# This example environment also uses 'code/espurna/config/custom.h' allowing a more refined configuration. +# See: https://github.com/xoseperez/espurna/wiki/PlatformIO#customh and 'code/espurna/config/custom.h.example' [env:my-sonoff-build01] extends = env:esp8266-1m-latest-base src_build_flags = -DMY_SONOFF_BUILD01 -DUSE_CUSTOM_H -// Example for an environment the same as 'my-sonoff-build01' but with a different 'custom.h' configuration. +# Example for an environment the same as 'my-sonoff-build01' but with a different 'custom.h' configuration. [env:my-sonoff-build02] extends = env:esp8266-1m-latest-base -src_build_flags = -DMY_SONOFF_BUILD02 -DUSE_CUSTOM_H \ No newline at end of file +src_build_flags = -DMY_SONOFF_BUILD02 -DUSE_CUSTOM_H