diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c
index 375c180bb..7b0ad36cf 100644
--- a/src/httpserver/http_fns.c
+++ b/src/httpserver/http_fns.c
@@ -114,10 +114,15 @@ int http_fn_index(http_request_t *request) {
bRawPWMs = CFG_HasFlag(OBK_FLAG_LED_RAWCHANNELSMODE);
forceShowRGBCW = CFG_HasFlag(OBK_FLAG_LED_FORCESHOWRGBCWCONTROLLER);
- http_setup(request, httpMimeTypeHTML);
- poststr(request,htmlHeader);
- //poststr(request,"");
- HTTP_AddHeader(request);
+ // use ?state URL parameter to only request current state
+ if(!http_getArg(request->url, "state", tmpA, sizeof(tmpA))) {
+ http_setup(request, httpMimeTypeHTML);
+ poststr(request,htmlHeader);
+ //poststr(request,"");
+ HTTP_AddHeader(request);
+ poststr(request, "
"); // replaceable content follows
+ }
+
if(http_getArg(request->url,"tgl",tmpA,sizeof(tmpA))) {
j = atoi(tmpA);
if(j == SPECIAL_CHANNEL_LEDPOWER) {
@@ -455,16 +460,6 @@ int http_fn_index(http_request_t *request) {
RESET_ScheduleModuleReset(3);
}
- poststr(request,"");
-
- poststr(request," ");
-
- poststr(request," ");
- poststr(request,"");
-
if(1) {
int bFirst = true;
hprintf128(request,"
");
@@ -486,10 +481,53 @@ int http_fn_index(http_request_t *request) {
hprintf128(request,"Ping watchdog - %i lost, %i ok! ",
PingWatchDog_GetTotalLost(),PingWatchDog_GetTotalReceived());
+ // for normal page loads, show the rest of the HTML
+ if(!http_getArg(request->url,"state",tmpA,sizeof(tmpA))) {
+ poststr(request, " "); // end id=statediv
- poststr(request,htmlRefresh);
- HTTP_AddBuildFooter(request);
- poststr(request,htmlEnd);
+ // Shared UI elements
+ poststr(request,"");
+
+ poststr(request," ");
+
+ poststr(request," ");
+ poststr(request,"");
+
+ poststr(request,htmlRefresh);
+ HTTP_AddBuildFooter(request);
+
+ // refresh status section every 3 seconds
+ poststr(
+ request,
+ ""
+ );
+
+ poststr(request,htmlEnd);
+ }
poststr(request, NULL);
return 0;
diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c
index 72531c8c8..e2cecb959 100644
--- a/src/httpserver/new_http.c
+++ b/src/httpserver/new_http.c
@@ -295,12 +295,14 @@ void setupAllWB2SPinsAsButtons() {
PIN_SetPinChannelForPinIndex(27,1);
}
-
-
-
-const char *g_header_start = "";
-
+const char *g_header_start =
+ "To use this device, please enable JavaScript. "
+ "";
void HTTP_AddHeader(http_request_t *request) {
poststr(request,g_header_start);
@@ -320,9 +322,9 @@ void HTTP_AddBuildFooter(http_request_t *request) {
WiFI_GetMacAddress((char *)mac);
- sprintf(upTimeStr," Device MAC: %02X%02X%02X%02X%02X%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
+ sprintf(upTimeStr," Device MAC: %02X:%02X:%02X:%02X:%02X:%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
poststr(request,upTimeStr);
- sprintf(upTimeStr," Short name: %s, Chipset %s",CFG_GetShortDeviceName(),PLATFORM_MCU_NAME);
+ sprintf(upTimeStr," Short name: %s, Chipset %s",CFG_GetShortDeviceName(),PLATFORM_MCU_NAME);
poststr(request,upTimeStr);
}