Browse Source

Убрал поддержку обновления через обновление страницы полностью.

master
Nikita Romanenko 7 years ago
parent
commit
03ce0ee039
  1. 14
      src/html.h
  2. 8
      src/main.cpp

14
src/html.h

@ -5,8 +5,7 @@ enum parts
HTML_BEGIN, HTML_BEGIN,
HTML_END, HTML_END,
STYLE, STYLE,
SCRIPT_BEGIN, SCRIPT
SCRIPT_END
}; };
const char html_begin[] PROGMEM = { const char html_begin[] PROGMEM = {
@ -54,7 +53,7 @@ const char style[] PROGMEM = {
Браузер устарел!\n\ Браузер устарел!\n\
</canvas>\n"}; </canvas>\n"};
const char script_begin[] PROGMEM = { const char script[] PROGMEM = {
"<script>\n\ "<script>\n\
var socket = new WebSocket(\"ws://192.168.4.1:81\");\n\ var socket = new WebSocket(\"ws://192.168.4.1:81\");\n\
var i, data;\n\ var i, data;\n\
@ -82,8 +81,6 @@ const char script_begin[] PROGMEM = {
</script>\n\ </script>\n\
"}; "};
const char script_end[] PROGMEM = {""};
const char html_end[] PROGMEM = { const char html_end[] PROGMEM = {
"<div class=\"clear\"></div>\n\ "<div class=\"clear\"></div>\n\
</div>\n\ </div>\n\
@ -108,11 +105,8 @@ static int getHtml(parts p, char &adr, uint16_t buf_size, uint16_t bias)
case STYLE: case STYLE:
html_part = style; html_part = style;
break; break;
case SCRIPT_BEGIN: case SCRIPT:
html_part = script_begin; html_part = script;
break;
case SCRIPT_END:
html_part = script_end;
break; break;
} }
length = strlen_P(html_part); length = strlen_P(html_part);

8
src/main.cpp

@ -29,13 +29,7 @@ void handleAccelerometer()
bias += getHtml(HTML_BEGIN, *html_code, arr_size, 0); bias += getHtml(HTML_BEGIN, *html_code, arr_size, 0);
bias += getHtml(STYLE, *html_code, arr_size, bias); bias += getHtml(STYLE, *html_code, arr_size, bias);
bias += getHtml(SCRIPT_BEGIN, *html_code, arr_size, bias); bias += getHtml(SCRIPT, *html_code, arr_size, bias);
// for (int i = 0; i != graphAcc.graphSize - 1; i++)
// {
// bias += snprintf((html_code + bias), arr_size - bias, "context.lineTo(%i*2, %i);\n", i, graphAcc.graphArray[i]);
// }
bias += getHtml(SCRIPT_END, *html_code, arr_size, bias);
//bias += snprintf((html_code+bias), arr_size - bias, "<br />Current accelerometer: %i", acc);
bias += getHtml(HTML_END, *html_code, arr_size, bias); bias += getHtml(HTML_END, *html_code, arr_size, bias);
server.send(200, "text/html", html_code); server.send(200, "text/html", html_code);

Loading…
Cancel
Save