diff --git a/README.md b/README.md index e893cdfb5..f80e27cd4 100644 --- a/README.md +++ b/README.md @@ -453,6 +453,7 @@ Some channels have "_div10" or "_div100" sufixes. This is for TuyaMCU. This is n | Voltage_div10 | Divide by 10 and display value as a V voltage. | TODO | | Current_div100 | Divide by 100 and display value as a A current. | TODO | | Current_div1000 | Divide by 1000 and display value as a A current. | TODO | +| OffDimBright | 3 options - Off (0), Dim (1), Bright (2). Used for TuyaMCU LED indicator. | TODO | # Simple TCP command server for scripting diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 99fae4636..468746901 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -653,6 +653,25 @@ int http_fn_index(http_request_t* request) { hprintf255(request, "", CHANNEL_GetLabel(i)); poststr(request, ""); } + else if (channelType == ChType_OffDimBright) { + const char* types[] = { "Off","Dim","Bright" }; + iValue = CHANNEL_Get(i); + + poststr(request, ""); + hprintf255(request, "

Select level:

"); + hprintf255(request, "", i); + for (j = 0; j < 3; j++) { + const char* check; + if (j == iValue) + check = "checked"; + else + check = ""; + hprintf255(request, "%s", j, check, types[j]); + } + hprintf255(request, "
"); + poststr(request, ""); + + } } if (bRawPWMs == 0 || bForceShowRGBCW || bForceShowRGB) { diff --git a/src/new_pins.c b/src/new_pins.c index febb05654..b4a94f314 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -1532,6 +1532,8 @@ int CHANNEL_ParseChannelType(const char *s) { return ChType_OpenClosed_Inv; if (!stricmp(s, "BatteryLevelPercent")) return ChType_BatteryLevelPercent; + if (!stricmp(s, "OffDimBright")) + return ChType_OffDimBright; return ChType_Error; } static commandResult_t CMD_setButtonHoldRepeat(const void *context, const char *cmd, const char *args, int cmdFlags){ diff --git a/src/new_pins.h b/src/new_pins.h index b0b7da2ba..91e87bb8e 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -130,6 +130,7 @@ typedef enum { ChType_OpenClosed, ChType_OpenClosed_Inv, ChType_BatteryLevelPercent, + ChType_OffDimBright, } ChannelType;