You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
485 B
27 lines
485 B
#include "cgi_reset.h"
|
|
|
|
static ETSTimer tmr;
|
|
|
|
static void FLASH_FN tmrCb(void *arg)
|
|
{
|
|
system_restart();
|
|
}
|
|
|
|
int FLASH_FN cgiResetDevice(HttpdConnData *connData)
|
|
{
|
|
if (connData->conn==NULL) {
|
|
//Connection aborted. Clean up.
|
|
return HTTPD_CGI_DONE;
|
|
}
|
|
|
|
httpdStartResponse(connData, 200);
|
|
httpdEndHeaders(connData);
|
|
|
|
os_timer_disarm(&tmr);
|
|
os_timer_setfn(&tmr, tmrCb, NULL);
|
|
os_timer_arm(&tmr, 100, false);
|
|
|
|
httpdSend(connData, "system reset\n", -1);
|
|
|
|
return HTTPD_CGI_DONE;
|
|
}
|
|
|