diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..e04b9ac7b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,31 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**Firmware:**
+- Version [e.g. 1.14.129]
+- Device?
+- Chip/model: BK7231T?
+- Device config?
+
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/README.md b/README.md
index 319f51d8c..d971df109 100644
--- a/README.md
+++ b/README.md
@@ -244,11 +244,19 @@ if MQTTOn then "backlog led_dimmer 100; led_enableAll" else "backlog led_dimmer
| addChangeHandler Channel1 != 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20On | This will set a Tasmota HTTP Power0 ON command when a channel 1 value become non-zero |
| addChangeHandler Channel1 == 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20Off | This will set a Tasmota HTTP Power0 OFF command when a channel 1 value become zero |
| addChangeHandler Channel1 == 1 addRepeatingEvent 60 1 setChannel 1 0 | This will create a new repeating events with 1 repeat count and 60 seconds delay everytime Channel1 becomes 1. Basically, it will automatically turn off the light 60 seconds after you turn it on. TODO: clear previous event instance? |
+| addRepeatingEvent 5 -1 led_enableAll !$led_enableAll | This simple timer will toggle LED state every 5 seconds. -1 hear means infinite repeats. The ! stands for negation and $led_enableAll is a constant that you can read to get 0 or 1. It works like $CH11, $CH4 etc (any number) for accessing channel value |
+
+
+
# Console Command argument expansion
Every console command that takes an integer argument supports following constant expansion:
- $CH[CHANNEL_NUMBER] - so, $CH0 is a channel 0 value, etc, so SetChannel 1 $CH2 will get current value of Channel2 and set it to Channel 1
+- $led_enableAll - this is the state of led driver, returns 1 or 0
+- $led_hue
+- $led_saturation
+- $led_dimmer
# Example configurations (example autoexec.bat files for LittleFS system)
diff --git a/src/cmnds/cmd_newLEDDriver.c b/src/cmnds/cmd_newLEDDriver.c
index 8ce13e164..71b242fa9 100644
--- a/src/cmnds/cmd_newLEDDriver.c
+++ b/src/cmnds/cmd_newLEDDriver.c
@@ -50,6 +50,7 @@ int parsePowerArgument(const char *s);
int g_lightMode = Light_RGB;
// Those are base colors, normalized, without brightness applied
float baseColors[5] = { 255, 255, 255, 255, 255 };
+// Those have brightness included
float finalColors[5] = { 255, 255, 255, 255, 255 };
float g_hsv_h = 0; // 0 to 360
float g_hsv_s = 0; // 0 to 1
@@ -123,6 +124,77 @@ static void sendFullRGBCW_IfEnabled() {
MQTT_PublishMain_StringString_DeDuped(DEDUP_LED_FINALCOLOR_RGBCW,DEDUP_EXPIRE_TIME,"led_finalcolor_rgbcw",s, 0);
}
+float led_rawLerpCurrent[5] = { 0 };
+float Mathf_MoveTowards(float cur, float tg, float dt) {
+ float rem = tg - cur;
+ if(abs(rem) < dt) {
+ return tg;
+ }
+ if(rem < 0) {
+ return cur - dt;
+ }
+ return cur + dt;
+}
+// Colors are in 0-255 range.
+// This value determines how fast color can change.
+// 100 means that in one second color will go from 0 to 100
+// 200 means that in one second color will go from 0 to 200
+float led_lerpSpeedUnitsPerSecond = 200.f;
+
+void LED_RunQuickColorLerp(int deltaMS) {
+ int i;
+ int firstChannelIndex;
+ float deltaSeconds;
+ byte finalRGBCW[5];
+
+ deltaSeconds = deltaMS * 0.001f;
+
+ // The color order is RGBCW.
+ // some people set RED to channel 0, and some of them set RED to channel 1
+ // Let's detect if there is a PWM on channel 0
+ if(CHANNEL_HasChannelPinWithRoleOrRole(0, IOR_PWM, IOR_PWM_n)) {
+ firstChannelIndex = 0;
+ } else {
+ firstChannelIndex = 1;
+ }
+
+ for(i = 0; i < 5; i++) {
+ // This is the most silly and primitive approach, but it works
+ // In future we might implement better lerp algorithms, use HUE, etc
+ led_rawLerpCurrent[i] = Mathf_MoveTowards(led_rawLerpCurrent[i],finalColors[i], deltaSeconds * led_lerpSpeedUnitsPerSecond);
+ }
+
+ if(isCWMode() && CFG_HasFlag(OBK_FLAG_LED_ALTERNATE_CW_MODE)) {
+ // OBK_FLAG_LED_ALTERNATE_CW_MODE means we have a driver that takes one PWM for brightness and second for temperature
+
+ } else {
+ if(isCWMode()) {
+ // In CW mode, user sets just two PWMs. So we have: PWM0 and PWM1 (or maybe PWM1 and PWM2)
+ // But we still have RGBCW internally
+ // So, we need to map. Map component 3 of RGBCW to first channel, and component 4 to second.
+ CHANNEL_Set(firstChannelIndex + 0, led_rawLerpCurrent[3] * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ CHANNEL_Set(firstChannelIndex + 1, led_rawLerpCurrent[4] * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ } else {
+ // This should work for both RGB and RGBCW
+ // This also could work for a SINGLE COLOR strips
+ for(i = 0; i < 5; i++) {
+ finalRGBCW[i] = led_rawLerpCurrent[i];
+ CHANNEL_Set(firstChannelIndex + i, led_rawLerpCurrent[i] * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ }
+ }
+ }
+#ifndef OBK_DISABLE_ALL_DRIVERS
+ if(DRV_IsRunning("SM2135")) {
+ SM2135_Write(finalRGBCW);
+ }
+ if(DRV_IsRunning("BP5758D")) {
+ BP5758D_Write(finalRGBCW);
+ }
+ if(DRV_IsRunning("BP1658CJ")) {
+ BP1658CJ_Write(finalRGBCW);
+ }
+#endif
+}
void apply_smart_light() {
int i;
int firstChannelIndex;
@@ -154,8 +226,10 @@ void apply_smart_light() {
finalRGBCW[i] = baseColors[i] * g_brightness;
}
}
- CHANNEL_Set(firstChannelIndex, value_cold_or_warm, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
- CHANNEL_Set(firstChannelIndex+1, value_brightness, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ if(CFG_HasFlag(OBK_FLAG_LED_SMOOTH_TRANSITIONS) == false) {
+ CHANNEL_Set(firstChannelIndex, value_cold_or_warm, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ CHANNEL_Set(firstChannelIndex+1, value_brightness, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ }
} else {
for(i = 0; i < 5; i++) {
float raw, final;
@@ -192,31 +266,36 @@ void apply_smart_light() {
//ADDLOG_INFO(LOG_FEATURE_CMD, "apply_smart_light: ch %i raw is %f, bright %f, final %f, enableAll is %i",
// channelToUse,raw,g_brightness,final,g_lightEnableAll);
- if(isCWMode()) {
- // in CW mode, we have only set two channels
- // We don't have RGB channels
- // so, do simple mapping
- if(i == 3) {
- CHANNEL_Set(firstChannelIndex+0, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
- } else if(i == 4) {
- CHANNEL_Set(firstChannelIndex+1, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ if(CFG_HasFlag(OBK_FLAG_LED_SMOOTH_TRANSITIONS) == false) {
+ if(isCWMode()) {
+ // in CW mode, we have only set two channels
+ // We don't have RGB channels
+ // so, do simple mapping
+ if(i == 3) {
+ CHANNEL_Set(firstChannelIndex+0, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ } else if(i == 4) {
+ CHANNEL_Set(firstChannelIndex+1, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
+ }
+ } else {
+ CHANNEL_Set(channelToUse, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
}
- } else {
- CHANNEL_Set(channelToUse, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT);
}
}
}
+ if(CFG_HasFlag(OBK_FLAG_LED_SMOOTH_TRANSITIONS) == false) {
#ifndef OBK_DISABLE_ALL_DRIVERS
- if(DRV_IsRunning("SM2135")) {
- SM2135_Write(finalRGBCW);
- }
- if(DRV_IsRunning("BP5758D")) {
- BP5758D_Write(finalRGBCW);
- }
- if(DRV_IsRunning("BP1658CJ")) {
- BP1658CJ_Write(finalRGBCW);
- }
+ if(DRV_IsRunning("SM2135")) {
+ SM2135_Write(finalRGBCW);
+ }
+ if(DRV_IsRunning("BP5758D")) {
+ BP5758D_Write(finalRGBCW);
+ }
+ if(DRV_IsRunning("BP1658CJ")) {
+ BP1658CJ_Write(finalRGBCW);
+ }
#endif
+ }
+
if(CFG_HasFlag(OBK_FLAG_LED_REMEMBERLASTSTATE)) {
HAL_FlashVars_SaveLED(g_lightMode,g_brightness / g_cfg_brightnessMult, led_temperature_current,baseColors[0],baseColors[1],baseColors[2],g_lightEnableAll);
}
@@ -700,6 +779,14 @@ static int nextColor(const void *context, const char *cmd, const char *args, int
return 1;
}
+static int lerpSpeed(const void *context, const char *cmd, const char *args, int cmdFlags){
+ // Use tokenizer, so we can use variables (eg. $CH11 as variable)
+ Tokenizer_TokenizeString(args, 0);
+
+ led_lerpSpeedUnitsPerSecond = Tokenizer_GetArgFloat(0);
+
+ return 1;
+}
static int setSaturation(const void *context, const char *cmd, const char *args, int cmdFlags){
float f;
@@ -749,6 +836,7 @@ void NewLED_InitCommands(){
CMD_RegisterCommand("led_saturation", "", setSaturation, "set qqqq", NULL);
CMD_RegisterCommand("led_hue", "", setHue, "set qqqq", NULL);
CMD_RegisterCommand("led_nextColor", "", nextColor, "set qqqq", NULL);
+ CMD_RegisterCommand("led_lerpSpeed", "", lerpSpeed, "set qqqq", NULL);
}
diff --git a/src/cmnds/cmd_public.h b/src/cmnds/cmd_public.h
index ba1c994a3..bec1204c8 100644
--- a/src/cmnds/cmd_public.h
+++ b/src/cmnds/cmd_public.h
@@ -152,6 +152,7 @@ void LED_GetBaseColorString(char * s);
int LED_GetMode();
float LED_GetHue();
float LED_GetSaturation();
+void LED_RunQuickColorLerp(int deltaMS);
OBK_Publish_Result LED_SendEnableAllState();
OBK_Publish_Result LED_SendDimmerChange();
OBK_Publish_Result LED_SendCurrentLightMode();
diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c
index c1a872f8f..bacb76369 100644
--- a/src/httpserver/http_fns.c
+++ b/src/httpserver/http_fns.c
@@ -52,57 +52,75 @@ static char* HASS_QOS_CONFIG = " qos: 1\n";
static char* HASS_MQTT_NODE = "mqtt:\n";
static char* HASS_LIGHT_NODE = " light:\n";
-typedef struct template_s {
- void (*setter)();
- const char* name;
-} template_t;
-template_t g_templates[] = {
- { Setup_Device_Empty, "Empty"},
- // BK7231N devices
- { Setup_Device_BK7231N_CB2S_QiachipSmartSwitch, "[BK7231N][CB2S] QiaChip Smart Switch"},
- { Setup_Device_BK7231N_KS_602_TOUCH, "[BK7231N] KS 602 Touch Switch US"},
- { Setup_Device_Aubess_Mini_Smart_Switch_16A, "[BK7231N] Aubess Mini Smart Switch 16A"},
- // BK7231T devices
- { Setup_Device_BK7231T_WB2S_QiachipSmartSwitch, "[BK7231T][WB2S] QiaChip Smart Switch"},
- { Setup_Device_TuyaWL_SW01_16A, "WL SW01 16A"},
- { Setup_Device_TuyaSmartLife4CH10A, "Smart Life 4CH 10A"},
- { Setup_Device_IntelligentLife_NF101A, "Intelligent Life NF101A"},
- { Setup_Device_TuyaLEDDimmerSingleChannel, "Tuya LED Dimmer Single Channel PWM WB3S"},
- { Setup_Device_CalexLEDDimmerFiveChannel, "Calex RGBWW LED Dimmer Five Channel PWM BK7231S"},
- { Setup_Device_CalexPowerStrip_900018_1v1_0UK, "Calex UK power strip 900018.1 v1.0 UK"},
- { Setup_Device_ArlecCCTDownlight, "Arlec CCT LED Downlight ALD029CHA"},
- { Setup_Device_NedisWIFIPO120FWT_16A, "Nedis WIFIPO120FWT SmartPlug 16A"},
- { Setup_Device_NedisWIFIP130FWT_10A, "Nedis WIFIP130FWT SmartPlug 10A"},
- { Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK, "Prime SmartOutlet Outdoor 2x Costco"},
- { Setup_Device_EmaxHome_EDU8774, "Emax Home EDU8774 SmartPlug 16A"},
- { Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs, "Tuya E27 LED RGBCW 5PWMs BK7231N"},
- { Setup_Device_TuyaSmartPFW02G, "Tuya Smart PFW02-G"},
- { Setup_Device_AvatarASL04, "Avatar ASL04 5v LED strip"},
- { Setup_Device_BL602_MagicHome_IR_RGB_LedStrip, "BL602 Magic Home LED RGB IR Strip"},
- { Setup_Device_BL602_MagicHome_CCT_LedStrip, "BL602 Magic Home LED CCT Strip"},
- { Setup_Device_Sonoff_MiniR3, "Sonoff MiniR3"},
- { Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131, "WB2S WiFi DIY Switch ZN268131"},
- { Setup_Device_DS_102_1Gang_WB3S, "DS-102 1 Gang Switch"},
- { Setup_Device_DS_102_2Gang_WB3S, "DS-102 2 Gang Switch"},
- { Setup_Device_DS_102_3Gang_WB3S, "DS-102 3 Gang Switch"},
- { Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S, "[BK7231N][CB3S] Tuya Smart Wifi Switch 4 Gang"},
- { Setup_Device_BK7231N_CB2S_LSPA9_BL0942, "[BK7231N][CB2S] LSPA9 power metering plug BL0942 version"},
- { Setup_Device_LSC_Smart_Connect_Plug_CB2S, "[BK7231N][CB2S] LSC Smart Connect Plug"},
- { Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1, "BK7231T Gosund Smart Switch SW5-A-V2.1"},
- { Setup_Device_13A_Socket_CB2S, "BK7231N CB2S 13A Aliexpress socket"},
- { Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2, "BK7231T DETA SMART Double Power Point 6922HA-Series 2"},
- { Setup_Device_ArlecRGBCCTDownlight, "Arlec RGB+CCT LED Downlight ALD092RHA"},
- { Setup_Device_CasaLifeCCTDownlight, "CasaLife CCT LED Downlight SMART-AL2017-TGTS"},
- { Setup_Device_Enbrighten_WFD4103, "Enbrighten WFD4103 WiFi Switch BK7231T WB2S"} ,
- { Setup_Device_Zemismart_Light_Switch_KS_811_3, "Zemismart Light Switch (Neutral Optional) KS_811_3"} ,
- { Setup_Device_TeslaSmartPlus_TSL_SPL_1, "Tesla Smart Plug. Model: (TSL-SPL-1)"},
- { Setup_Device_Calex_900011_1_WB2S, "Calex Smart Power Plug 900011.1"},
- { Setup_Device_Immax_NEO_LITE_NAS_WR07W, "Immax NEO Lite. Model: (NAS-WR07W)"} ,
- { Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N, "MOES Touch Switch 1gang Model:(WS-EU1-RFW-N)"}
-};
-int g_total_templates = sizeof(g_templates) / sizeof(g_templates[0]);
+/*
+
+WARNING! THIS IS OBSOLETE NOW!
+
+WE ARE USING THIS DATABASE:
+https://github.com/OpenBekenIOT/webapp/blob/gh-pages/devices.json
+Submit pull requests to the list above! Post teardowns on Elektroda.com!
+
+
+HERE IS FRONTEND:
+https://openbekeniot.github.io/webapp/devicesList.html
+See above link for more info!
+
+*/
+//
+//typedef struct template_s {
+// void (*setter)();
+// const char* name;
+//} template_t;
+//
+//template_t g_templates[] = {
+// { Setup_Device_Empty, "Empty"},
+// // BK7231N devices
+// { Setup_Device_BK7231N_CB2S_QiachipSmartSwitch, "[BK7231N][CB2S] QiaChip Smart Switch"},
+// { Setup_Device_BK7231N_KS_602_TOUCH, "[BK7231N] KS 602 Touch Switch US"},
+// { Setup_Device_Aubess_Mini_Smart_Switch_16A, "[BK7231N] Aubess Mini Smart Switch 16A"},
+// { Setup_Device_Jinvoo_AC_TV_Box_IR_Controller, "[BK7231N] Jinvoo AC/TV Box IR Controller"},
+// // BK7231T devices
+// { Setup_Device_BK7231T_WB2S_QiachipSmartSwitch, "[BK7231T][WB2S] QiaChip Smart Switch"},
+// { Setup_Device_TuyaWL_SW01_16A, "WL SW01 16A"},
+// { Setup_Device_TuyaSmartLife4CH10A, "Smart Life 4CH 10A"},
+// { Setup_Device_IntelligentLife_NF101A, "Intelligent Life NF101A"},
+// { Setup_Device_TuyaLEDDimmerSingleChannel, "Tuya LED Dimmer Single Channel PWM WB3S"},
+// { Setup_Device_CalexLEDDimmerFiveChannel, "Calex RGBWW LED Dimmer Five Channel PWM BK7231S"},
+// { Setup_Device_CalexPowerStrip_900018_1v1_0UK, "Calex UK power strip 900018.1 v1.0 UK"},
+// { Setup_Device_ArlecCCTDownlight, "Arlec CCT LED Downlight ALD029CHA"},
+// { Setup_Device_NedisWIFIPO120FWT_16A, "Nedis WIFIPO120FWT SmartPlug 16A"},
+// { Setup_Device_NedisWIFIP130FWT_10A, "Nedis WIFIP130FWT SmartPlug 10A"},
+// { Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK, "Prime SmartOutlet Outdoor 2x Costco"},
+// { Setup_Device_EmaxHome_EDU8774, "Emax Home EDU8774 SmartPlug 16A"},
+// { Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs, "Tuya E27 LED RGBCW 5PWMs BK7231N"},
+// { Setup_Device_TuyaSmartPFW02G, "Tuya Smart PFW02-G"},
+// { Setup_Device_AvatarASL04, "Avatar ASL04 5v LED strip"},
+// { Setup_Device_BL602_MagicHome_IR_RGB_LedStrip, "BL602 Magic Home LED RGB IR Strip"},
+// { Setup_Device_BL602_MagicHome_CCT_LedStrip, "BL602 Magic Home LED CCT Strip"},
+// { Setup_Device_Sonoff_MiniR3, "Sonoff MiniR3"},
+// { Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131, "WB2S WiFi DIY Switch ZN268131"},
+// { Setup_Device_DS_102_1Gang_WB3S, "DS-102 1 Gang Switch"},
+// { Setup_Device_DS_102_2Gang_WB3S, "DS-102 2 Gang Switch"},
+// { Setup_Device_DS_102_3Gang_WB3S, "DS-102 3 Gang Switch"},
+// { Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S, "[BK7231N][CB3S] Tuya Smart Wifi Switch 4 Gang"},
+// { Setup_Device_BK7231N_CB2S_LSPA9_BL0942, "[BK7231N][CB2S] LSPA9 power metering plug BL0942 version"},
+// { Setup_Device_LSC_Smart_Connect_Plug_CB2S, "[BK7231N][CB2S] LSC Smart Connect Plug"},
+// { Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1, "BK7231T Gosund Smart Switch SW5-A-V2.1"},
+// { Setup_Device_13A_Socket_CB2S, "BK7231N CB2S 13A Aliexpress socket"},
+// { Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2, "BK7231T DETA SMART Double Power Point 6922HA-Series 2"},
+// { Setup_Device_ArlecRGBCCTDownlight, "Arlec RGB+CCT LED Downlight ALD092RHA"},
+// { Setup_Device_CasaLifeCCTDownlight, "CasaLife CCT LED Downlight SMART-AL2017-TGTS"},
+// { Setup_Device_Enbrighten_WFD4103, "Enbrighten WFD4103 WiFi Switch BK7231T WB2S"} ,
+// { Setup_Device_Zemismart_Light_Switch_KS_811_3, "Zemismart Light Switch (Neutral Optional) KS_811_3"} ,
+// { Setup_Device_TeslaSmartPlus_TSL_SPL_1, "Tesla Smart Plug. Model: (TSL-SPL-1)"},
+// { Setup_Device_Calex_900011_1_WB2S, "Calex Smart Power Plug 900011.1"},
+// { Setup_Device_Immax_NEO_LITE_NAS_WR07W, "Immax NEO Lite. Model: (NAS-WR07W)"} ,
+// { Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N, "MOES Touch Switch 1gang Model:(WS-EU1-RFW-N)"}
+//};
+
+//int g_total_templates = sizeof(g_templates) / sizeof(g_templates[0]);
unsigned char hexdigit(char hex) {
return (hex <= '9') ? hex - '0' :
@@ -1249,7 +1267,27 @@ int http_fn_cfg_quick(http_request_t* request) {
http_html_start(request, "Quick Config");
poststr(request, "
Quick Config ");
- if (http_getArg(request->url, "dev", tmpA, sizeof(tmpA))) {
+
+ /*
+
+ WARNING! THIS IS OBSOLETE NOW!
+
+ WE ARE USING THIS DATABASE:
+ https://github.com/OpenBekenIOT/webapp/blob/gh-pages/devices.json
+ Submit pull requests to the list above! Post teardowns on Elektroda.com!
+
+
+ HERE IS FRONTEND:
+ https://openbekeniot.github.io/webapp/devicesList.html
+ See above link for more info!
+
+ */
+
+ poststr(request, "This is obsolete now - please config through Web App ");
+ poststr(request, "");
+
+
+ /*if (http_getArg(request->url, "dev", tmpA, sizeof(tmpA))) {
j = atoi(tmpA);
hprintf255(request, "Set dev %i! ", j);
g_templates[j].setter();
@@ -1260,7 +1298,7 @@ int http_fn_cfg_quick(http_request_t* request) {
hprintf255(request, "%s ", j, g_templates[j].name);
}
poststr(request, "");
- poststr(request, " ");
+ poststr(request, " ");*/
poststr(request, htmlFooterReturnToCfgLink);
http_html_end(request);
@@ -1885,6 +1923,8 @@ const char* g_obk_flagNames[] = {
"[IR] Allow 'unknown' protocol",
"[MQTT] Broadcast led final color RGBCW (topic name: YourDevName/led_finalcolor_rgbcw/get)",
"[LED] Automatically enable Light when changing brightness, color or temperature on WWW panel",
+ "[LED] Smooth transitions for LED (EXPERIMENTAL)",
+ "error",
"error",
"error",
};
diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c
index 4a90a85ad..bac7621c9 100644
--- a/src/httpserver/new_http.c
+++ b/src/httpserver/new_http.c
@@ -44,6 +44,8 @@ const char htmlFooterInfo[] =
"href=\"https://www.elektroda.com/rtvforum/"
"viewtopic.php?p=19841301#19841301\">Read more | "
"Devices List | "
+"Support project ";
// make sure that USER_SW_VER is set on all platforms
diff --git a/src/new_builtin_devices.c b/src/new_builtin_devices.c
index c64d5232c..4b3c4e45a 100644
--- a/src/new_builtin_devices.c
+++ b/src/new_builtin_devices.c
@@ -1,970 +1,1010 @@
-
-// I know this is not the best way to do this, and we can easily support config-strings like Tasmota
-// but for now let's use that
-#include "new_common.h"
-#include "new_pins.h"
-#include "new_cfg.h"
-
-void Setup_Device_Empty() {
- CFG_ClearPins();
-
- CFG_Save_SetupTimer();
-
-}
-
-void Setup_Device_WB2L_FCMila_Smart_Spotlight_Gu10() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
- PIN_SetPinChannelForPinIndex(6, 0);
-
- PIN_SetPinRoleForPinIndex(7, IOR_PWM);
- PIN_SetPinChannelForPinIndex(7, 3);
-
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- PIN_SetPinChannelForPinIndex(8, 4);
-
- PIN_SetPinRoleForPinIndex(24, IOR_PWM);
- PIN_SetPinChannelForPinIndex(24, 2);
-
- PIN_SetPinRoleForPinIndex(26, IOR_PWM);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-
-}
-
-void Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(7, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_ToggleChannelOnToggle);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-
-}
-
-// https://www.elektroda.pl/rtvforum/topic3881416.html
-void Setup_Device_BL602_MagicHome_IR_RGB_LedStrip() {
- CFG_ClearPins();
-
- // red
- PIN_SetPinRoleForPinIndex(4, IOR_PWM);
- PIN_SetPinChannelForPinIndex(4, 0);
-
- // green
- PIN_SetPinRoleForPinIndex(3, IOR_PWM);
- PIN_SetPinChannelForPinIndex(3, 1);
-
- // blue
- PIN_SetPinRoleForPinIndex(21, IOR_PWM);
- PIN_SetPinChannelForPinIndex(21, 2);
-
- // dummy unused channel 4 with place on pcb for transistor
- //PIN_SetPinRoleForPinIndex(20, IOR_Relay);
- //PIN_SetPinChannelForPinIndex(20, 3);
-
- // IR recv
- //PIN_SetPinRoleForPinIndex(12, IOR_IR_RECV);
- //PIN_SetPinChannelForPinIndex(12, 0);
-
- CFG_Save_SetupTimer();
-}
-
-// MagicHome CCT : ZJ-BWCE-CCT v1.1
-void Setup_Device_BL602_MagicHome_CCT_LedStrip()
-{
- CFG_ClearPins();
-
- // White CCT
- PIN_SetPinRoleForPinIndex(20, IOR_PWM);
- PIN_SetPinChannelForPinIndex(20, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// DeviceName: Sonoff MiniR3
-// ShortDeviceName: minir3
-// https://sonoff.tech/product/minir3
-void Setup_Device_Sonoff_MiniR3() {
- CFG_ClearPins();
- // P1 WIFI LED inverted
- PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(1, 1);
- // P5 Relay Button
- PIN_SetPinRoleForPinIndex(5, IOR_Button);
- PIN_SetPinChannelForPinIndex(5, 1);
- // P22 Relay
- PIN_SetPinRoleForPinIndex(22, IOR_Relay);
- PIN_SetPinChannelForPinIndex(22, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.elektroda.pl/rtvforum/topic3804553.html
-// SmartSwitch Tuya WL-SW01_16 16A
-void Setup_Device_TuyaWL_SW01_16A() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(7, IOR_Relay);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Button);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-// https://www.elektroda.pl/rtvforum/topic3822484.html
-// WiFi Tuya SmartLife 4CH 10A
-void Setup_Device_TuyaSmartLife4CH10A() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 1);
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 2);
- PIN_SetPinRoleForPinIndex(9, IOR_Button);
- PIN_SetPinChannelForPinIndex(9, 3);
- PIN_SetPinRoleForPinIndex(1, IOR_Button);
- PIN_SetPinChannelForPinIndex(1, 4);
-
- PIN_SetPinRoleForPinIndex(14, IOR_Relay);
- PIN_SetPinChannelForPinIndex(14, 1);
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 2);
- PIN_SetPinRoleForPinIndex(24, IOR_Relay);
- PIN_SetPinChannelForPinIndex(24, 3);
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 4);
-
- CFG_Save_SetupTimer();
-}
-// Tuya "12W" smart light bulb
-// "Tuya Wifi Smart Life Light Bulb Lamp E27 LED RGBCW Dimmable For Alexa/Google 18W
-// See this topic: https://www.elektroda.pl/rtvforum/viewtopic.php?t=3880540&highlight=
-void Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs() {
- CFG_ClearPins();
-
- // RGBCW, in that order
- // Raw PWMS (no I2C)
-
- // P26 - red
- PIN_SetPinRoleForPinIndex(26, IOR_PWM);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- // P8 - green
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- PIN_SetPinChannelForPinIndex(8, 2);
-
- // P7 - blue
- PIN_SetPinRoleForPinIndex(7, IOR_PWM);
- PIN_SetPinChannelForPinIndex(7, 3);
-
- // P9 - cold white
- PIN_SetPinRoleForPinIndex(9, IOR_PWM);
- PIN_SetPinChannelForPinIndex(9, 4);
-
- // P6 - warm white
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
- PIN_SetPinChannelForPinIndex(6, 5);
-
- CFG_Save_SetupTimer();
-}
-// https://www.elektroda.pl/rtvforum/viewtopic.php?p=19743751#19743751
-void Setup_Device_IntelligentLife_NF101A() {
- CFG_ClearPins();
-
- // TODO: LED
-
- PIN_SetPinRoleForPinIndex(24, IOR_Relay);
- PIN_SetPinChannelForPinIndex(24, 1);
-
- PIN_SetPinRoleForPinIndex(6, IOR_Button);
- PIN_SetPinChannelForPinIndex(6, 1);
-
-
- CFG_Save_SetupTimer();
-}
-// https://www.elektroda.pl/rtvforum/topic3798114.html
-void Setup_Device_TuyaLEDDimmerSingleChannel() {
- CFG_ClearPins();
-
- // pin 8 has PWM
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- PIN_SetPinChannelForPinIndex(8, 1);
-
- // button is on RXD2, which is a debug uart..
- PIN_SetPinRoleForPinIndex(1, IOR_Button);
- PIN_SetPinChannelForPinIndex(1, 1);
-
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_CalexLEDDimmerFiveChannel() {
-
- // pins are:
- // red - PWM2 = P7
- // green - PWM3 = P8
- // blue - PWM1 = P6
- // warm white - PWM5 = P26
- // cold white - PWM4 = P24
-
- CFG_ClearPins();
-
- // red
- PIN_SetPinChannelForPinIndex(7, 1);
- PIN_SetPinRoleForPinIndex(7, IOR_PWM);
- // green
- PIN_SetPinChannelForPinIndex(8, 2);
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- // blue
- PIN_SetPinChannelForPinIndex(6, 3);
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
- // cold white
- PIN_SetPinChannelForPinIndex(24, 4);
- PIN_SetPinRoleForPinIndex(24, IOR_PWM);
- // warm white
- PIN_SetPinChannelForPinIndex(26, 5);
- PIN_SetPinRoleForPinIndex(26, IOR_PWM);
-
- // IR Input
- //PIN_SetPinChannelForPinIndex(25, 6);
- //PIN_SetPinRoleForPinIndex(25, IO_IRIN);
-
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_CalexPowerStrip_900018_1v1_0UK() {
-
- // pins are:
- // red - PWM2 = P7
- // green - PWM3 = P8
- // blue - PWM1 = P6
- // warm white - PWM5 = P26
- // cold white - PWM4 = P24
-
- CFG_ClearPins();
-
- // relays - 4 sockets + 1 USB
- PIN_SetPinChannelForPinIndex(6, 5);
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(7, 2);
- PIN_SetPinRoleForPinIndex(7, IOR_Relay);
- PIN_SetPinChannelForPinIndex(8, 3);
- PIN_SetPinRoleForPinIndex(8, IOR_Relay);
- PIN_SetPinChannelForPinIndex(9, 1);
- PIN_SetPinRoleForPinIndex(9, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 4);
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
-
- // button
- PIN_SetPinChannelForPinIndex(14, 1);
- PIN_SetPinRoleForPinIndex(14, IOR_Button);
-
- // 2 x LEDs
- // wifi stat
- PIN_SetPinChannelForPinIndex(10, 1);
- PIN_SetPinRoleForPinIndex(10, IOR_LED);
- // power stat
- PIN_SetPinChannelForPinIndex(24, 2);
- PIN_SetPinRoleForPinIndex(24, IOR_LED);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.bunnings.com.au/arlec-grid-connect-smart-9w-cct-led-downlight_p0168694
-void Setup_Device_ArlecCCTDownlight() {
-
- // WB3L
- // pins are:
- // cold white - PWM1 = P6
- // warm white - PWM2 = P24
-
- CFG_ClearPins();
-
- // cold white
- PIN_SetPinChannelForPinIndex(6, 4);
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
- // warm white
- PIN_SetPinChannelForPinIndex(24, 5);
- PIN_SetPinRoleForPinIndex(24, IOR_PWM);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.bunnings.com.au/arlec-grid-connect-smart-9w-rgb-cct-led-downlight_p0168695
-void Setup_Device_ArlecRGBCCTDownlight() {
-
- // WB3L
- // pins are:
- // red = PWM1 = P8
- // green = PWM2 = P7
- // blue = PWM3 = P9
- // cold white - PWM4 = P6
- // warm white - PWM5 = P24
-
- CFG_ClearPins();
- // red
- PIN_SetPinChannelForPinIndex(8, 1);
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- // green
- PIN_SetPinChannelForPinIndex(7, 2);
- PIN_SetPinRoleForPinIndex(7, IOR_PWM);
- // blue
- PIN_SetPinChannelForPinIndex(9, 3);
- PIN_SetPinRoleForPinIndex(9, IOR_PWM);
- // cold white
- PIN_SetPinChannelForPinIndex(6, 4);
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
- // warm white
- PIN_SetPinChannelForPinIndex(24, 5);
- PIN_SetPinRoleForPinIndex(24, IOR_PWM);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.elektroda.com/rtvforum/viewtopic.php?p=20123466#20123466
-// CasaLife CCT Downlight SMART-AL2017-TGTS
-// Sold by ALDI Australia
-void Setup_Device_CasaLifeCCTDownlight() {
-
- // WB2L
- // pins are:
- // color temperature - PWM1 = P7
- // brightness - PWM2 = P8
-
- CFG_ClearPins();
-
- // color temperature
- PIN_SetPinChannelForPinIndex(7, 0);
- PIN_SetPinRoleForPinIndex(7, IOR_PWM);
- // brightness
- PIN_SetPinChannelForPinIndex(8, 1);
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- // Raw PWM values already control temperature/brighness so enable "Flag 3 -[LED][Debug] Show raw PWM controller on WWW index instead of new LED RGB/CW/etc picker"
- CFG_SetFlag(OBK_FLAG_LED_RAWCHANNELSMODE, true);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.elektroda.pl/rtvforum/topic3804553.html
-// SmartSwitch Nedis WIFIPO120FWT
-void Setup_Device_NedisWIFIPO120FWT_16A() {
-
- // WB2S
- // Pins are:
- // Led - PWM0 - P6
- // BL0937-CF - PWM1 - P7
- // BL0937-CF1- PWM2 - P8
- // Button - RX1 - P10
- // BL0937-SEL - PWM4 - P24
- // Relay - PWM5 - P26
-
-
- CFG_ClearPins();
- // LEd
- PIN_SetPinRoleForPinIndex(6, IOR_LED);
- PIN_SetPinChannelForPinIndex(6, 1);
- // Button
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(26, IOR_Relay_n);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.elektroda.pl/rtvforum/topic3804553.html
-// SmartSwitch Nedis WIFIP130FWT
-void Setup_Device_NedisWIFIP130FWT_10A() {
-
- // WB2S
- // Pins are:
- // Led - PWM0 - P6
- // Button - RX1 - P10
- // Relay - PWM5 - P26
-
-
- CFG_ClearPins();
- // Led
- PIN_SetPinRoleForPinIndex(6, IOR_LED);
- PIN_SetPinChannelForPinIndex(6, 1);
- // Button
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// https://www.elektroda.com/rtvforum/topic3819498.html
//
-void Setup_Device_TH06_LCD_RTCC_WB3S() {
-
-}
-
-// https://www.elektroda.pl/rtvforum/topic3804553.html
-// SmartSwitch Emax Home EDU8774 16A
-void Setup_Device_EmaxHome_EDU8774() {
-
- // WB2S
- // Pins are:
- // BL0937-CF - PWM0 - P6
- // BL0937-CF1 - PWM1 - P7
- // BL0937-SEL - PWM2 - P8
- // Button - RX1 - P10
- // Relay - PWM4 - P24
- // Led - PWM5 - P26
-
-
- CFG_ClearPins();
- // Button
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(24, IOR_LED_n);
- PIN_SetPinChannelForPinIndex(24, 1);
- // Led
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// LSPA9
-// See teardown article here:
-// https://www.elektroda.pl/rtvforum/viewtopic.php?t=3887748&highlight=
-void Setup_Device_BK7231N_CB2S_LSPA9_BL0942() {
-
-
-
- CFG_ClearPins();
- // Button
- PIN_SetPinRoleForPinIndex(6, IOR_Button);
- PIN_SetPinChannelForPinIndex(6, 1);
- // LED
- PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(8, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 1);
- // Led
-
- CFG_SetShortStartupCommand_AndExecuteNow("backlog startDriver BL0942; VREF 15987.125000; PREF -683.023987; IREF 272302.687500");
-
- CFG_Save_SetupTimer();
-}
-
-// QiachipSmartSwitch
-// See teardown article here:
-// https://www.elektroda.pl/rtvforum/viewtopic.php?t=3874289&highlight=
-void Setup_Device_BK7231N_CB2S_QiachipSmartSwitch() {
-
-
-
- CFG_ClearPins();
- // Button
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(8, IOR_Relay);
- PIN_SetPinChannelForPinIndex(8, 1);
- // Led
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_BK7231N_KS_602_TOUCH() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(17, IOR_Relay);
- PIN_SetPinChannelForPinIndex(17, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Button);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_SetFlag(OBK_FLAG_BTN_INSTANTTOUCH,true);
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_BK7231T_WB2S_QiachipSmartSwitch() {
- CFG_ClearPins();
- // Button
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(6, IOR_Relay_n);
- PIN_SetPinChannelForPinIndex(6, 1);
- // Led
- PIN_SetPinRoleForPinIndex(10, IOR_LED);
- PIN_SetPinChannelForPinIndex(10, 1);
-
- CFG_Save_SetupTimer();
-}
-
-
-
-// Strigona donation
-// Teardown article: https://www.elektroda.pl/rtvforum/viewtopic.php?p=19906670#19906670
-// https://obrazki.elektroda.pl/6606464600_1642467157.jpg
-// NOTE: It used to be ESP-based https://templates.blakadder.com/prime_CCWFIO232PK.html
-void Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK() {
-
-
-
- CFG_ClearPins();
- // Relay
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(7, IOR_Relay);
- PIN_SetPinChannelForPinIndex(7, 2);
- // Led
- PIN_SetPinRoleForPinIndex(10, IOR_LED);
- PIN_SetPinChannelForPinIndex(10, 1);
- // Led
- PIN_SetPinRoleForPinIndex(26, IOR_LED);
- PIN_SetPinChannelForPinIndex(26, 2);
-
- // Single button
- PIN_SetPinRoleForPinIndex(24, IOR_Button);
- PIN_SetPinChannelForPinIndex(24, 1);
-
-
- CFG_Save_SetupTimer();
-}
-
-
-// https://www.tokmanni.fi/alypistorasia-home-connect-ip20-6419860720456
-// Marked as Smart-PFW02-G
-// Relay (with npn-transistor) at PWM4 P24
-// Button PWM5 P26
-// LED PWM1 P7
-void Setup_Device_TuyaSmartPFW02G() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(24, IOR_Relay_n);
- PIN_SetPinChannelForPinIndex(24, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Button);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- PIN_SetPinRoleForPinIndex(7, IOR_LED);
- PIN_SetPinChannelForPinIndex(7, 1);
-
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_AvatarASL04() {
-
- // pins are:
- // red - PWM1 = P24
- // green - PWM2 = P6
- // blue - PWM3 = P8
-
- // buttons
- // music - P7
- // color - P9
- // on/off - P14
-
- // IR - P14
-
- // audio input ???? - most likely P23/ADC?
-
- CFG_ClearPins();
-
- // red
- PIN_SetPinChannelForPinIndex(24, 1);
- PIN_SetPinRoleForPinIndex(24, IOR_PWM);
- // green
- PIN_SetPinChannelForPinIndex(8, 2);
- PIN_SetPinRoleForPinIndex(8, IOR_PWM);
- // blue
- PIN_SetPinChannelForPinIndex(6, 3);
- PIN_SetPinRoleForPinIndex(6, IOR_PWM);
-
-
- // just set to buttons 1/2/3 for the moment
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(9, IOR_Button);
- PIN_SetPinChannelForPinIndex(9, 2);
-
- PIN_SetPinRoleForPinIndex(14, IOR_Button);
- PIN_SetPinChannelForPinIndex(14, 3);
-
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(24, IOR_Button);
- PIN_SetPinChannelForPinIndex(24, 1);
- PIN_SetPinRoleForPinIndex(20, IOR_Button);
- PIN_SetPinChannelForPinIndex(20, 2);
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 3);
- PIN_SetPinRoleForPinIndex(14, IOR_Button);
- PIN_SetPinChannelForPinIndex(14, 4);
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
- PIN_SetPinRoleForPinIndex(8, IOR_Relay);
- PIN_SetPinChannelForPinIndex(8, 2);
- PIN_SetPinRoleForPinIndex(9, IOR_Relay);
- PIN_SetPinChannelForPinIndex(9, 3);
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 4);
-
- PIN_SetPinRoleForPinIndex(22, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(22, 1);
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_LSC_Smart_Connect_Plug_CB2S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_LED);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(7, IOR_Button);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_DS_102_1Gang_WB3S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
- PIN_SetPinChannelForPinIndex(1, 1);
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_LED);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// see https://www.elektroda.com/rtvforum/viewtopic.php?p=20008969#20008969
-
-void Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1(){
- CFG_ClearPins();
-
- // green
- PIN_SetPinRoleForPinIndex(7, IOR_LED_WIFI);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(14, IOR_Relay);
- PIN_SetPinChannelForPinIndex(14, 1);
-
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 1);
-
- // red
- PIN_SetPinRoleForPinIndex(16, IOR_LED_n);
- PIN_SetPinChannelForPinIndex(16, 1);
-
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_DS_102_2Gang_WB3S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
- PIN_SetPinChannelForPinIndex(1, 1);
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_LED);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 2);
-
- PIN_SetPinRoleForPinIndex(9, IOR_Relay);
- PIN_SetPinChannelForPinIndex(9, 2);
-
- PIN_SetPinRoleForPinIndex(11, IOR_LED);
- PIN_SetPinChannelForPinIndex(11, 2);
-
- CFG_Save_SetupTimer();
-}
-
-
-void Setup_Device_DS_102_3Gang_WB3S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
- PIN_SetPinChannelForPinIndex(1, 1);
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
- PIN_SetPinRoleForPinIndex(24, IOR_Button);
- PIN_SetPinChannelForPinIndex(24, 1);
- PIN_SetPinRoleForPinIndex(14, IOR_LED);
- PIN_SetPinChannelForPinIndex(14, 1);
-
- PIN_SetPinRoleForPinIndex(9, IOR_Relay);
- PIN_SetPinChannelForPinIndex(9, 2);
- PIN_SetPinRoleForPinIndex(10, IOR_Button);
- PIN_SetPinChannelForPinIndex(10, 2);
- PIN_SetPinRoleForPinIndex(26, IOR_LED);
- PIN_SetPinChannelForPinIndex(26, 2);
-
- PIN_SetPinRoleForPinIndex(7, IOR_Relay);
- PIN_SetPinChannelForPinIndex(7, 3);
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 3);
- PIN_SetPinRoleForPinIndex(11, IOR_LED);
- PIN_SetPinChannelForPinIndex(11, 3);
-
-
- CFG_Save_SetupTimer();
-}
-
-// https://obrazki.elektroda.pl/8563462300_1652196315.jpg
-// https://obrazki.elektroda.pl/8998188300_1652196330.jpg
-// https://obrazki.elektroda.pl/2281136200_1652196339.jpg
-// https://obrazki.elektroda.pl/1568452900_1652196348.jpg
-// https://obrazki.elektroda.pl/4600787700_1652196323.jpg
-void Setup_Device_13A_Socket_CB2S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_LED);
- PIN_SetPinChannelForPinIndex(6, 0);
- PIN_SetPinRoleForPinIndex(7, IOR_LED);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 0);
- PIN_SetPinChannel2ForPinIndex(8, 1);
-
- PIN_SetPinRoleForPinIndex(24, IOR_Relay_n);
- PIN_SetPinChannelForPinIndex(24, 0);
- PIN_SetPinRoleForPinIndex(25, IOR_Relay_n);
- PIN_SetPinChannelForPinIndex(25, 1);
-
- CFG_Save_SetupTimer();
-}
-
-//Australian 2 Gang Wall Switch
-//https://obrazki.elektroda.pl/2789424600_1656890909.jpg
-void Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2() {
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_Relay);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(9, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(9, 1);
-
- PIN_SetPinRoleForPinIndex(14, IOR_Button);
- PIN_SetPinChannelForPinIndex(14, 1);
-
- PIN_SetPinRoleForPinIndex(24, IOR_Button);
- PIN_SetPinChannelForPinIndex(24, 2);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 2);
-
- CFG_Save_SetupTimer();
-}
-
-//https://enbrightenme.com/enbrighten-indoor-plug-in-mini-wifi-smart-switch-2-pack-white
-//https://www.elektroda.com/rtvforum/viewtopic.php?p=20133554#20133554
-void Setup_Device_Enbrighten_WFD4103(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(7, IOR_LED_n);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(24, IOR_Relay);
- PIN_SetPinChannelForPinIndex(24, 1);
-
- PIN_SetPinRoleForPinIndex(26, IOR_Button);
- PIN_SetPinChannelForPinIndex(26, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// Aubess Mini Smart Switch 16A
-void Setup_Device_Aubess_Mini_Smart_Switch_16A() {
-
- // pins are:
- // led - led_n = P6
- // embedded button - btn = P8
- // switch - btn = P14
- // relay - rel = P15
-
- CFG_ClearPins();
- // Led
- PIN_SetPinRoleForPinIndex(6, IOR_LED_n);
- PIN_SetPinChannelForPinIndex(6, 1);
- // Embedded Button
- PIN_SetPinRoleForPinIndex(8, IOR_Button);
- PIN_SetPinChannelForPinIndex(8, 1);
- // Switch
- PIN_SetPinRoleForPinIndex(14, IOR_Button);
- PIN_SetPinChannelForPinIndex(14, 1);
- // Relay
- PIN_SetPinRoleForPinIndex(15, IOR_Relay);
- PIN_SetPinChannelForPinIndex(15, 1);
-
- CFG_Save_SetupTimer();
-}
-
-// Zemismart Light Switch (Neutral Optional) KS_811_3
-// https://www.aliexpress.com/item/4000979779573.html
-// Has a BK7231N direct on board, but easy access to UART on back with removal of 4 screws.
-// There is a single and 2 switch version of this, which should be easy to template.
-// Device Info, Pics and Flashing Notes: https://zorruno.com/2022/zemismart-ks-811-with-openbk7231n-openbeken/
-void Setup_Device_Zemismart_Light_Switch_KS_811_3() {
-
- // GPIO:
- // Buttons 1,2,3 = P17,P26,P24
- // Relays/Red LEDs 1,2,3 = P14,P16,P15
- // All LEDs Blue/Off = P22 (Have used this as Wifi Status)
-
- CFG_ClearPins();
- // 3 Leds Blue (Wifi Status, All 3 flash together)
- PIN_SetPinRoleForPinIndex(22, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(22, 1);
- // Buttons
- PIN_SetPinRoleForPinIndex(17, IOR_Button);
- PIN_SetPinChannelForPinIndex(17, 1);
- PIN_SetPinRoleForPinIndex(26, IOR_Button);
- PIN_SetPinChannelForPinIndex(26, 2);
- PIN_SetPinRoleForPinIndex(24, IOR_Button);
- PIN_SetPinChannelForPinIndex(24, 3);
- // Relay, Individual LEDs Red (Relays and LEDs are on same GPIO Pins)
- PIN_SetPinRoleForPinIndex(14, IOR_Relay);
- PIN_SetPinChannelForPinIndex(14, 1);
- PIN_SetPinRoleForPinIndex(16, IOR_Relay);
- PIN_SetPinChannelForPinIndex(16, 2);
- PIN_SetPinRoleForPinIndex(15, IOR_Relay);
- PIN_SetPinChannelForPinIndex(15, 3);
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_TeslaSmartPlus_TSL_SPL_1() {
-
- // CB2S
- // Pins are:
- // BL0937-CF1 - P6
- // BL0937-CF - P7
- // BL0937-SEL - P24
- // Button - RX1 - P10
- // Relay - P26
- // Led - P8
-
-
- CFG_ClearPins();
- // Button
- PIN_SetPinRoleForPinIndex(10, IOR_Button_n);
- PIN_SetPinChannelForPinIndex(10, 0);
- // Relay
- PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(8, 0);
- // Led
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 0);
- // BL0937
- PIN_SetPinRoleForPinIndex(6, IOR_BL0937_CF1);
- PIN_SetPinChannelForPinIndex(6, 0);
- PIN_SetPinRoleForPinIndex(7, IOR_BL0937_CF);
- PIN_SetPinChannelForPinIndex(7, 0);
- PIN_SetPinRoleForPinIndex(24, IOR_BL0937_SEL);
- PIN_SetPinChannelForPinIndex(24, 0);
-
- CFG_SetFlag(2,1);
- CFG_SetFlag(10,1);
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_Calex_900011_1_WB2S(){
- CFG_ClearPins();
-
- PIN_SetPinRoleForPinIndex(6, IOR_Button);
- PIN_SetPinChannelForPinIndex(6, 1);
-
- PIN_SetPinRoleForPinIndex(7, IOR_LED_n);
- PIN_SetPinChannelForPinIndex(7, 1);
-
- PIN_SetPinRoleForPinIndex(24, IOR_Relay);
- PIN_SetPinChannelForPinIndex(24, 1);
-
- PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(8, 2);
-
- CFG_Save_SetupTimer();
-}
-void Setup_Device_Immax_NEO_LITE_NAS_WR07W()
-{
- CFG_ClearPins();
-
- // Button
- PIN_SetPinRoleForPinIndex(9, IOR_Button_n);
- PIN_SetPinChannelForPinIndex(9, 0);
- // Relay
- PIN_SetPinRoleForPinIndex(6, IOR_LED_WIFI_n);
- PIN_SetPinChannelForPinIndex(6, 0);
- // Led
- PIN_SetPinRoleForPinIndex(26, IOR_Relay);
- PIN_SetPinChannelForPinIndex(26, 0);
-
- CFG_SetShortStartupCommand("backlog startDriver BL0942");
- CFG_SetFlag(2,1);
- CFG_SetFlag(10,1);
-
- CFG_Save_SetupTimer();
-}
-
-void Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N()
-{
- CFG_ClearPins();
- CFG_SetShortStartupCommand("backlog startDriver TuyaMCU; setChannelType 1 toggle; linkTuyaMCUOutputToChannel 1 bool 1");
- CFG_SetFlag(2,1);
- CFG_SetFlag(10,1);
- CFG_Save_SetupTimer();
-}
-
+//
+///*
+//
+//WARNING! THIS IS OBSOLETE NOW!
+//
+//WE ARE USING THIS DATABASE:
+//https://github.com/OpenBekenIOT/webapp/blob/gh-pages/devices.json
+//Submit pull requests to the list above! Post teardowns on Elektroda.com!
+//
+//
+//HERE IS FRONTEND:
+//https://openbekeniot.github.io/webapp/devicesList.html
+//See above link for more info!
+//
+//*/
+//
+//
+//// I know this is not the best way to do this, and we can easily support config-strings like Tasmota
+//// but for now let's use that
+//#include "new_common.h"
+//#include "new_pins.h"
+//#include "new_cfg.h"
+//
+//void Setup_Device_Empty() {
+// CFG_ClearPins();
+//
+// CFG_Save_SetupTimer();
+//
+//}
+//
+//void Setup_Device_WB2L_FCMila_Smart_Spotlight_Gu10() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(6, 0);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(7, 3);
+//
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(8, 4);
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(24, 2);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//
+//}
+//
+//void Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_ToggleChannelOnToggle);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//
+//}
+//
+//// https://www.elektroda.pl/rtvforum/topic3881416.html
+//void Setup_Device_BL602_MagicHome_IR_RGB_LedStrip() {
+// CFG_ClearPins();
+//
+// // red
+// PIN_SetPinRoleForPinIndex(4, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(4, 0);
+//
+// // green
+// PIN_SetPinRoleForPinIndex(3, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(3, 1);
+//
+// // blue
+// PIN_SetPinRoleForPinIndex(21, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(21, 2);
+//
+// // dummy unused channel 4 with place on pcb for transistor
+// //PIN_SetPinRoleForPinIndex(20, IOR_Relay);
+// //PIN_SetPinChannelForPinIndex(20, 3);
+//
+// // IR recv
+// //PIN_SetPinRoleForPinIndex(12, IOR_IR_RECV);
+// //PIN_SetPinChannelForPinIndex(12, 0);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// MagicHome CCT : ZJ-BWCE-CCT v1.1
+//void Setup_Device_BL602_MagicHome_CCT_LedStrip()
+//{
+// CFG_ClearPins();
+//
+// // White CCT
+// PIN_SetPinRoleForPinIndex(20, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(20, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// DeviceName: Sonoff MiniR3
+//// ShortDeviceName: minir3
+//// https://sonoff.tech/product/minir3
+//void Setup_Device_Sonoff_MiniR3() {
+// CFG_ClearPins();
+// // P1 WIFI LED inverted
+// PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(1, 1);
+// // P5 Relay Button
+// PIN_SetPinRoleForPinIndex(5, IOR_Button);
+// PIN_SetPinChannelForPinIndex(5, 1);
+// // P22 Relay
+// PIN_SetPinRoleForPinIndex(22, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(22, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.elektroda.pl/rtvforum/topic3804553.html
+//// SmartSwitch Tuya WL-SW01_16 16A
+//void Setup_Device_TuyaWL_SW01_16A() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Button);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//// https://www.elektroda.pl/rtvforum/topic3822484.html
+//// WiFi Tuya SmartLife 4CH 10A
+//void Setup_Device_TuyaSmartLife4CH10A() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 1);
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 2);
+// PIN_SetPinRoleForPinIndex(9, IOR_Button);
+// PIN_SetPinChannelForPinIndex(9, 3);
+// PIN_SetPinRoleForPinIndex(1, IOR_Button);
+// PIN_SetPinChannelForPinIndex(1, 4);
+//
+// PIN_SetPinRoleForPinIndex(14, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(14, 1);
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 2);
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(24, 3);
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 4);
+//
+// CFG_Save_SetupTimer();
+//}
+//// Tuya "12W" smart light bulb
+//// "Tuya Wifi Smart Life Light Bulb Lamp E27 LED RGBCW Dimmable For Alexa/Google 18W
+//// See this topic: https://www.elektroda.pl/rtvforum/viewtopic.php?t=3880540&highlight=
+//void Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs() {
+// CFG_ClearPins();
+//
+// // RGBCW, in that order
+// // Raw PWMS (no I2C)
+//
+// // P26 - red
+// PIN_SetPinRoleForPinIndex(26, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// // P8 - green
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(8, 2);
+//
+// // P7 - blue
+// PIN_SetPinRoleForPinIndex(7, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(7, 3);
+//
+// // P9 - cold white
+// PIN_SetPinRoleForPinIndex(9, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(9, 4);
+//
+// // P6 - warm white
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(6, 5);
+//
+// CFG_Save_SetupTimer();
+//}
+//// https://www.elektroda.pl/rtvforum/viewtopic.php?p=19743751#19743751
+//void Setup_Device_IntelligentLife_NF101A() {
+// CFG_ClearPins();
+//
+// // TODO: LED
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(24, 1);
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Button);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//// https://www.elektroda.pl/rtvforum/topic3798114.html
+//void Setup_Device_TuyaLEDDimmerSingleChannel() {
+// CFG_ClearPins();
+//
+// // pin 8 has PWM
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// PIN_SetPinChannelForPinIndex(8, 1);
+//
+// // button is on RXD2, which is a debug uart..
+// PIN_SetPinRoleForPinIndex(1, IOR_Button);
+// PIN_SetPinChannelForPinIndex(1, 1);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_CalexLEDDimmerFiveChannel() {
+//
+// // pins are:
+// // red - PWM2 = P7
+// // green - PWM3 = P8
+// // blue - PWM1 = P6
+// // warm white - PWM5 = P26
+// // cold white - PWM4 = P24
+//
+// CFG_ClearPins();
+//
+// // red
+// PIN_SetPinChannelForPinIndex(7, 1);
+// PIN_SetPinRoleForPinIndex(7, IOR_PWM);
+// // green
+// PIN_SetPinChannelForPinIndex(8, 2);
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// // blue
+// PIN_SetPinChannelForPinIndex(6, 3);
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+// // cold white
+// PIN_SetPinChannelForPinIndex(24, 4);
+// PIN_SetPinRoleForPinIndex(24, IOR_PWM);
+// // warm white
+// PIN_SetPinChannelForPinIndex(26, 5);
+// PIN_SetPinRoleForPinIndex(26, IOR_PWM);
+//
+// // IR Input
+// //PIN_SetPinChannelForPinIndex(25, 6);
+// //PIN_SetPinRoleForPinIndex(25, IO_IRIN);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_CalexPowerStrip_900018_1v1_0UK() {
+//
+// // pins are:
+// // red - PWM2 = P7
+// // green - PWM3 = P8
+// // blue - PWM1 = P6
+// // warm white - PWM5 = P26
+// // cold white - PWM4 = P24
+//
+// CFG_ClearPins();
+//
+// // relays - 4 sockets + 1 USB
+// PIN_SetPinChannelForPinIndex(6, 5);
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(7, 2);
+// PIN_SetPinRoleForPinIndex(7, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(8, 3);
+// PIN_SetPinRoleForPinIndex(8, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(9, 1);
+// PIN_SetPinRoleForPinIndex(9, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 4);
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+//
+// // button
+// PIN_SetPinChannelForPinIndex(14, 1);
+// PIN_SetPinRoleForPinIndex(14, IOR_Button);
+//
+// // 2 x LEDs
+// // wifi stat
+// PIN_SetPinChannelForPinIndex(10, 1);
+// PIN_SetPinRoleForPinIndex(10, IOR_LED);
+// // power stat
+// PIN_SetPinChannelForPinIndex(24, 2);
+// PIN_SetPinRoleForPinIndex(24, IOR_LED);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.bunnings.com.au/arlec-grid-connect-smart-9w-cct-led-downlight_p0168694
+//void Setup_Device_ArlecCCTDownlight() {
+//
+// // WB3L
+// // pins are:
+// // cold white - PWM1 = P6
+// // warm white - PWM2 = P24
+//
+// CFG_ClearPins();
+//
+// // cold white
+// PIN_SetPinChannelForPinIndex(6, 4);
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+// // warm white
+// PIN_SetPinChannelForPinIndex(24, 5);
+// PIN_SetPinRoleForPinIndex(24, IOR_PWM);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.bunnings.com.au/arlec-grid-connect-smart-9w-rgb-cct-led-downlight_p0168695
+//void Setup_Device_ArlecRGBCCTDownlight() {
+//
+// // WB3L
+// // pins are:
+// // red = PWM1 = P8
+// // green = PWM2 = P7
+// // blue = PWM3 = P9
+// // cold white - PWM4 = P6
+// // warm white - PWM5 = P24
+//
+// CFG_ClearPins();
+// // red
+// PIN_SetPinChannelForPinIndex(8, 1);
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// // green
+// PIN_SetPinChannelForPinIndex(7, 2);
+// PIN_SetPinRoleForPinIndex(7, IOR_PWM);
+// // blue
+// PIN_SetPinChannelForPinIndex(9, 3);
+// PIN_SetPinRoleForPinIndex(9, IOR_PWM);
+// // cold white
+// PIN_SetPinChannelForPinIndex(6, 4);
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+// // warm white
+// PIN_SetPinChannelForPinIndex(24, 5);
+// PIN_SetPinRoleForPinIndex(24, IOR_PWM);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.elektroda.com/rtvforum/viewtopic.php?p=20123466#20123466
+//// CasaLife CCT Downlight SMART-AL2017-TGTS
+//// Sold by ALDI Australia
+//void Setup_Device_CasaLifeCCTDownlight() {
+//
+// // WB2L
+// // pins are:
+// // color temperature - PWM1 = P7
+// // brightness - PWM2 = P8
+//
+// CFG_ClearPins();
+//
+// // color temperature
+// PIN_SetPinChannelForPinIndex(7, 0);
+// PIN_SetPinRoleForPinIndex(7, IOR_PWM);
+// // brightness
+// PIN_SetPinChannelForPinIndex(8, 1);
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// // Raw PWM values already control temperature/brighness so enable "Flag 3 -[LED][Debug] Show raw PWM controller on WWW index instead of new LED RGB/CW/etc picker"
+// CFG_SetFlag(OBK_FLAG_LED_RAWCHANNELSMODE, true);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.elektroda.pl/rtvforum/topic3804553.html
+//// SmartSwitch Nedis WIFIPO120FWT
+//void Setup_Device_NedisWIFIPO120FWT_16A() {
+//
+// // WB2S
+// // Pins are:
+// // Led - PWM0 - P6
+// // BL0937-CF - PWM1 - P7
+// // BL0937-CF1- PWM2 - P8
+// // Button - RX1 - P10
+// // BL0937-SEL - PWM4 - P24
+// // Relay - PWM5 - P26
+//
+//
+// CFG_ClearPins();
+// // LEd
+// PIN_SetPinRoleForPinIndex(6, IOR_LED);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // Button
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay_n);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.elektroda.pl/rtvforum/topic3804553.html
+//// SmartSwitch Nedis WIFIP130FWT
+//void Setup_Device_NedisWIFIP130FWT_10A() {
+//
+// // WB2S
+// // Pins are:
+// // Led - PWM0 - P6
+// // Button - RX1 - P10
+// // Relay - PWM5 - P26
+//
+//
+// CFG_ClearPins();
+// // Led
+// PIN_SetPinRoleForPinIndex(6, IOR_LED);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // Button
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://www.elektroda.com/rtvforum/topic3819498.html
+////
+//void Setup_Device_TH06_LCD_RTCC_WB3S() {
+//
+//}
+//
+//// https://www.elektroda.pl/rtvforum/topic3804553.html
+//// SmartSwitch Emax Home EDU8774 16A
+//void Setup_Device_EmaxHome_EDU8774() {
+//
+// // WB2S
+// // Pins are:
+// // BL0937-CF - PWM0 - P6
+// // BL0937-CF1 - PWM1 - P7
+// // BL0937-SEL - PWM2 - P8
+// // Button - RX1 - P10
+// // Relay - PWM4 - P24
+// // Led - PWM5 - P26
+//
+//
+// CFG_ClearPins();
+// // Button
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(24, IOR_LED_n);
+// PIN_SetPinChannelForPinIndex(24, 1);
+// // Led
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// LSPA9
+//// See teardown article here:
+//// https://www.elektroda.pl/rtvforum/viewtopic.php?t=3887748&highlight=
+//void Setup_Device_BK7231N_CB2S_LSPA9_BL0942() {
+//
+//
+//
+// CFG_ClearPins();
+// // Button
+// PIN_SetPinRoleForPinIndex(6, IOR_Button);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // LED
+// PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(8, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 1);
+// // Led
+//
+// CFG_SetShortStartupCommand_AndExecuteNow("backlog startDriver BL0942; VREF 15987.125000; PREF -683.023987; IREF 272302.687500");
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// QiachipSmartSwitch
+//// See teardown article here:
+//// https://www.elektroda.pl/rtvforum/viewtopic.php?t=3874289&highlight=
+//void Setup_Device_BK7231N_CB2S_QiachipSmartSwitch() {
+//
+//
+//
+// CFG_ClearPins();
+// // Button
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(8, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(8, 1);
+// // Led
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_BK7231N_KS_602_TOUCH() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(17, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(17, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Button);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_SetFlag(OBK_FLAG_BTN_INSTANTTOUCH,true);
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_BK7231T_WB2S_QiachipSmartSwitch() {
+// CFG_ClearPins();
+// // Button
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay_n);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // Led
+// PIN_SetPinRoleForPinIndex(10, IOR_LED);
+// PIN_SetPinChannelForPinIndex(10, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//
+//// Strigona donation
+//// Teardown article: https://www.elektroda.pl/rtvforum/viewtopic.php?p=19906670#19906670
+//// https://obrazki.elektroda.pl/6606464600_1642467157.jpg
+//// NOTE: It used to be ESP-based https://templates.blakadder.com/prime_CCWFIO232PK.html
+//void Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK() {
+//
+//
+//
+// CFG_ClearPins();
+// // Relay
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(7, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(7, 2);
+// // Led
+// PIN_SetPinRoleForPinIndex(10, IOR_LED);
+// PIN_SetPinChannelForPinIndex(10, 1);
+// // Led
+// PIN_SetPinRoleForPinIndex(26, IOR_LED);
+// PIN_SetPinChannelForPinIndex(26, 2);
+//
+// // Single button
+// PIN_SetPinRoleForPinIndex(24, IOR_Button);
+// PIN_SetPinChannelForPinIndex(24, 1);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//// https://www.tokmanni.fi/alypistorasia-home-connect-ip20-6419860720456
+//// Marked as Smart-PFW02-G
+//// Relay (with npn-transistor) at PWM4 P24
+//// Button PWM5 P26
+//// LED PWM1 P7
+//void Setup_Device_TuyaSmartPFW02G() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay_n);
+// PIN_SetPinChannelForPinIndex(24, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Button);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_LED);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_AvatarASL04() {
+//
+// // pins are:
+// // red - PWM1 = P24
+// // green - PWM2 = P6
+// // blue - PWM3 = P8
+//
+// // buttons
+// // music - P7
+// // color - P9
+// // on/off - P14
+//
+// // IR - P14
+//
+// // audio input ???? - most likely P23/ADC?
+//
+// CFG_ClearPins();
+//
+// // red
+// PIN_SetPinChannelForPinIndex(24, 1);
+// PIN_SetPinRoleForPinIndex(24, IOR_PWM);
+// // green
+// PIN_SetPinChannelForPinIndex(8, 2);
+// PIN_SetPinRoleForPinIndex(8, IOR_PWM);
+// // blue
+// PIN_SetPinChannelForPinIndex(6, 3);
+// PIN_SetPinRoleForPinIndex(6, IOR_PWM);
+//
+//
+// // just set to buttons 1/2/3 for the moment
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(9, IOR_Button);
+// PIN_SetPinChannelForPinIndex(9, 2);
+//
+// PIN_SetPinRoleForPinIndex(14, IOR_Button);
+// PIN_SetPinChannelForPinIndex(14, 3);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Button);
+// PIN_SetPinChannelForPinIndex(24, 1);
+// PIN_SetPinRoleForPinIndex(20, IOR_Button);
+// PIN_SetPinChannelForPinIndex(20, 2);
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 3);
+// PIN_SetPinRoleForPinIndex(14, IOR_Button);
+// PIN_SetPinChannelForPinIndex(14, 4);
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// PIN_SetPinRoleForPinIndex(8, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(8, 2);
+// PIN_SetPinRoleForPinIndex(9, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(9, 3);
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 4);
+//
+// PIN_SetPinRoleForPinIndex(22, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(22, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_LSC_Smart_Connect_Plug_CB2S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_LED);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_Button);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_DS_102_1Gang_WB3S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
+// PIN_SetPinChannelForPinIndex(1, 1);
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_LED);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// see https://www.elektroda.com/rtvforum/viewtopic.php?p=20008969#20008969
+//
+//void Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1(){
+// CFG_ClearPins();
+//
+// // green
+// PIN_SetPinRoleForPinIndex(7, IOR_LED_WIFI);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(14, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(14, 1);
+//
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 1);
+//
+// // red
+// PIN_SetPinRoleForPinIndex(16, IOR_LED_n);
+// PIN_SetPinChannelForPinIndex(16, 1);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_DS_102_2Gang_WB3S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
+// PIN_SetPinChannelForPinIndex(1, 1);
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_LED);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 2);
+//
+// PIN_SetPinRoleForPinIndex(9, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(9, 2);
+//
+// PIN_SetPinRoleForPinIndex(11, IOR_LED);
+// PIN_SetPinChannelForPinIndex(11, 2);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//
+//void Setup_Device_DS_102_3Gang_WB3S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(1, IOR_LED_WIFI);
+// PIN_SetPinChannelForPinIndex(1, 1);
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// PIN_SetPinRoleForPinIndex(24, IOR_Button);
+// PIN_SetPinChannelForPinIndex(24, 1);
+// PIN_SetPinRoleForPinIndex(14, IOR_LED);
+// PIN_SetPinChannelForPinIndex(14, 1);
+//
+// PIN_SetPinRoleForPinIndex(9, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(9, 2);
+// PIN_SetPinRoleForPinIndex(10, IOR_Button);
+// PIN_SetPinChannelForPinIndex(10, 2);
+// PIN_SetPinRoleForPinIndex(26, IOR_LED);
+// PIN_SetPinChannelForPinIndex(26, 2);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(7, 3);
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 3);
+// PIN_SetPinRoleForPinIndex(11, IOR_LED);
+// PIN_SetPinChannelForPinIndex(11, 3);
+//
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// https://obrazki.elektroda.pl/8563462300_1652196315.jpg
+//// https://obrazki.elektroda.pl/8998188300_1652196330.jpg
+//// https://obrazki.elektroda.pl/2281136200_1652196339.jpg
+//// https://obrazki.elektroda.pl/1568452900_1652196348.jpg
+//// https://obrazki.elektroda.pl/4600787700_1652196323.jpg
+//void Setup_Device_13A_Socket_CB2S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_LED);
+// PIN_SetPinChannelForPinIndex(6, 0);
+// PIN_SetPinRoleForPinIndex(7, IOR_LED);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 0);
+// PIN_SetPinChannel2ForPinIndex(8, 1);
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay_n);
+// PIN_SetPinChannelForPinIndex(24, 0);
+// PIN_SetPinRoleForPinIndex(25, IOR_Relay_n);
+// PIN_SetPinChannelForPinIndex(25, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+////Australian 2 Gang Wall Switch
+////https://obrazki.elektroda.pl/2789424600_1656890909.jpg
+//void Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2() {
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(9, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(9, 1);
+//
+// PIN_SetPinRoleForPinIndex(14, IOR_Button);
+// PIN_SetPinChannelForPinIndex(14, 1);
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Button);
+// PIN_SetPinChannelForPinIndex(24, 2);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 2);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+////https://enbrightenme.com/enbrighten-indoor-plug-in-mini-wifi-smart-switch-2-pack-white
+////https://www.elektroda.com/rtvforum/viewtopic.php?p=20133554#20133554
+//void Setup_Device_Enbrighten_WFD4103(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_LED_n);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(24, 1);
+//
+// PIN_SetPinRoleForPinIndex(26, IOR_Button);
+// PIN_SetPinChannelForPinIndex(26, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// Aubess Mini Smart Switch 16A
+//void Setup_Device_Aubess_Mini_Smart_Switch_16A() {
+//
+// // pins are:
+// // led - led_n = P6
+// // embedded button - btn = P8
+// // switch - btn = P14
+// // relay - rel = P15
+//
+// CFG_ClearPins();
+// // Led
+// PIN_SetPinRoleForPinIndex(6, IOR_LED_n);
+// PIN_SetPinChannelForPinIndex(6, 1);
+// // Embedded Button
+// PIN_SetPinRoleForPinIndex(8, IOR_Button);
+// PIN_SetPinChannelForPinIndex(8, 1);
+// // Switch
+// PIN_SetPinRoleForPinIndex(14, IOR_Button);
+// PIN_SetPinChannelForPinIndex(14, 1);
+// // Relay
+// PIN_SetPinRoleForPinIndex(15, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(15, 1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// Jinvoo AC/TV Box IR Controller (SM-AW502S)
+//// https://www.elektroda.com/rtvforum/topic3931868.html
+//void Setup_Device_Jinvoo_AC_TV_Box_IR_Controller() {
+//
+// // pins are:
+// // embedded button - Btn = P6
+// // IR receiver - IRRecv = P7
+// // led - WifiLED = P8
+// // IR leds - IRSend = P26
+//
+// CFG_ClearPins();
+// // Embedded Button
+// PIN_SetPinRoleForPinIndex(6, IOR_Button);
+// // IR receiver
+// PIN_SetPinRoleForPinIndex(7, IOR_IRRecv);
+// // LED
+// PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI);
+// // IR LEDs
+// PIN_SetPinRoleForPinIndex(26, IOR_IRSend);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//// Zemismart Light Switch (Neutral Optional) KS_811_3
+//// https://www.aliexpress.com/item/4000979779573.html
+//// Has a BK7231N direct on board, but easy access to UART on back with removal of 4 screws.
+//// There is a single and 2 switch version of this, which should be easy to template.
+//// Device Info, Pics and Flashing Notes: https://zorruno.com/2022/zemismart-ks-811-with-openbk7231n-openbeken/
+//void Setup_Device_Zemismart_Light_Switch_KS_811_3() {
+//
+// // GPIO:
+// // Buttons 1,2,3 = P17,P26,P24
+// // Relays/Red LEDs 1,2,3 = P14,P16,P15
+// // All LEDs Blue/Off = P22 (Have used this as Wifi Status)
+//
+// CFG_ClearPins();
+// // 3 Leds Blue (Wifi Status, All 3 flash together)
+// PIN_SetPinRoleForPinIndex(22, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(22, 1);
+// // Buttons
+// PIN_SetPinRoleForPinIndex(17, IOR_Button);
+// PIN_SetPinChannelForPinIndex(17, 1);
+// PIN_SetPinRoleForPinIndex(26, IOR_Button);
+// PIN_SetPinChannelForPinIndex(26, 2);
+// PIN_SetPinRoleForPinIndex(24, IOR_Button);
+// PIN_SetPinChannelForPinIndex(24, 3);
+// // Relay, Individual LEDs Red (Relays and LEDs are on same GPIO Pins)
+// PIN_SetPinRoleForPinIndex(14, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(14, 1);
+// PIN_SetPinRoleForPinIndex(16, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(16, 2);
+// PIN_SetPinRoleForPinIndex(15, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(15, 3);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_TeslaSmartPlus_TSL_SPL_1() {
+//
+// // CB2S
+// // Pins are:
+// // BL0937-CF1 - P6
+// // BL0937-CF - P7
+// // BL0937-SEL - P24
+// // Button - RX1 - P10
+// // Relay - P26
+// // Led - P8
+//
+//
+// CFG_ClearPins();
+// // Button
+// PIN_SetPinRoleForPinIndex(10, IOR_Button_n);
+// PIN_SetPinChannelForPinIndex(10, 0);
+// // Relay
+// PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(8, 0);
+// // Led
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 0);
+// // BL0937
+// PIN_SetPinRoleForPinIndex(6, IOR_BL0937_CF1);
+// PIN_SetPinChannelForPinIndex(6, 0);
+// PIN_SetPinRoleForPinIndex(7, IOR_BL0937_CF);
+// PIN_SetPinChannelForPinIndex(7, 0);
+// PIN_SetPinRoleForPinIndex(24, IOR_BL0937_SEL);
+// PIN_SetPinChannelForPinIndex(24, 0);
+//
+// CFG_SetFlag(2,1);
+// CFG_SetFlag(10,1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_Calex_900011_1_WB2S(){
+// CFG_ClearPins();
+//
+// PIN_SetPinRoleForPinIndex(6, IOR_Button);
+// PIN_SetPinChannelForPinIndex(6, 1);
+//
+// PIN_SetPinRoleForPinIndex(7, IOR_LED_n);
+// PIN_SetPinChannelForPinIndex(7, 1);
+//
+// PIN_SetPinRoleForPinIndex(24, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(24, 1);
+//
+// PIN_SetPinRoleForPinIndex(8, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(8, 2);
+//
+// CFG_Save_SetupTimer();
+//}
+//void Setup_Device_Immax_NEO_LITE_NAS_WR07W()
+//{
+// CFG_ClearPins();
+//
+// // Button
+// PIN_SetPinRoleForPinIndex(9, IOR_Button_n);
+// PIN_SetPinChannelForPinIndex(9, 0);
+// // Relay
+// PIN_SetPinRoleForPinIndex(6, IOR_LED_WIFI_n);
+// PIN_SetPinChannelForPinIndex(6, 0);
+// // Led
+// PIN_SetPinRoleForPinIndex(26, IOR_Relay);
+// PIN_SetPinChannelForPinIndex(26, 0);
+//
+// CFG_SetShortStartupCommand("backlog startDriver BL0942");
+// CFG_SetFlag(2,1);
+// CFG_SetFlag(10,1);
+//
+// CFG_Save_SetupTimer();
+//}
+//
+//void Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N()
+//{
+// CFG_ClearPins();
+// CFG_SetShortStartupCommand("backlog startDriver TuyaMCU; setChannelType 1 toggle; linkTuyaMCUOutputToChannel 1 bool 1");
+// CFG_SetFlag(2,1);
+// CFG_SetFlag(10,1);
+// CFG_Save_SetupTimer();
+//}
+//
diff --git a/src/new_pins.c b/src/new_pins.c
index 9aaa9ba7b..58a0b33b0 100644
--- a/src/new_pins.c
+++ b/src/new_pins.c
@@ -1006,6 +1006,10 @@ void PIN_ticks(void *param)
#ifndef OBK_DISABLE_ALL_DRIVERS
DRV_RunQuickTick();
#endif
+
+ if(CFG_HasFlag(OBK_FLAG_LED_SMOOTH_TRANSITIONS) == true) {
+ LED_RunQuickColorLerp(PIN_TMR_DURATION);
+ }
// WiFi LED
// In Open Access point mode, fast blink
diff --git a/src/new_pins.h b/src/new_pins.h
index eda5f07a7..80956cd4e 100644
--- a/src/new_pins.h
+++ b/src/new_pins.h
@@ -148,9 +148,10 @@ typedef struct pinsState_s {
#define OBK_FLAG_IR_ALLOW_UNKNOWN 15
#define OBK_FLAG_LED_BROADCAST_FULL_RGBCW 16
#define OBK_FLAG_LED_AUTOENABLE_ON_WWW_ACTION 17
+#define OBK_FLAG_LED_SMOOTH_TRANSITIONS 18
-#define OBK_TOTAL_FLAGS 18
+#define OBK_TOTAL_FLAGS 19
#define CGF_MQTT_CLIENT_ID_SIZE 64
@@ -311,44 +312,60 @@ int h_isChannelRelay(int tg_ch);
int PIN_ParsePinRoleName(const char *name);
// from new_builtin.c
-void Setup_Device_Empty();
-void Setup_Device_TuyaWL_SW01_16A();
-void Setup_Device_TuyaSmartLife4CH10A();
-void Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs();
-void Setup_Device_IntelligentLife_NF101A();
-void Setup_Device_TuyaLEDDimmerSingleChannel();
-void Setup_Device_CalexLEDDimmerFiveChannel();
-void Setup_Device_CalexPowerStrip_900018_1v1_0UK();
-void Setup_Device_ArlecCCTDownlight();
-void Setup_Device_ArlecRGBCCTDownlight();
-void Setup_Device_CasaLifeCCTDownlight();
-void Setup_Device_NedisWIFIPO120FWT_16A();
-void Setup_Device_NedisWIFIP130FWT_10A();
-void Setup_Device_EmaxHome_EDU8774();
-void Setup_Device_TuyaSmartPFW02G();
-void Setup_Device_BK7231N_CB2S_QiachipSmartSwitch();
-void Setup_Device_BK7231T_WB2S_QiachipSmartSwitch();
-void Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK();
-void Setup_Device_AvatarASL04();
-void Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S();
-void Setup_Device_BL602_MagicHome_IR_RGB_LedStrip();
-void Setup_Device_BL602_MagicHome_CCT_LedStrip();
-void Setup_Device_Sonoff_MiniR3();
-void Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131();
-void Setup_Device_BK7231N_CB2S_LSPA9_BL0942();
-void Setup_Device_LSC_Smart_Connect_Plug_CB2S();
-void Setup_Device_DS_102_1Gang_WB3S();
-void Setup_Device_DS_102_2Gang_WB3S();
-void Setup_Device_DS_102_3Gang_WB3S();
-void Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1();
-void Setup_Device_13A_Socket_CB2S();
-void Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2();
-void Setup_Device_BK7231N_KS_602_TOUCH();
-void Setup_Device_Enbrighten_WFD4103();
-void Setup_Device_Aubess_Mini_Smart_Switch_16A();
-void Setup_Device_Zemismart_Light_Switch_KS_811_3();
-void Setup_Device_TeslaSmartPlus_TSL_SPL_1();
-void Setup_Device_Calex_900011_1_WB2S();
-void Setup_Device_Immax_NEO_LITE_NAS_WR07W();
-void Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N();
+/*
+
+WARNING! THIS IS OBSOLETE NOW!
+
+WE ARE USING THIS DATABASE:
+https://github.com/OpenBekenIOT/webapp/blob/gh-pages/devices.json
+Submit pull requests to the list above! Post teardowns on Elektroda.com!
+
+
+HERE IS FRONTEND:
+https://openbekeniot.github.io/webapp/devicesList.html
+See above link for more info!
+
+*/
+//void Setup_Device_Empty();
+//void Setup_Device_TuyaWL_SW01_16A();
+//void Setup_Device_TuyaSmartLife4CH10A();
+//void Setup_Device_BK7231N_TuyaLightBulb_RGBCW_5PWMs();
+//void Setup_Device_IntelligentLife_NF101A();
+//void Setup_Device_TuyaLEDDimmerSingleChannel();
+//void Setup_Device_CalexLEDDimmerFiveChannel();
+//void Setup_Device_CalexPowerStrip_900018_1v1_0UK();
+//void Setup_Device_ArlecCCTDownlight();
+//void Setup_Device_ArlecRGBCCTDownlight();
+//void Setup_Device_CasaLifeCCTDownlight();
+//void Setup_Device_NedisWIFIPO120FWT_16A();
+//void Setup_Device_NedisWIFIP130FWT_10A();
+//void Setup_Device_EmaxHome_EDU8774();
+//void Setup_Device_TuyaSmartPFW02G();
+//void Setup_Device_BK7231N_CB2S_QiachipSmartSwitch();
+//void Setup_Device_BK7231T_WB2S_QiachipSmartSwitch();
+//void Setup_Device_BK7231T_Raw_PrimeWiFiSmartOutletsOutdoor_CCWFIO232PK();
+//void Setup_Device_AvatarASL04();
+//void Setup_Device_TuyaSmartWIFISwith_4Gang_CB3S();
+//void Setup_Device_BL602_MagicHome_IR_RGB_LedStrip();
+//void Setup_Device_BL602_MagicHome_CCT_LedStrip();
+//void Setup_Device_Sonoff_MiniR3();
+//void Setup_Device_WiFi_DIY_Switch_WB2S_ZN268131();
+//void Setup_Device_BK7231N_CB2S_LSPA9_BL0942();
+//void Setup_Device_LSC_Smart_Connect_Plug_CB2S();
+//void Setup_Device_DS_102_1Gang_WB3S();
+//void Setup_Device_DS_102_2Gang_WB3S();
+//void Setup_Device_DS_102_3Gang_WB3S();
+//void Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1();
+//void Setup_Device_13A_Socket_CB2S();
+//void Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2();
+//void Setup_Device_BK7231N_KS_602_TOUCH();
+//void Setup_Device_Enbrighten_WFD4103();
+//void Setup_Device_Aubess_Mini_Smart_Switch_16A();
+//void Setup_Device_Zemismart_Light_Switch_KS_811_3();
+//void Setup_Device_TeslaSmartPlus_TSL_SPL_1();
+//void Setup_Device_Calex_900011_1_WB2S();
+//void Setup_Device_Immax_NEO_LITE_NAS_WR07W();
+//void Setup_Device_MOES_TouchSwitch_WS_EU1_RFW_N();
+
+
#endif