diff --git a/src/driver/drv_pwmToggler.c b/src/driver/drv_pwmToggler.c index 7203e446b..df5e26114 100644 --- a/src/driver/drv_pwmToggler.c +++ b/src/driver/drv_pwmToggler.c @@ -264,7 +264,7 @@ void DRV_Toggler_AddToHtmlPage(http_request_t *request) { hprintf255(request, "", maxValue, g_values[i]); hprintf255(request, "", i); - hprintf255(request, "", name); + hprintf255(request, "", name); poststr(request, ""); } diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 1ffc50785..05fece121 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -325,7 +325,7 @@ int http_fn_index(http_request_t* request) { poststr(request, "
"); // replaceable content follows } - poststr(request, ""); + poststr(request, "
"); //Table default to 100% width in stylesheet for (i = 0; i < CHANNEL_MAX; i++) { int channelType; @@ -335,10 +335,10 @@ int http_fn_index(http_request_t* request) { hprintf255(request, ""); } if (CHANNEL_Check(i)) { - poststr(request, ""); + poststr(request, ""); } else { - poststr(request, ""); + poststr(request, ""); } if (i == CHANNEL_MAX - 1) { poststr(request, ""); @@ -347,7 +347,7 @@ int http_fn_index(http_request_t* request) { } poststr(request, "
ONONOFFOFF
"); - poststr(request, ""); + poststr(request, "
"); //Table default to 100% width in stylesheet for (i = 0; i < PLATFORM_GPIO_MAX; i++) { int role; @@ -637,7 +637,7 @@ int http_fn_index(http_request_t* request) { hprintf255(request, "", i); hprintf255(request, "", maxValue, inputName, i, pwmValue); hprintf255(request, "", inputName, i); - hprintf255(request, "", i); + hprintf255(request, "", i); poststr(request, ""); } } @@ -683,7 +683,7 @@ int http_fn_index(http_request_t* request) { hprintf255(request, "", SPECIAL_CHANNEL_BRIGHTNESS); hprintf255(request, "", inputName, SPECIAL_CHANNEL_BRIGHTNESS, pwmValue); hprintf255(request, "", inputName, SPECIAL_CHANNEL_BRIGHTNESS); - hprintf255(request, "", SPECIAL_CHANNEL_BRIGHTNESS); + hprintf255(request, "", SPECIAL_CHANNEL_BRIGHTNESS); poststr(request, ""); } if (c_pwms >= 3) { @@ -700,7 +700,7 @@ int http_fn_index(http_request_t* request) { hprintf255(request, "", SPECIAL_CHANNEL_BASECOLOR); hprintf255(request, "", inputName, SPECIAL_CHANNEL_BASECOLOR, colorValue); hprintf255(request, "", inputName, SPECIAL_CHANNEL_BASECOLOR); - hprintf255(request, ""); + hprintf255(request, ""); poststr(request, ""); } if (c_pwms == 2 || c_pwms >= 4) { @@ -718,7 +718,7 @@ int http_fn_index(http_request_t* request) { poststr(request, " "); poststr(request, ""); - + poststr(request, "
"); hprintf255(request, "
LED Temperature Slider %s (%ld K) (Warm <--- ---> Cool)
", activeStr, pwmKelvin); - hprintf255(request, "
", SPECIAL_CHANNEL_TEMPERATURE); + hprintf255(request, "", SPECIAL_CHANNEL_TEMPERATURE); //(KELVIN_TEMPERATURE_MAX - KELVIN_TEMPERATURE_MIN) / (HASS_TEMPERATURE_MAX - HASS_TEMPERATURE_MIN) = 13 hprintf255(request, "You are in safe mode (AP mode) because full reboot failed %i times. ", + hprintf255(request, "
You are in safe mode (AP mode) because full reboot failed %i times. ", Main_GetLastRebootBootFailures()); hprintf255(request, "Pins, relays, etc are disabled.
"); @@ -1421,10 +1421,10 @@ int http_fn_startup_command(http_request_t* request) { http_setup(request, httpMimeTypeHTML); http_html_start(request, "Set startup command"); poststr(request, "

Set/Change/Clear startup command line

"); - poststr(request, "
Startup command is a shorter, smaller alternative to LittleFS autoexec.bat." - "The startup commands are ran at device startup." - "You can use them to init peripherals and drivers, like BL0942 energy sensor." - "Use backlog cmd1; cmd2; cmd3; etc to enter multiple commands
"); + poststr(request, "

Startup command is a shorter, smaller alternative to LittleFS autoexec.bat. " + "The startup commands are ran at device startup. " + "You can use them to init peripherals and drivers, like BL0942 energy sensor. " + "Use backlog cmd1; cmd2; cmd3; etc to enter multiple commands

"); if (http_getArg(request->url, "data", tmpA, sizeof(tmpA))) { // hprintf255(request,"

Set command to %s!

",tmpA); @@ -1596,7 +1596,7 @@ void doHomeAssistantDiscovery(const char *topic, http_request_t *request) { get_Relay_PWM_Count(&relayCount, &pwmCount, &dInputCount); - ledDriverChipRunning = LED_IsLedDriverChipRunning(); + ledDriverChipRunning = LED_IsLedDriverChipRunning(); hooks.malloc_fn = os_malloc; hooks.free_fn = os_free; @@ -1929,7 +1929,7 @@ int http_fn_ha_cfg(http_request_t* request) { } poststr(request, ""); - poststr(request, "
 

"); + poststr(request, "
 

"); poststr(request, htmlFooterReturnToCfgLink); http_html_end(request); poststr(request, ha_discovery_script); @@ -2561,12 +2561,12 @@ int http_fn_cfg_pins(http_request_t* request) { http_setup(request, httpMimeTypeHTML); http_html_start(request, "Pin config"); - poststr(request, "
First textfield is used to enter channel index (relay index), used to support multiple relays and buttons
"); - poststr(request, "
(so, first button and first relay should have channel 1, second button and second relay have channel 2, etc)
"); - poststr(request, "
Second textfield (only for buttons) is used to enter channel to toggle when doing double click
"); - poststr(request, "
(second textfield shows up when you change role to button and save...)
"); + poststr(request, "

The first textfield is used to enter channel index (relay index), used to support multiple relays and buttons. "); + poststr(request, "So, first button and first relay should have channel 1, second button and second relay have channel 2, etc.

"); + poststr(request, "

The second textfield (only for buttons) is used to enter channel to toggle when doing double click. "); + poststr(request, "It shows up when you change role to button and save.

"); #if PLATFORM_BK7231N || PLATFORM_BK7231T - poststr(request, "
BK7231N/BK7231T supports PWM only on pins 6, 7, 8, 9, 24 and 26!
"); + poststr(request, "

BK7231N/BK7231T supports PWM only on pins 6, 7, 8, 9, 24 and 26!

"); #endif for (i = 0; i < PLATFORM_GPIO_MAX; i++) { sprintf(tmpA, "%i", i); @@ -2714,7 +2714,7 @@ const char* g_obk_flagNames[] = { "[SM2135] Use separate RGB/CW modes instead of writing all 5 values as RGB", "[MQTT] Broadcast self state on MQTT connect", "[PWM] BK7231 use 600hz instead of 1khz default", - "[LED] remember LED driver state (RGBCW, enable, brightness, temperature) after reboot", + "[LED] Remember LED driver state (RGBCW, enable, brightness, temperature) after reboot", "[HTTP] Show actual PIN logic level for unconfigured pins", "[IR] Do MQTT publish (RAW STRING) for incoming IR data", "[IR] Allow 'unknown' protocol", @@ -2751,7 +2751,7 @@ const char* g_obk_flagNames[] = { "error", "error", "error", -}; +}; int http_fn_cfg_generic(http_request_t* request) { int i; char tmpA[64]; @@ -2788,7 +2788,7 @@ int http_fn_cfg_generic(http_request_t* request) { CFG_Save_IfThereArePendingChanges(); - hprintf255(request, "
Flags (Current value=%i)
", CFG_GetFlags()); + hprintf255(request, "

Flags (Current value=%i)

", CFG_GetFlags()); poststr(request, "
"); for (i = 0; i < OBK_TOTAL_FLAGS; i++) { @@ -2825,14 +2825,15 @@ int http_fn_cfg_startup(http_request_t* request) { http_setup(request, httpMimeTypeHTML); http_html_start(request, "Config startup"); - hprintf255(request, "
Here you can set pin start values
"); - hprintf255(request, "
For relays, simply use 1 or 0
"); - hprintf255(request, "
For 'remember last power state', use -1 as a special value
"); - hprintf255(request, "
For dimmers, range is 0 to 100
"); - hprintf255(request, "
For custom values, you can set any number you want to
"); - hprintf255(request, "
Remember that you can also use short startup command to run commands like led_baseColor #FF0000 and led_enableAll 1 etc
"); - hprintf255(request, "
Remembering last state of LED driver also fully you can set it in"); - hprintf255(request, "Options->General, set Flag 12 - [LED] remember LED driver state (RGBCW, enable, brightness, temperature) after reboot!
"); + poststr(request, "

Here you can set pin start values

"); + poststr(request, "
  • For relays, simply use 1 or 0
  • "); + poststr(request, "
  • To 'remember last power state', use -1 as a special value
  • "); + poststr(request, "
  • For dimmers, range is 0 to 100
  • "); + poststr(request, "
  • For custom values, you can set any numeric value
  • "); + poststr(request, "
  • Remember that you can also use short startup command to run commands like led_baseColor #FF0000 and led_enableAll 1 etc
  • "); + hprintf255(request, "
  • To remember last state of LED driver, set "); + hprintf255(request, "Flag 12 - %s", g_obk_flagNames[12]); + poststr(request, "
"); if (http_getArg(request->url, "idx", tmpA, sizeof(tmpA))) { channelIndex = atoi(tmpA); @@ -2849,23 +2850,19 @@ int http_fn_cfg_startup(http_request_t* request) { } } + poststr(request, "

New start values

"); + for (i = 0; i < CHANNEL_MAX; i++) { if (CHANNEL_IsInUse(i)) { - int startValue; + int startValue = CFG_GetChannelStartupValue(i); - startValue = CFG_GetChannelStartupValue(i); + poststr(request, ""); + hprintf255(request, "", i); - poststr(request, "
\ -
\ - "); - poststr(request, "
"); - poststr(request, "
"); + sprintf(tmpA, "Channel %i", i); + add_label_numeric_field(request, tmpA, "value", startValue, ""); + + poststr(request, "
"); } } @@ -2962,7 +2959,7 @@ int http_fn_cfg_dgr(http_request_t* request) { poststr(request, ">
"); } diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c index 101985eaa..5305b486e 100644 --- a/src/httpserver/new_http.c +++ b/src/httpserver/new_http.c @@ -718,11 +718,11 @@ See https://github.com/openshwprojects/OpenBK7231T_App/blob/main/BUILDING.md for */ //region_start htmlHeadStyle -const char htmlHeadStyle[] = ""; +const char htmlHeadStyle[] = ""; //region_end htmlHeadStyle //region_start pageScript -const char pageScript[] = ""; +const char pageScript[] = ""; //region_end pageScript //region_start ha_discovery_script diff --git a/src/httpserver/style.css b/src/httpserver/style.css index 0847e9d7f..539ec12be 100644 --- a/src/httpserver/style.css +++ b/src/httpserver/style.css @@ -107,6 +107,7 @@ a { border-radius: 0.3em; padding: 2px; margin: 6px 2px; + background: linear-gradient(to right, rgb(255, 160, 0), rgb(166, 209, 255)); } .hf { display: none; @@ -136,4 +137,33 @@ div#main { } table { table-layout: fixed; + width: 100%; +} + +.disp-none { + display: none; +} +.disp-inline { + display: inline-block; +} +.safe { + color: red; +} + +form.indent { + padding-left: 16px; +} + +li { + margin: 5px 0; /* Increase vertical spacing */ +} + +/* Toggle channel status */ +.on, +.off { + text-align: center; + font-size: 54px; +} +.on { + font-weight: bold; }