more cleansing on DBG macro

Because espmissingincludes.h contains a properly escaped definition
for os_printf() macro, we can simplify the DBG definition.
pull/95/head
susisstrolch 9 years ago
parent 57011de179
commit 5fd831a27c
  1. 14
      cmd/cmd.c
  2. 2
      cmd/handlers.c
  3. 6
      esp-link/cgi.c
  4. 4
      esp-link/cgiflash.c
  5. 6
      esp-link/cgimqtt.c
  6. 2
      esp-link/cgioptiboot.c
  7. 12
      esp-link/cgiservices.c
  8. 2
      esp-link/cgiwifi.c
  9. 2
      esp-link/log.c
  10. 2
      esp-link/mqtt_client.c
  11. 2
      httpd/httpd.c
  12. 2
      mqtt/mqtt_cmd.c
  13. 2
      serial/slip.c
  14. 2
      syslog/syslog.c
  15. 2
      user/user_main.c

@ -8,7 +8,7 @@
#include "uart.h"
#ifdef CMD_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
static const char *cmd_names[] = {
"NULL", "RESET", "IS_READY", "WIFI_CONNECT",
"MQTT_SETUP", "MQTT_CONNECT", "MQTT_DISCONNECT",
@ -124,17 +124,17 @@ CMD_parse_packet(uint8_t *buf, short len) {
CmdPacket *packet = (CmdPacket*)buf;
uint8_t *data_ptr = (uint8_t*)&packet->args;
uint8_t *data_limit = data_ptr+len;
DBG("CMD_parse_packet: cmd=%d(%s) argc=%d cb=%p ret=%lu\n",
packet->cmd,
cmd_names[packet->cmd],
packet->argc,
(void *)packet->callback,
packet->cmd,
cmd_names[packet->cmd],
packet->argc,
(void *)packet->callback,
packet->_return
);
#if 0
// print out arguments
// print out arguments
uint16_t argn = 0;
uint16_t argc = packet->argc;
while (data_ptr+2 < data_limit && argc--) {

@ -13,7 +13,7 @@
#endif
#ifdef CMD_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -18,7 +18,7 @@ Some random cgi routines.
#include "config.h"
#ifdef CGI_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif
@ -202,7 +202,7 @@ int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) {
os_strncpy(name, flashConfig.hostname, 12);
name[12] = 0;
// construct json response
os_sprintf(buff,
os_sprintf(buff,
"{ "
"\"menu\": [ "
"\"Home\", \"/home.html\", "
@ -216,7 +216,7 @@ int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) {
" ], "
"\"version\": \"%s\", "
"\"name\": \"%s\""
" }",
" }",
esp_link_version, name);
httpdSend(connData, buff, -1);

@ -20,7 +20,7 @@ Some flash handling cgi routines. Used for reading the existing flash and updati
#include "cgiflash.h"
#ifdef CGIFLASH_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif
@ -197,4 +197,4 @@ int ICACHE_FLASH_ATTR cgiReset(HttpdConnData *connData) {
os_timer_setfn(&flash_reboot_timer, (os_timer_func_t *)system_restart, NULL);
os_timer_arm(&flash_reboot_timer, 2000, 1);
return HTTPD_CGI_DONE;
}
}

@ -17,7 +17,7 @@ char *mqttState(void) {
#include "cgimqtt.h"
#ifdef CGIMQTT_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif
@ -134,7 +134,7 @@ int ICACHE_FLASH_ATTR cgiMqttSet(HttpdConnData *connData) {
mqtt_client_init();
// if just enable changed we just need to bounce the client
}
}
else if (mqtt_en_chg > 0) {
DBG("MQTT server enable=%d changed\n", flashConfig.mqtt_enable);
if (flashConfig.mqtt_enable && strlen(flashConfig.mqtt_host) > 0)
@ -154,7 +154,7 @@ int ICACHE_FLASH_ATTR cgiMqttSet(HttpdConnData *connData) {
// if SLIP-enable is toggled it gets picked-up immediately by the parser
int slip_update = getBoolArg(connData, "slip-enable", &flashConfig.slip_enable);
if (slip_update < 0) return HTTPD_CGI_DONE;
if (slip_update > 0)
if (slip_update > 0)
DBG("SLIP-enable changed: %d\n", flashConfig.slip_enable);
DBG("Saving config\n");

@ -17,7 +17,7 @@
#define PGM_INTERVAL 200 // send sync at this interval in ms when in programming mode
#ifdef OPTIBOOT_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -7,7 +7,7 @@
#include "cgimqtt.h"
#ifdef CGISERVICES_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif
@ -92,10 +92,10 @@ int ICACHE_FLASH_ATTR cgiSystemInfo(HttpdConnData *connData) {
}
void ICACHE_FLASH_ATTR cgiServicesSNTPInit() {
if (flashConfig.sntp_server[0] != '\0') {
if (flashConfig.sntp_server[0] != '\0') {
sntp_stop();
if (true == sntp_set_timezone(flashConfig.timezone_offset)) {
sntp_setservername(0, flashConfig.sntp_server);
sntp_setservername(0, flashConfig.sntp_server);
sntp_init();
}
DBG("SNTP timesource set to %s with offset %d\n", flashConfig.sntp_server, flashConfig.timezone_offset);
@ -107,7 +107,7 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
if (connData->conn == NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up.
os_sprintf(buff,
os_sprintf(buff,
"{ "
"\"syslog_host\": \"%s\", "
"\"syslog_minheap\": %d, "
@ -118,7 +118,7 @@ int ICACHE_FLASH_ATTR cgiServicesInfo(HttpdConnData *connData) {
"\"sntp_server\": \"%s\", "
"\"mdns_enable\": \"%s\", "
"\"mdns_servername\": \"%s\""
" }",
" }",
flashConfig.syslog_host,
flashConfig.syslog_minheap,
flashConfig.syslog_filter,
@ -168,7 +168,7 @@ int ICACHE_FLASH_ATTR cgiServicesSet(HttpdConnData *connData) {
int8_t mdns = 0;
mdns |= getBoolArg(connData, "mdns_enable", &flashConfig.mdns_enable);
if (mdns < 0) return HTTPD_CGI_DONE;
if (mdns > 0) {
if (flashConfig.mdns_enable){
DBG("Services: MDNS Enabled\n");

@ -22,7 +22,7 @@ Cgi/template routines for the /wifi url.
#include "syslog.h"
#ifdef CGIWIFI_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -7,7 +7,7 @@
#include "log.h"
#ifdef LOG_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -5,7 +5,7 @@
#include "mqtt.h"
#ifdef MQTTCLIENT_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__) } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -18,7 +18,7 @@ Esp8266 http server - core routines
#include "httpd.h"
#ifdef HTTPD_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...)os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -8,7 +8,7 @@
#include "mqtt_cmd.h"
#ifdef MQTTCMD_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -8,7 +8,7 @@
#include "cmd.h"
#ifdef SLIP_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -17,7 +17,7 @@
extern void * mem_trim(void *m, size_t s); // not well documented...
#ifdef SYSLOG_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

@ -4,7 +4,7 @@
#define APPINIT_DBG
#ifdef APPINIT_DBG
#define DBG(format, ...) do { os_printf(format, ## __VA_ARGS__); } while(0)
#define DBG(format, ...) os_printf(format, ## __VA_ARGS__)
#else
#define DBG(format, ...) do { } while(0)
#endif

Loading…
Cancel
Save