Browse Source

Merge branch 'dev' into params-in-general-h

rfm69
Xose Pérez 6 years ago
committed by GitHub
parent
commit
b6362b2127
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 129 additions and 30 deletions
  1. +6
    -4
      README.md
  2. +1
    -1
      code/build.sh
  3. +4
    -2
      code/espurna/config/arduino.h
  4. +5
    -0
      code/espurna/config/general.h
  5. +39
    -3
      code/espurna/config/hardware.h
  6. +12
    -14
      code/espurna/light.ino
  7. +10
    -2
      code/espurna/migrate.ino
  8. +52
    -4
      code/platformio.ini
  9. BIN
      images/devices/arniex-swifitch.jpg
  10. BIN
      images/devices/generic-dht11-10.jpg
  11. BIN
      images/devices/generic-ds18b20-10.jpg
  12. BIN
      images/devices/generic-relay-40.jpg
  13. BIN
      images/devices/generic-rgbled-10.jpg
  14. BIN
      images/devices/ike-espike.jpg
  15. BIN
      images/devices/itead-sonoff-basic-2.jpg
  16. BIN
      images/devices/swifitch.png
  17. BIN
      images/devices/yjzk-2gang-switch.jpg

+ 6
- 4
README.md View File

@ -215,8 +215,8 @@ Here is the list of supported hardware. For more information please refer to the
|**Maxcio W-US002S**|**HEYGO HY02**|**YiDian XS-SSA05**|
|![WiOn 50055](images/devices/wion-50055.jpg)|![LINGAN SWA1](images/devices/lingan-swa1.jpg)|![Tonbux PowerStrip02](images/devices/tonbux-powerstrip02.jpg)|
|**WiOn 50055**|**LINGAN SWA1**|**Tonbux PowerStrip02**
|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![Swifitch](images/devices/swifitch.png)|
|**Itead Sonoff Touch**|**Itead Sonoff T1**|Swifitch|
|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![YJZK 2-gang switch](images/devices/yjzk-2gang-switch.jpg)|
|**Itead Sonoff Touch**|**Itead Sonoff T1**|**YJZK 2-gang switch**|
|![Itead Slampher](images/devices/itead-slampher.jpg)|||
|**Itead Slampher**|||
|![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)|
@ -235,10 +235,12 @@ Here is the list of supported hardware. For more information please refer to the
|**Jan Goedeke Wifi Relay (NO/NC)**|**Jorge García Wifi + Relays Board Kit**|**EXS Wifi Relay v3.1**|
|![ManCaveMade ESP-Live](images/devices/mancavemade-esp-live.jpg)|![Wemos D1 Mini Relay Shield](images/devices/wemos-d1-mini-relayshield.jpg)|![Witty Cloud](images/devices/witty-cloud.jpg)|
|**ManCaveMade ESP-Live**|**Wemos D1 Mini Relay Shield**|**Witty Cloud**|
|![IKE ESPike](images/devices/ike-espike.jpg)||![Arniex Swifitch](images/devices/arniex-swifitch.jpg)|
|**IKE ESPike**|**STM_RELAY**|**Arniex Swifitch**|
|![Heltec Touch Relay](images/devices/heltec-touch-relay.jpg)|![Generic Relay v4.0](images/devices/generic-relay-40.jpg)|![Generic RGBLed v1.0](images/devices/generic-rgbled-10.jpg)|
|**Heltec Touch Relay**|**Generic Relay v4.0**|**Generic RGBLed v1.0**|
|||
|**YJZK 2-gang switch**|**STM_RELAY**||
|![Generic DHT11 v1.0](images/devices/generic-dht11-10.jpg)|![Generic DS18B20 v1.0](images/devices/generic-ds18b20-10.jpg)||
|**Generic DHT11 v1.0**|**Generic DS18B20 v1.0**||
**Other supported boards:**
*TODO*


+ 1
- 1
code/build.sh View File

@ -64,7 +64,7 @@ echo "Building firmware images..."
mkdir -p ../firmware/espurna-$version
for environment in $environments; do
echo "* espurna-$version-$environment.bin"
platformio run --silent --environment $environment || break
platformio run --silent --environment $environment || exit 1
mv .pioenvs/$environment/firmware.bin ../firmware/espurna-$version/espurna-$version-$environment.bin
done
echo "--------------------------------------------------------------"


