button to force screen reset
This commit is contained in:
@@ -41,6 +41,8 @@ pg('help', 'cfg page-help', 'help', '/help');
|
||||
pg('about', 'cfg page-about', 'about', '/about');
|
||||
pg('term', 'term', '', '/', 'title.term');
|
||||
|
||||
pg('reset_screen', 'api', '', '/system/cls', 'title.term');
|
||||
|
||||
// ajax API
|
||||
|
||||
return $pages;
|
||||
|
||||
@@ -40,6 +40,7 @@ return [
|
||||
|
||||
'term.example' => 'Default colors preview',
|
||||
|
||||
'term.reset_screen' => 'Reset screen & parser',
|
||||
'term.term_title' => 'Header text',
|
||||
'term.term_width' => 'Width / height',
|
||||
'term.default_fg_bg' => 'Text / background',
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<div class="Box">
|
||||
<a href="<?= e(url('reset_screen')) ?>"><?= tr('term.reset_screen') ?></a>
|
||||
</div>
|
||||
|
||||
<form class="Box mobopen str" action="<?= e(url('term_set')) ?>" method="GET" id='form-1'>
|
||||
<h2><?= tr('term.defaults') ?></h2>
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ ansi_parser_reset(void) {
|
||||
cs = ansi_start;
|
||||
inside_string = false;
|
||||
apars_reset_utf8buffer();
|
||||
ansi_warn("Parser timeout, state reset");
|
||||
ansi_warn("Parser state reset (timeout?)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ ansi_parser_reset(void) {
|
||||
cs = ansi_start;
|
||||
inside_string = false;
|
||||
apars_reset_utf8buffer();
|
||||
ansi_warn("Parser timeout, state reset");
|
||||
ansi_warn("Parser state reset (timeout?)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "persist.h"
|
||||
#include "syscfg.h"
|
||||
#include "uart_driver.h"
|
||||
#include "ansi_parser.h"
|
||||
|
||||
#define SET_REDIR_SUC "/cfg/system"
|
||||
#define SET_REDIR_ERR SET_REDIR_SUC"?err="
|
||||
@@ -18,6 +19,22 @@ static void ICACHE_FLASH_ATTR tmrCb(void *arg)
|
||||
system_restart();
|
||||
}
|
||||
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiResetScreen(HttpdConnData *connData)
|
||||
{
|
||||
if (connData->conn==NULL) {
|
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
info("--- User request to reset screen! ---");
|
||||
// this copies termconf to scratch and also resets the screen
|
||||
terminal_apply_settings();
|
||||
ansi_parser_reset();
|
||||
|
||||
httpdRedirect(connData, "/");
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR cgiResetDevice(HttpdConnData *connData)
|
||||
{
|
||||
if (connData->conn==NULL) {
|
||||
|
||||
@@ -8,5 +8,6 @@ httpd_cgi_state cgiPing(HttpdConnData *connData);
|
||||
httpd_cgi_state cgiResetDevice(HttpdConnData *connData);
|
||||
httpd_cgi_state cgiSystemCfgSetParams(HttpdConnData *connData);
|
||||
httpd_cgi_state tplSystemCfg(HttpdConnData *connData, char *token, void **arg);
|
||||
httpd_cgi_state cgiResetScreen(HttpdConnData *connData);
|
||||
|
||||
#endif // CGI_PING_H
|
||||
|
||||
@@ -38,6 +38,7 @@ HttpdBuiltInUrl routes[] = {
|
||||
// --- System control ---
|
||||
ROUTE_CGI("/system/reset/?", cgiResetDevice),
|
||||
ROUTE_CGI("/system/ping/?", cgiPing),
|
||||
ROUTE_CGI("/system/cls/?", cgiResetScreen),
|
||||
|
||||
// --- WiFi config --- (TODO make this conditional and configurable)
|
||||
#if WIFI_PROTECT
|
||||
|
||||
Reference in New Issue
Block a user