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

Loading…
Cancel
Save