+ 4
- 2
code/espurna/config/arduino.h View File

@ -72,8 +72,10 @@
//#define GREEN_ESP8266RELAY
//#define IKE_ESPIKE
//#define ARNIEX_SWIFITCH
//#define GENERIC_ESP01SRELAY40
//#define GENERIC_ESP01SRGBLED10
//#define GENERIC_ESP01S_RELAY_V40
//#define GENERIC_ESP01S_RGBLED_V10
//#define GENERIC_ESP01S_DHT11_V10
//#define GENERIC_ESP01S_DS18B20_V10
//#define HELTEC_TOUCHRELAY
//--------------------------------------------------------------------------------


+ 5
- 0
code/espurna/config/general.h View File

@ -933,6 +933,11 @@ PROGMEM const char* const custom_reset_string[] = {
#define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
#endif
#ifndef LIGHT_WHITE_FACTOR
#define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
// this factor is used to scale the white channel to match brightness
#endif
#ifndef LIGHT_USE_TRANSITIONS
#define LIGHT_USE_TRANSITIONS 1 // Transitions between colors


+ 39
- 3
code/espurna/config/hardware.h View File

@ -636,6 +636,7 @@
#define MY92XX_DCKI_PIN 14
#define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT
#define MY92XX_MAPPING 4, 3, 5, 0, 1
#define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1
#elif defined(ITEAD_SONOFF_LED)
@ -1223,7 +1224,7 @@
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// DB18B20
// DS18B20
#ifndef DALLAS_SUPPORT
#define DALLAS_SUPPORT 1
#endif
@ -1829,7 +1830,7 @@
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01SRELAY40)
#elif defined(GENERIC_ESP01S_RELAY_V40)
// Info
#define MANUFACTURER "GENERIC"
@ -1848,7 +1849,7 @@
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01SRGBLED10)
#elif defined(GENERIC_ESP01S_RGBLED_V10)
// Info
#define MANUFACTURER "GENERIC"
@ -1866,6 +1867,41 @@
// LEDs
#define LED1_PIN 2
// -----------------------------------------------------------------------------
// ESP-01S DHT11 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01S_DHT11_V10)
// Info
#define MANUFACTURER "GENERIC"
#define DEVICE "ESP01S_DHT11_10"
// DHT11
#ifndef DHT_SUPPORT
#define DHT_SUPPORT 1
#endif
#define DHT_PIN 2
// -----------------------------------------------------------------------------
// ESP-01S DS18B20 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
// -----------------------------------------------------------------------------
#elif defined(GENERIC_ESP01S_DS18B20_V10)
// Info
#define MANUFACTURER "GENERIC"
#define DEVICE "ESP01S_DS18B20_10"
// DB18B20
#ifndef DALLAS_SUPPORT
#define DALLAS_SUPPORT 1
#endif
#define DALLAS_PIN 2
// -----------------------------------------------------------------------------
// Heltec Touch Relay
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay


+ 12
- 14
code/espurna/light.ino View File

