removed syslog_enable functionality and config

reordered config settings
pull/72/head
Benjamin Runnels 9 years ago
parent a895128c9f
commit ac04cc58a8
  1. 4
      esp-link/cgiservices.c
  2. 6
      esp-link/config.c
  3. 9
      esp-link/config.h
  4. 5
      html/services.html
  5. 11
      html/services.js
  6. 5
      syslog/syslog.c

@ -109,7 +109,6 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
os_sprintf(buff, os_sprintf(buff,
"{ " "{ "
"\"syslog_enable\": \"%s\", "
"\"syslog_host\": \"%s\", " "\"syslog_host\": \"%s\", "
"\"syslog_minheap\": %d, " "\"syslog_minheap\": %d, "
"\"syslog_filter\": %d, " "\"syslog_filter\": %d, "
@ -120,7 +119,6 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
"\"mdns_enable\": \"%s\", " "\"mdns_enable\": \"%s\", "
"\"mdns_servername\": \"%s\"" "\"mdns_servername\": \"%s\""
" }", " }",
flashConfig.syslog_enable ? "enabled" : "disabled",
flashConfig.syslog_host, flashConfig.syslog_host,
flashConfig.syslog_minheap, flashConfig.syslog_minheap,
flashConfig.syslog_filter, flashConfig.syslog_filter,
@ -142,8 +140,6 @@ int ICACHE_FLASH_ATTR cgiServicesSet(HttpdConnData *connData) {
int8_t syslog = 0; int8_t syslog = 0;
syslog |= getBoolArg(connData, "syslog_enable", &flashConfig.syslog_enable);
if (syslog < 0) return HTTPD_CGI_DONE;
syslog |= getStringArg(connData, "syslog_host", flashConfig.syslog_host, sizeof(flashConfig.syslog_host)); syslog |= getStringArg(connData, "syslog_host", flashConfig.syslog_host, sizeof(flashConfig.syslog_host));
if (syslog < 0) return HTTPD_CGI_DONE; if (syslog < 0) return HTTPD_CGI_DONE;
syslog |= getUInt16Arg(connData, "syslog_minheap", &flashConfig.syslog_minheap); syslog |= getUInt16Arg(connData, "syslog_minheap", &flashConfig.syslog_minheap);

@ -28,9 +28,9 @@ FlashConfig flashDefault = {
.mqtt_username= "\0", .mqtt_password = "\0", .mqtt_status_topic = "\0", .mqtt_username= "\0", .mqtt_password = "\0", .mqtt_status_topic = "\0",
.sys_descr = "\0", .sys_descr = "\0",
.rx_pullup = 1, .rx_pullup = 1,
.mdns_enable = 1, .mdns_servername = "http\0", .sntp_server = "us.pool.ntp.org\0",
.sntp_server = "us.pool.ntp.org\0", .timezone_offset = 0, .syslog_host = "\0", .syslog_minheap = 8192, .syslog_filter = 7, .syslog_showtick = 1, .syslog_showdate = 0,
.syslog_enable= 0, .syslog_host = "\0", .syslog_minheap = 8192, .syslog_filter = 7, .syslog_showtick = 1, .syslog_showdate = 0, .mdns_enable = 1, .mdns_servername = "http\0", .timezone_offset = 0
}; };
typedef union { typedef union {

@ -28,16 +28,15 @@ typedef struct {
mqtt_status_topic[32]; mqtt_status_topic[32];
char sys_descr[129]; // system description char sys_descr[129]; // system description
int8_t rx_pullup; // internal pull-up on RX pin int8_t rx_pullup; // internal pull-up on RX pin
uint8_t mdns_enable; char sntp_server[32];
char mdns_servername[32],
sntp_server[32];
int8_t timezone_offset;
uint8_t syslog_enable;
char syslog_host[32]; char syslog_host[32];
uint16_t syslog_minheap; // min. heap to allow queuing uint16_t syslog_minheap; // min. heap to allow queuing
uint8_t syslog_filter, // min. severity uint8_t syslog_filter, // min. severity
syslog_showtick, // show system tick (µs) syslog_showtick, // show system tick (µs)
syslog_showdate; // populate SYSLOG date field syslog_showdate; // populate SYSLOG date field
uint8_t mdns_enable;
char mdns_servername[32];
int8_t timezone_offset;
} FlashConfig; } FlashConfig;
extern FlashConfig flashConfig; extern FlashConfig flashConfig;

@ -12,11 +12,6 @@
<div id="syslog-spinner" class="spinner spinner-small"></div> <div id="syslog-spinner" class="spinner spinner-small"></div>
</h1> </h1>
<form action="#" id="Syslog-form" class="pure-form" hidden> <form action="#" id="Syslog-form" class="pure-form" hidden>
<div class="form-horizontal">
<label>Enable syslog</label>
<input type="checkbox" name="syslog_enable"/>
</div>
<br>
<legend>Syslog settings</legend> <legend>Syslog settings</legend>
<div class="pure-form-stacked"> <div class="pure-form-stacked">
<label>Syslog Host</label> <label>Syslog Host</label>

@ -53,16 +53,13 @@ function displayServices(data) {
var i, inputs = $("input"); var i, inputs = $("input");
for (i = 0; i < inputs.length; i++) { for (i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox" && (inputs[i].name == "syslog_enable" || inputs[i].name == "mdns_enable")) if (inputs[i].name == "mdns_enable") inputs[i].onclick = function () { setMDNS(this.checked) };
inputs[i].onclick = function () { setService(this.name, this.checked) };
} }
} }
function setService(name, v) { function setMDNS(v) {
ajaxSpin("POST", "/services/update?" + name + "=" + (v ? 1 : 0), function () { ajaxSpin("POST", "/services/update?mdns_enable=" + (v ? 1 : 0), function () {
var n = name.replace("_enable", ""); showNotification("mDNS is now " + (v ? "enabled" : "disabled"));
n = (n == "syslog") ? "Syslog" : "mDNS";
showNotification(n + " is now " + (v ? "enabled" : "disabled"));
}, function () { }, function () {
showWarning("Enable/disable failed"); showWarning("Enable/disable failed");
window.setTimeout(fetchServices, 100); window.setTimeout(fetchServices, 100);

@ -240,8 +240,9 @@ static void ICACHE_FLASH_ATTR syslog_gethostbyname_cb(const char *name, ip_addr_
*******************************************************************************/ *******************************************************************************/
void ICACHE_FLASH_ATTR syslog_init(char *syslog_host) void ICACHE_FLASH_ATTR syslog_init(char *syslog_host)
{ {
if (!flashConfig.syslog_enable) { if (!*syslog_host) {
syslog_host[0] = '\0'; syslogState = SYSLOG_HALTED;
return;
} }
char host[32], *port = &host[0]; char host[32], *port = &host[0];

Loading…
Cancel
Save