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 support for the SM16716 RGB LED controller #4991

Merged
merged 35 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c6ddba8
Started SM16716 support
gsimon75 Jan 19, 2019
5537383
sm16716 works via mqtt
gsimon75 Jan 19, 2019
d9e0e9f
Added missing definitions to Greek localisation header
gsimon75 Jan 20, 2019
f833dd0
Enabled 'warm white' pwm in the module config, code comments added, c…
gsimon75 Jan 21, 2019
a770f54
misplaced #endif fixed
gsimon75 Jan 29, 2019
e0033fb
Merge branch 'development' into sm16716
gsimon75 Jan 29, 2019
e2d8040
Type changed from boolean to bool applied to xdrv_20_sm16716.ino as well
gsimon75 Jan 30, 2019
3a43050
Integrated Gabor's SM16716 code into the light driver code
kueblc Jan 30, 2019
fa7440f
Allow PWM while SM16716 is enabled, for mixed control devices
kueblc Jan 30, 2019
ec984ab
Fixed compiler errors
kueblc Jan 30, 2019
adcfeea
Fixed bug in web config page caused by merge from dev
kueblc Jan 30, 2019
4b6ddfb
Moved PWM control to its own block while using SM16716 to skip RGB va…
kueblc Jan 30, 2019
f60dd3c
Moved pin mode selection for sm16716 out of init function
kueblc Jan 30, 2019
1c76991
Added sm16716 select to the pin definitions
kueblc Jan 31, 2019
04f1ed1
Implemented sm16716 select
kueblc Jan 31, 2019
b553b4a
Merge pull request #1 from kueblc/sm16716
gsimon75 Feb 1, 2019
bbce19a
Merge branch 'development' into sm16716
gsimon75 Feb 1, 2019
ef40aff
Added SM16716_SEL pin to SYF05 template, enabled SM16716 support
gsimon75 Feb 1, 2019
737cd7a
Merge branch 'sm16716' of https://github.com/gsimon75/Sonoff-Tasmota …
gsimon75 Feb 1, 2019
25856c3
Track sm16716 select pin state so we don't waste cycles continuously …
kueblc Feb 1, 2019
99b0278
Fixed first color command failing; need to wait for chip to power up
kueblc Feb 1, 2019
817d0af
No need (and pointless) to call SM16716_Init until color updates, iff…
kueblc Feb 1, 2019
6d19a9c
Generalize the SYF05 a tiny bit so it can be easily adapted to simila…
kueblc Feb 2, 2019
d7b8a64
Added preprocessor constant for LT_SM16716 for improved code readability
kueblc Feb 2, 2019
35060df
Measured impact of USE_SM16716 on binary filesize
kueblc Feb 2, 2019
3d13490
Merge pull request #2 from kueblc/sm16716
gsimon75 Feb 2, 2019
654826f
Merge branch 'development' into sm16716
gsimon75 Feb 3, 2019
e23d420
Merge branch 'development' into sm16716
gsimon75 Feb 4, 2019
9b3a204
Merge branch 'development' into sm16716
gsimon75 Feb 4, 2019
1bf7d32
Renamed SM16716 Select to SM16716 Enable to avoid confusion with a SM…
kueblc Feb 6, 2019
4dc4f38
Added USE_SM16716 to the feature list
kueblc Feb 4, 2019
982c730
Merge pull request #3 from kueblc/sm16716
gsimon75 Feb 7, 2019
7b93df4
Merge branch 'development' into sm16716
gsimon75 Feb 8, 2019
f1247a6
Renamed SM16716 PWR as per https://github.com/arendst/Sonoff-Tasmota/…
kueblc Feb 8, 2019
0eda4c6
Merge pull request #4 from kueblc/sm16716
gsimon75 Feb 8, 2019
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
3 changes: 3 additions & 0 deletions sonoff/language/bg-BG.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/cs-CZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/de-DE.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/el-GR.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/en-GB.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/es-AR.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/fr-FR.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/he-HE.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/hu-HU.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/it-IT.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/nl-NL.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/pl-PL.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/pt-BR.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/pt-PT.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/ru-RU.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "А"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/sk-SK.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/sv-SE.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/tr-TR.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/uk-UK.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "А"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/zh-CN.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "安"
Expand Down
3 changes: 3 additions & 0 deletions sonoff/language/zh-TW.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@
#define D_SENSOR_MAX31855_CS "MAX31855 CS"
#define D_SENSOR_MAX31855_CLK "MAX31855 CLK"
#define D_SENSOR_MAX31855_DO "MAX31855 DO"
#define D_SENSOR_SM16716_CLK "SM16716 CLK"
#define D_SENSOR_SM16716_DAT "SM16716 DAT"
#define D_SENSOR_SM16716_SEL "SM16716 SEL"

// Units
#define D_UNIT_AMPERE "安"
Expand Down
2 changes: 2 additions & 0 deletions sonoff/my_user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@
// #define USE_THEO_V2 // Add support for decoding Theo V2 sensors as documented on https://sidweb.nl using 434MHz RF sensor receiver (+1k4 code)
// #define USE_ALECTO_V2 // Add support for decoding Alecto V2 sensors like ACH2010, WS3000 and DKW2012 weather stations using 868MHz RF sensor receiver (+1k7 code)

