Browse Source

Fix support for Sonoff B1

fastled
Xose Pérez 7 years ago
parent
commit
7dc4eeca84
4 changed files with 16 additions and 14 deletions
  1. +3
    -3
      code/espurna/config/general.h
  2. +4
    -2
      code/espurna/config/hardware.h
  3. +6
    -6
      code/espurna/light.ino
  4. +3
    -3
      code/platformio.ini

+ 3
- 3
code/espurna/config/general.h View File

@ -16,7 +16,7 @@
// Serial debug log
#ifndef DEBUG_SERIAL_SUPPORT
#define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
#define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
#endif
#ifndef DEBUG_PORT
#define DEBUG_PORT Serial // Default debugging port
@ -26,10 +26,10 @@
// UDP debug log
// To receive the message son the destination computer use nc:
// nc -ul 8111
// nc -ul 8113
#ifndef DEBUG_UDP_SUPPORT
#define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
#define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
#endif
#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
#define DEBUG_UDP_PORT 8113


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

@ -435,9 +435,10 @@
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
#define DUMMY_RELAY_COUNT 1
#define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15
#define MY9291_DI_PIN 12
#define MY9291_DCKI_PIN 14
#define MY9291_COMMAND MY9291_COMMAND_DEFAULT
#define MY9291_CHANNELS 5
#elif defined(ITEAD_SONOFF_LED)
@ -606,6 +607,7 @@
#define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15
#define MY9291_COMMAND MY9291_COMMAND_DEFAULT
#define MY9291_CHANNELS 4
// -----------------------------------------------------------------------------
// LED Controller


+ 6
- 6
code/espurna/light.ino View File

@ -235,7 +235,8 @@ void _lightProviderUpdate() {
unsigned int green = _toPWM(1) * ratio;
unsigned int blue = _toPWM(2) * ratio;
unsigned int white = _toPWM(3) * ratio;
_my9291->setColor((my9291_color_t) { red, green, blue, white });
unsigned int warm = _toPWM(4) * ratio;
_my9291->setColor((my9291_color_t) { red, green, blue, white, warm });
_my9291->setState(true);
} else {
@ -533,11 +534,10 @@ void _lightAPISetup() {
void lightSetup() {
#if LIGHT_PROVIDER == LIGHT_PROVIDER_MY9192
_my9291 = new my9291(MY9291_DI_PIN, MY9291_DCKI_PIN, MY9291_COMMAND);
_channels.push_back((channel_t) {0, false, 0});
_channels.push_back((channel_t) {0, false, 0});
_channels.push_back((channel_t) {0, false, 0});
_channels.push_back((channel_t) {0, false, 0});
_my9291 = new my9291(MY9291_DI_PIN, MY9291_DCKI_PIN, MY9291_COMMAND, MY9291_CHANNELS);
for (unsigned char i=0; i<MY9291_CHANNELS; i++) {
_channels.push_back((channel_t) {0, false, 0});
}
#endif
#if LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER


+ 3
- 3
code/platformio.ini View File

@ -27,7 +27,7 @@ lib_deps =
https://bitbucket.org/xoseperez/nofuss.git#0.2.2
https://bitbucket.org/xoseperez/emonliteesp.git#0.1.2
https://bitbucket.org/xoseperez/debounceevent.git#2.0.1
https://github.com/xoseperez/my9291#1.0.0
https://github.com/xoseperez/my9291#2.0.0
https://github.com/xoseperez/RemoteSwitch-arduino-library.git
lib_ignore =
@ -304,7 +304,7 @@ monitor_baud = 115200
[env:itead-sonoff-b1]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
@ -314,7 +314,7 @@ monitor_baud = 115200
[env:itead-sonoff-b1-ota]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}


Loading…
Cancel
Save