@ -89,30 +89,28 @@ void _generateBrightness() {
// Convert RGB to RGBW
if (_light_has_color && _light_use_white) {
unsigned char white, max_in, max_out;
double factor = 0;
white = std::min(_light_channel[0].inputValue, std::min(_light_channel[1].inputValue, _light_channel[2].inputValue));
max_in = std::max(_light_channel[0].inputValue, std::max(_light_channel[1].inputValue, _light_channel[2].inputValue));
// Substract the common part from RGB channels and add it to white channel. So [250,150,50] -> [200,100,0,50
unsigned char white = std::min(_light_channel[0].inputValue, std::min(_light_channel[1].inputValue, _light_channel[2].inputValue));
for (unsigned int i=0; i < 3; i++) {
_light_channel[i].value = _light_channel[i].inputValue - white;
}
_light_channel[3].value = white;
max_out = std::max(std::max(_light_channel[0].value, _light_channel[1].value), std::max(_light_channel[2].value, _light_channel[3].value));
if (max_out > 0) {
factor = (double) (max_in / max_out);
}
_light_channel[3].inputValue = 0;
// Scale up to equal input values. So [250,150,50] -> [200,100,0,50] -> [250, 125, 0, 63]
unsigned char max_in = std::max(_light_channel[0].inputValue, std::max(_light_channel[1].inputValue, _light_channel[2].inputValue));
unsigned char max_out = std::max(std::max(_light_channel[0].value, _light_channel[1].value), std::max(_light_channel[2].value, _light_channel[3].value));
double factor = (max_out > 0) ? (double) (max_in / max_out) : 0;
for (unsigned int i=0; i < 4; i++) {
_light_channel[i].value = round((double) _light_channel[i].value * factor * brightness);
}
// Don't apply brightness, it is already in the inputValue:
if (_light_channel.size() == 5) {
_light_channel[4].value = _light_channel[4].inputValue;
// Scale white channel to match brightness
_light_channel[3].value = constrain(_light_channel[3].value * LIGHT_WHITE_FACTOR, 0, 255);
// For the rest of channels, don't apply brightness, it is already in the inputValue:
for (unsigned char i=4; i < _light_channel.size(); i++) {
_light_channel[i].value = _light_channel[i].inputValue;
}
} else {


+ 10
- 2
code/espurna/migrate.ino View File

@ -859,7 +859,7 @@ void migrate() {
setSetting("relayGPIO", 0, 5);
setSetting("relayType", 0, RELAY_TYPE_INVERSE);
#elif defined(GENERIC_ESP01SRELAY40)
#elif defined(GENERIC_ESP01S_RELAY_V40)
setSetting("board", 65);
setSetting("ledGPIO", 0, 2);
@ -867,7 +867,7 @@ void migrate() {
setSetting("relayGPIO", 0, 0);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(GENERIC_ESP01SRGBLED10)
#elif defined(GENERIC_ESP01S_RGBLED_V10)
setSetting("board", 66);
setSetting("ledGPIO", 0, 2);
@ -880,6 +880,14 @@ void migrate() {
setSetting("relayGPIO", 0, 12);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(GENERIC_ESP01S_DHT11_V10)
setSetting("board", 68);
#elif defined(GENERIC_ESP01S_DS18B20_V10)
setSetting("board", 69);
#else
// Allow users to define new settings without migration config


+ 52
- 4
code/platformio.ini View File

@ -1881,7 +1881,7 @@ board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRELAY40
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RELAY_V40
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
@ -1892,7 +1892,7 @@ board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRELAY40
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RELAY_V40
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
@ -1905,7 +1905,7 @@ board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRGBLED10
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RGBLED_V10
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
@ -1916,7 +1916,55 @@ board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01SRGBLED10
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_RGBLED_V10
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-dht11-10]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DHT11_V10
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-dht11-10-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DHT11_V10
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-ds18b20-10]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DS18B20_V10
monitor_baud = 115200
extra_scripts = ${common.extra_scripts}
[env:generic-esp01s-ds18b20-10-ota]
platform = ${common.platform}
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DGENERIC_ESP01S_DS18B20_V10
upload_speed = 115200
upload_port = "${env.ESPURNA_IP}"
upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266


BIN
images/devices/arniex-swifitch.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 34 KiB

BIN
images/devices/generic-dht11-10.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 18 KiB

BIN
images/devices/generic-ds18b20-10.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 18 KiB

BIN
images/devices/generic-relay-40.jpg View File

Before After
Width: 550  |  Height: 550  |  Size: 44 KiB Width: 400  |  Height: 400  |  Size: 27 KiB

BIN
images/devices/generic-rgbled-10.jpg View File

Before After
Width: 500  |  Height: 500  |  Size: 51 KiB Width: 400  |  Height: 400  |  Size: 35 KiB

BIN
images/devices/ike-espike.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 22 KiB

BIN
images/devices/itead-sonoff-basic-2.jpg View File

Before After
Width: 800  |  Height: 600  |  Size: 251 KiB

BIN
images/devices/swifitch.png View File

Before After
Width: 3356  |  Height: 2780  |  Size: 321 KiB

BIN
images/devices/yjzk-2gang-switch.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 8.3 KiB

Loading…
Cancel
Save