Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add '.example' files. #2257

Merged
merged 9 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions code/espurna/config/custom.h.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// ------------------------------------------------------------------------------
// 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 section will be used when src_build_flags contains
// -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) // 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" // You can use 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
37 changes: 37 additions & 0 deletions code/platformio_override.ini.example
Original file line number Diff line number Diff line change
@@ -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 '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'

[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