mirror of https://github.com/arendst/Tasmota.git
Add support for SM2135 current selection
Add support for SM2135 current selection using GPIO ``SM2135 DAT`` index (#10634)
This commit is contained in:
parent
e120e5f122
commit
35bc095e00
|
@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
|
|||
- Support for 24/26/32/34 bit RFID Wiegand interface (D0/D1) by Sigurd Leuther (#3647)
|
||||
- Compile time option ``USE_MQTT_TLS_DROP_OLD_FINGERPRINT`` to drop old (less secure) TLS fingerprint
|
||||
- Command ``SetOption40 0..250`` to disable button functionality if activated for over 0.1 second re-introduced
|
||||
- Support for SM2135 current selection using GPIO ``SM2135 DAT`` index (#10634)
|
||||
|
||||
### Breaking Changed
|
||||
- ESP32 switch from default SPIFFS to default LittleFS file system loosing current (zigbee) files
|
||||
|
|
|
@ -80,6 +80,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||
- Support for SPI display driver for ST7789 TFT by Gerhard Mutz [#9037](https://github.com/arendst/Tasmota/issues/9037)
|
||||
- Support for time proportioned (``#define USE_TIMEPROP``) and optional PID (``#define USE_PID``) relay control [#10412](https://github.com/arendst/Tasmota/issues/10412)
|
||||
- Support for 24/26/32/34 bit RFID Wiegand interface (D0/D1) by Sigurd Leuther [#3647](https://github.com/arendst/Tasmota/issues/3647)
|
||||
- Support for SM2135 current selection using GPIO ``SM2135 DAT`` index [#10634](https://github.com/arendst/Tasmota/issues/10634)
|
||||
- Support rotary encoder on Shelly Dimmer [#10407](https://github.com/arendst/Tasmota/issues/10407#issuecomment-756240920)
|
||||
- Support character `#` to be replaced by `space`-character in command ``Publish`` topic [#10258](https://github.com/arendst/Tasmota/issues/10258)
|
||||
- Basic support for ESP32 Odroid Go 16MB binary tasmota32-odroidgo.bin [#8630](https://github.com/arendst/Tasmota/issues/8630)
|
||||
|
|
|
@ -323,7 +323,7 @@ const char kSensorNamesFixed[] PROGMEM =
|
|||
#define MAX_A4988_MSS 3
|
||||
#define MAX_WEBCAM_DATA 8
|
||||
#define MAX_WEBCAM_HSD 3
|
||||
#define MAX_SM2135_DAT 4
|
||||
#define MAX_SM2135_DAT 6
|
||||
|
||||
const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
GPIO_NONE, // Not used
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#define SM2135_55MA 0x09
|
||||
#define SM2135_60MA 0x0A
|
||||
|
||||
enum Sm2135Color { SM2135_WCGRB, SM2135_WCBGR, SM2135_WCGRBHI, SM2135_WCBGRHI };
|
||||
enum Sm2135Color { SM2135_WCGRB, SM2135_WCBGR, SM2135_WCGRBHI, SM2135_WCBGRHI, SM2135_WCGRB15W, SM2135_WCBGR15W };
|
||||
|
||||
struct SM2135 {
|
||||
uint8_t clk = 0;
|
||||
|
@ -139,7 +139,7 @@ bool Sm2135SetChannels(void) {
|
|||
uint8_t data[6];
|
||||
|
||||
uint32_t light_type = 3; // RGB and CW
|
||||
if (Sm2135.model < 2) {
|
||||
if (Sm2135.model < 2) { // Only allow one of two options due to power supply
|
||||
if ((0 == cur_col[0]) && (0 == cur_col[1]) && (0 == cur_col[2])) {
|
||||
light_type = 1; // CW only
|
||||
} else {
|
||||
|
@ -182,25 +182,35 @@ void Sm2135ModuleSelected(void)
|
|||
Sm2135.clk = Pin(GPIO_SM2135_CLK);
|
||||
Sm2135.data = Pin(GPIO_SM2135_DAT, GPIO_ANY);
|
||||
|
||||
Sm2135.model = GetPin(Sm2135.data) - AGPIO(GPIO_SM2135_DAT); // 0 .. 3
|
||||
// See #define MAX_SM2135_DAT 6 in tasmota_template.h
|
||||
Sm2135.model = GetPin(Sm2135.data) - AGPIO(GPIO_SM2135_DAT); // 0 .. 5
|
||||
|
||||
// Legacy support of model selection
|
||||
if (PinUsed(GPIO_SWT1)) {
|
||||
Sm2135.model = SM2135_WCBGR;
|
||||
pinMode(Pin(GPIO_SWT1), INPUT); // Discard GPIO_SWT functionality
|
||||
SetPin(Pin(GPIO_SWT1), AGPIO(GPIO_NONE));
|
||||
}
|
||||
|
||||
// RGB current CW current
|
||||
// SM2135 Dat 1/2
|
||||
// RGB current CW current
|
||||
Sm2135.current = (SM2135_20MA << 4) | SM2135_15MA; // See https://github.com/arendst/Tasmota/issues/6495#issuecomment-549121683
|
||||
if (Sm2135.model > SM2135_WCBGR) {
|
||||
Sm2135.current = (SM2135_20MA << 4) | SM2135_30MA;
|
||||
switch (Sm2135.model) {
|
||||
case SM2135_WCGRBHI: // SM2135 Dat 3
|
||||
case SM2135_WCBGRHI: // SM2135 Dat 4
|
||||
Sm2135.current = (SM2135_20MA << 4) | SM2135_30MA;
|
||||
break;
|
||||
case SM2135_WCGRB15W: // SM2135 Dat 5
|
||||
case SM2135_WCBGR15W: // SM2135 Dat 6
|
||||
Sm2135.current = (SM2135_45MA << 4) | SM2135_60MA;
|
||||
break;
|
||||
}
|
||||
|
||||
Sm2135Init();
|
||||
|
||||
TasmotaGlobal.light_type = LT_RGBWC;
|
||||
TasmotaGlobal.light_driver = XLGT_04;
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: SM2135 (%s-%s current) Found"),
|
||||
(SM2135_WCBGR == (Sm2135.model &1)) ? PSTR("BGR") : PSTR("GRB"), (Sm2135.model > SM2135_WCBGR) ? PSTR("High") : PSTR("Low"));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: SM2135 %s Found"), (SM2135_WCBGR == (Sm2135.model &1)) ? PSTR("BGR") : PSTR("GRB"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue