removed syslog_enable functionality and config

reordered config settings
pull/72/head
Benjamin Runnels 9 years ago
parent a895128c9f
commit ac04cc58a8
  1. 6
      esp-link/cgiservices.c
  2. 8
      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

@ -108,8 +108,7 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
if (connData->conn == NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up.
os_sprintf(buff,
"{ "
"\"syslog_enable\": \"%s\", "
"{ "
"\"syslog_host\": \"%s\", "
"\"syslog_minheap\": %d, "
"\"syslog_filter\": %d, "
@ -120,7 +119,6 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
"\"mdns_enable\": \"%s\", "
"\"mdns_servername\": \"%s\""
" }",
flashConfig.syslog_enable ? "enabled" : "disabled",
flashConfig.syslog_host,
flashConfig.syslog_minheap,
flashConfig.syslog_filter,
@ -142,8 +140,6 @@ int ICACHE_FLASH_ATTR cgiServicesSet(HttpdConnData *connData) {
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));
if (syslog < 0) return HTTPD_CGI_DONE;
syslog |= getUInt16Arg(connData, "syslog_minheap", &flashConfig.syslog_minheap);

@ -27,10 +27,10 @@ FlashConfig flashDefault = {
.mqtt_host = "\0", .mqtt_clientid = "\0",
.mqtt_username= "\0", .mqtt_password = "\0", .mqtt_status_topic = "\0",
.sys_descr = "\0",
.rx_pullup = 1,
.mdns_enable = 1, .mdns_servername = "http\0",
.sntp_server = "us.pool.ntp.org\0", .timezone_offset = 0,
.syslog_enable= 0, .syslog_host = "\0", .syslog_minheap = 8192, .syslog_filter = 7, .syslog_showtick = 1, .syslog_showdate = 0,
.rx_pullup = 1,
.sntp_server = "us.pool.ntp.org\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 {

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

@ -12,11 +12,6 @@
<div id="syslog-spinner" class="spinner spinner-small"></div>
</h1>
<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>
<div class="pure-form-stacked">
<label>Syslog Host</label>

@ -53,16 +53,13 @@ function displayServices(data) {
var i, inputs = $("input");
for (i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox" && (inputs[i].name == "syslog_enable" || inputs[i].name == "mdns_enable"))
inputs[i].onclick = function () { setService(this.name, this.checked) };
if (inputs[i].name == "mdns_enable") inputs[i].onclick = function () { setMDNS(this.checked) };
}
}
function setService(name, v) {
ajaxSpin("POST", "/services/update?" + name + "=" + (v ? 1 : 0), function () {
var n = name.replace("_enable", "");
n = (n == "syslog") ? "Syslog" : "mDNS";
showNotification(n + " is now " + (v ? "enabled" : "disabled"));
function setMDNS(v) {
ajaxSpin("POST", "/services/update?mdns_enable=" + (v ? 1 : 0), function () {
showNotification("mDNS is now " + (v ? "enabled" : "disabled"));
}, function () {
showWarning("Enable/disable failed");
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)
{
if (!flashConfig.syslog_enable) {
syslog_host[0] = '\0';
if (!*syslog_host) {
syslogState = SYSLOG_HALTED;
return;
}
char host[32], *port = &host[0];

Loading…
Cancel
Save