mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-14 00:45:57 +08:00
Add commands to clear logs
[ESP999]ERROR for error logs, [ESP999]INFO for info logs, [ESP999]STATUS for status logs, [ESP999]ALL for all logs,
This commit is contained in:
parent
afa0eddcf0
commit
aa5f7e12d1
@ -95,6 +95,26 @@ void COMMAND::execute_command(int cmd,String cmd_params)
|
||||
Serial.print("\r\n");
|
||||
}
|
||||
break;
|
||||
case 999:
|
||||
if (cmd_params=="ERROR")
|
||||
{
|
||||
web_interface->error_msg.clear();
|
||||
}
|
||||
else if (cmd_params=="INFO")
|
||||
{
|
||||
web_interface->info_msg.clear();
|
||||
}
|
||||
else if (cmd_params=="STATUS")
|
||||
{
|
||||
web_interface->status_msg.clear();
|
||||
}
|
||||
else if (cmd_params=="ALL")
|
||||
{
|
||||
web_interface->error_msg.clear();
|
||||
web_interface->status_msg.clear();
|
||||
web_interface->info_msg.clear();
|
||||
}
|
||||
break;
|
||||
//default:
|
||||
|
||||
}
|
||||
|
@ -37,9 +37,27 @@ $INCLUDE[header.inc]$
|
||||
<tr><td><table width="100%"><tr><td width="auto"><label>Command:</label></td>
|
||||
<td width="100%"><input class="form-control" id="cmd" type="text" style="width: 100%;"></td>
|
||||
<td width="auto"><input type="button" class="btn btn-primary" value="Send" onclick="Sendcustomcommand();"></td></tr></table></td></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Info:</label></td><td width=100% id="infomsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Error:</label></td><td width=100% id="errormsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Status:</label></td><td width=100% id="statusmsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Info:</label><br>
|
||||
<center><table><tr><td><div class="btnimg" onclick="if(confirm('Clear Info log ?'))Sendcommand('[ESP999]INFO');">
|
||||
<svg height="20" width="20" viewBox="0 0 40 40" >";
|
||||
<circle cx="20" cy="20" r="17" stroke="black" stroke-width="1" fill="red" />
|
||||
<line x1="11" y1="11" x2="29" y2="29" style="stroke:white;stroke-width:6" />
|
||||
<line x1="29" y1="11" x2="11" y2="29" style="stroke:white;stroke-width:6" /></svg></div></td></tr></table></center>
|
||||
</td><td width=100% id="infomsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Error:</label><br>
|
||||
<center><table><tr><td><div class="btnimg" onclick="if(confirm('Clear Error log ?'))Sendcommand('[ESP999]ERROR');">
|
||||
<svg height="20" width="20" viewBox="0 0 40 40" >";
|
||||
<circle cx="20" cy="20" r="17" stroke="black" stroke-width="1" fill="red" />
|
||||
<line x1="11" y1="11" x2="29" y2="29" style="stroke:white;stroke-width:6" />
|
||||
<line x1="29" y1="11" x2="11" y2="29" style="stroke:white;stroke-width:6" /></svg></div></td></tr></table></center>
|
||||
</td><td width=100% id="errormsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td><label>Status:</label><br>
|
||||
<center><table><tr><td><div class="btnimg" onclick="if(confirm('Clear Status log ?'))Sendcommand('[ESP999]STATUS');">
|
||||
<svg height="20" width="20" viewBox="0 0 40 40" >";
|
||||
<circle cx="20" cy="20" r="17" stroke="black" stroke-width="1" fill="red" />
|
||||
<line x1="11" y1="11" x2="29" y2="29" style="stroke:white;stroke-width:6" />
|
||||
<line x1="29" y1="11" x2="11" y2="29" style="stroke:white;stroke-width:6" /></svg></div></td></tr></table></center>
|
||||
</td><td width=100% id="statusmsg" class="text-info"></td></tr></table></tr>
|
||||
<tr><td><hr></td></tr><tr><td><table><tr><td class="btnimg" onclick="Sendcommand('M24');">
|
||||
<svg width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="18" stroke="black" stroke-width="2" fill="white" /><polygon points="15,10 30,20 15,30" fill:"white" stroke:"white" stroke-width:"1" /></svg></td>
|
||||
<td class="btnimg" onclick="Sendcommand('M25');"><svg width="40" height="40" viewBox="0 0 40 40"> <circle cx="20" cy="20" r="18" stroke="black" stroke-width="2" fill="white" />
|
||||
|
@ -32,6 +32,7 @@ extern "C" {
|
||||
#include <FS.h>
|
||||
#include "LinkedList.h"
|
||||
#include "storestrings.h"
|
||||
#include "command.h"
|
||||
|
||||
#ifdef SSDP_FEATURE
|
||||
#include <ESP8266SSDP.h>
|
||||
@ -3091,6 +3092,25 @@ void handle_web_command()
|
||||
Serial.println(scmd);
|
||||
//give an ack - we need to be polite, right ?
|
||||
web_interface->WebServer.send(200,"text/plain","Ok");
|
||||
//if it is for ESP module [ESPXXX]<parameter>
|
||||
int ESPpos = scmd.indexOf("[ESP");
|
||||
if (ESPpos>-1)
|
||||
{//is there the second part?
|
||||
int ESPpos2 = scmd.indexOf("]",ESPpos);
|
||||
if (ESPpos2>-1)
|
||||
{ //Split in command and parameters
|
||||
String cmd_part1=scmd.substring(ESPpos+4,ESPpos2);
|
||||
String cmd_part2="";
|
||||
//is there space for parameters?
|
||||
if (ESPpos2<scmd.length())
|
||||
{
|
||||
cmd_part2=scmd.substring(ESPpos2+1);
|
||||
}
|
||||
//if command is a valid number then execute command
|
||||
if(cmd_part1.toInt()!=0)COMMAND::execute_command(cmd_part1.toInt(),cmd_part2);
|
||||
//if not is not a valid [ESPXXX] command
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user