mirror of
https://github.com/jeelabs/esp-link.git
synced 2026-02-20 02:31:19 +01:00
- add ajax /console/clear - fix #348
This commit is contained in:
committed by
Thorsten von Eicken
parent
03bea3dd2d
commit
9d5bfffc14
@@ -88,6 +88,7 @@ HttpdBuiltInUrl builtInUrls[] = {
|
||||
{ "/log/reset", cgiReset, NULL },
|
||||
{ "/console/reset", ajaxConsoleReset, NULL },
|
||||
{ "/console/baud", ajaxConsoleBaud, NULL },
|
||||
{ "/console/clear", ajaxConsoleClear, NULL },
|
||||
{ "/console/fmt", ajaxConsoleFormat, NULL },
|
||||
{ "/console/text", ajaxConsole, NULL },
|
||||
{ "/console/send", ajaxConsoleSend, NULL },
|
||||
|
||||
@@ -91,7 +91,10 @@
|
||||
$("#clear-button").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var co = $("#console");
|
||||
co.innerHTML = "";
|
||||
ajaxSpin('POST', "/console/clear",
|
||||
function(resp) { showNotification("uC buffer cleared"); co.innerHTML = ""; co.textEnd = 0;},
|
||||
function(s, st) { showWarning("Error clearing buffer in uC"); }
|
||||
);
|
||||
});
|
||||
|
||||
ajaxJson('GET', "/console/baud",
|
||||
|
||||
@@ -59,6 +59,15 @@ ajaxConsoleReset(HttpdConnData *connData) {
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
int ICACHE_FLASH_ATTR
|
||||
ajaxConsoleClear(HttpdConnData *connData) {
|
||||
if (connData->conn==NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up.
|
||||
jsonHeader(connData, 200);
|
||||
//reset buffer
|
||||
console_rd = console_wr = console_pos = 0;
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
int ICACHE_FLASH_ATTR
|
||||
ajaxConsoleBaud(HttpdConnData *connData) {
|
||||
if (connData->conn==NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up.
|
||||
|
||||
@@ -7,6 +7,7 @@ void consoleInit(void);
|
||||
void ICACHE_FLASH_ATTR console_write_char(char c);
|
||||
int ajaxConsole(HttpdConnData *connData);
|
||||
int ajaxConsoleReset(HttpdConnData *connData);
|
||||
int ajaxConsoleClear(HttpdConnData *connData);
|
||||
int ajaxConsoleBaud(HttpdConnData *connData);
|
||||
int ajaxConsoleFormat(HttpdConnData *connData);
|
||||
int ajaxConsoleSend(HttpdConnData *connData);
|
||||
|
||||
Reference in New Issue
Block a user