#define USE_SM16716 // Add support for SM16716 RGB LED controller (+0k7 code)

/*********************************************************************************************\
* Debug features are only supported in development branch
\*********************************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions sonoff/sonoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ typedef unsigned long power_t; // Power (Relay) type
#define NEO_RGBW 5 // Neopixel RGBW leds
#define NEO_GRBW 6 // Neopixel GRBW leds

#define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type

#define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library
#define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete
#define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete but define is present for debugging purposes
Expand Down
6 changes: 6 additions & 0 deletions sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,12 @@ void GpioInit(void)
light_type = LT_WS2812;
}
#endif // USE_WS2812
#ifdef USE_SM16716
if (SM16716_ModuleSelected()) {
light_type += 3;
light_type |= LT_SM16716;
}
#endif // ifdef USE_SM16716
if (!light_type) {
for (uint8_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only
if (pin[GPIO_PWM1 +i] < 99) {
Expand Down
40 changes: 38 additions & 2 deletions sonoff/sonoff_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ enum UserSelectablePins {
GPIO_KEY2_INV_NP,
GPIO_KEY3_INV_NP,
GPIO_KEY4_INV_NP,
GPIO_SM16716_CLK, // SM16716 CLOCK
GPIO_SM16716_DAT, // SM16716 DATA
GPIO_SM16716_SEL, // SM16716 SELECT
GPIO_SENSOR_END };

// Programmer selectable GPIO functionality offset by user selectable GPIOs
Expand Down Expand Up @@ -219,7 +222,8 @@ const char kSensorNames[] PROGMEM =
D_SENSOR_AZ_TX "|" D_SENSOR_AZ_RX "|"
D_SENSOR_MAX31855_CS "|" D_SENSOR_MAX31855_CLK "|" D_SENSOR_MAX31855_DO "|"
D_SENSOR_BUTTON "1i|" D_SENSOR_BUTTON "2i|" D_SENSOR_BUTTON "3i|" D_SENSOR_BUTTON "4i|"
D_SENSOR_BUTTON "1in|" D_SENSOR_BUTTON "2in|" D_SENSOR_BUTTON "3in|" D_SENSOR_BUTTON "4in"
D_SENSOR_BUTTON "1in|" D_SENSOR_BUTTON "2in|" D_SENSOR_BUTTON "3in|" D_SENSOR_BUTTON "4in|"
D_SENSOR_SM16716_CLK "|" D_SENSOR_SM16716_DAT "|" D_SENSOR_SM16716_SEL
;

/********************************************************************************************/
Expand Down Expand Up @@ -293,6 +297,7 @@ enum SupportedModules {
ZX2820,
MI_DESK_LAMP,
SP10,
SYF05,
MAXMODULE };

/********************************************************************************************/
Expand Down Expand Up @@ -526,6 +531,11 @@ const uint8_t kGpioNiceList[] PROGMEM = {
GPIO_MAX31855CLK, // MAX31855 Serial interface
GPIO_MAX31855DO, // MAX31855 Serial interface
#endif
#ifdef USE_SM16716
GPIO_SM16716_CLK, // SM16716 CLOCK
GPIO_SM16716_DAT, // SM16716 DATA
GPIO_SM16716_SEL, // SM16716 SELECT
#endif // USE_SM16716
};

const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
Expand Down Expand Up @@ -595,7 +605,8 @@ const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
PHILIPS,
YTF_IR_BRIDGE,
WITTY, // Development Devices
WEMOS
WEMOS,
SYF05
};

// Default module settings
Expand Down Expand Up @@ -1814,6 +1825,31 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_LED1, // GPIO13 Blue LED - Link status
GPIO_REL1, // GPIO14 Relay 1 and red LED
0, 0, 0
},
{ "SYF05", // Sunyesmart SYF05 (a.k.a. Fcmila) = TYWE3S + SM16726
// Also works with Merkury 904 RGBW Bulbs with 13 set to GPIO_SM16716_SEL
// https://www.flipkart.com/fc-mila-bxav-xs-ad-smart-bulb/p/itmf85zgs45fzr7n
// https://docs.tuya.com/en/hardware/WiFi-module/wifi-e3s-module.html
// http://www.datasheet-pdf.com/PDF/SM16716-Datasheet-Sunmoon-932771
GPIO_USER, // GPIO00 N.C.
0,
GPIO_USER, // GPIO02 N.C.
0,
GPIO_SM16716_CLK, // GPIO04 SM16716 Clock
GPIO_PWM1, // GPIO05 White
// GPIO06
// GPIO07
// GPIO08
0, // GPIO09
0, // GPIO10
// GPIO11
GPIO_USER, // GPIO12 Alt. White on some devices
GPIO_USER, // GPIO13 SM16716 Select on some devices
GPIO_SM16716_DAT, // GPIO14 SM16716 Data
0, // GPIO15 wired to GND
GPIO_USER, // GPIO16 N.C.
GPIO_FLAG_ADC0 // ADC0 A0 Analog input
// + GPIO_FLAG_PULLUP // Allow input pull-up control
}
};

Expand Down
Loading