diff --git a/TC1/http_server/app_httpd.h b/TC1/http_server/app_httpd.h index 7b5490a..3fec0f2 100644 --- a/TC1/http_server/app_httpd.h +++ b/TC1/http_server/app_httpd.h @@ -34,7 +34,7 @@ #define HTTP_CONTENT_HTML_ZIP "text/html\r\nContent-Encoding: gzip" -#define app_httpd_log(M, ...) custom_log("apphttpd", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) +#define app_httpd_log(M, ...) do { custom_log("apphttpd", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0) #define HTTPD_HDR_DEFORT (HTTPD_HDR_ADD_SERVER|HTTPD_HDR_ADD_CONN_CLOSE|HTTPD_HDR_ADD_PRAGMA_NO_CACHE) diff --git a/TC1/main.c b/TC1/main.c index 846b99e..5d6046f 100644 --- a/TC1/main.c +++ b/TC1/main.c @@ -10,7 +10,7 @@ #include "http_server/app_httpd.h" #include "timed_task/timed_task.h" -#define os_log(format, ...) custom_log("TC1", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("TC1", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) char rtc_init = 0; //sntp校时成功标志位 uint32_t total_time = 0; diff --git a/TC1/mqtt_server/user_function.c b/TC1/mqtt_server/user_function.c index e3c30a5..040a50e 100644 --- a/TC1/mqtt_server/user_function.c +++ b/TC1/mqtt_server/user_function.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("FUNCTION", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("FUNCTION", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "TimeUtils.h" diff --git a/TC1/mqtt_server/user_mqtt_client.c b/TC1/mqtt_server/user_mqtt_client.c index eece218..3832d45 100644 --- a/TC1/mqtt_server/user_mqtt_client.c +++ b/TC1/mqtt_server/user_mqtt_client.c @@ -20,8 +20,8 @@ */ #include "http_server/web_log.h" -#define app_log(M, ...) custom_log("APP", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) -#define mqtt_log(M, ...) custom_log("MQTT", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) +#define app_log(M, ...) do { custom_log("APP", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0) +#define mqtt_log(M, ...) do { custom_log("MQTT", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0) #include "main.h" #include "mico.h" @@ -210,7 +210,7 @@ OSStatus user_mqtt_init(void) require_noerr_string(err, exit, "ERROR: Unable to start the mqtt client worker thread."); exit: - if (kNoErr != err) app_log("ERROR, app thread exit err: %d", err); + if (kNoErr != err) app_log("ERROR2, app thread exit err: %d kNoErr[%d]", err, kNoErr); return err; } diff --git a/TC1/ota_server/ota_server.c b/TC1/ota_server/ota_server.c index 9e557d5..5638ed9 100644 --- a/TC1/ota_server/ota_server.c +++ b/TC1/ota_server/ota_server.c @@ -37,7 +37,7 @@ #include "http_server/web_log.h" #if OTA_DEBUG -#define ota_server_log(M, ...) custom_log("OTA", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) +#define ota_server_log(M, ...) do { custom_log("OTA", M, ##__VA_ARGS__); web_log(M, ##__VA_ARGS__) } while(0) #else #define ota_server_log(M, ...) #endif diff --git a/TC1/ota_server/user_ota.c b/TC1/ota_server/user_ota.c index 8bcab53..c9c085b 100644 --- a/TC1/ota_server/user_ota.c +++ b/TC1/ota_server/user_ota.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("OTA", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("OTA", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "mico.h" #include "ota_server/ota_server.h" diff --git a/TC1/time_server/user_rtc.c b/TC1/time_server/user_rtc.c index c534989..5d278f4 100644 --- a/TC1/time_server/user_rtc.c +++ b/TC1/time_server/user_rtc.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("RTC", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("RTC", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "main.h" #include "user_gpio.h" @@ -92,7 +92,7 @@ OSStatus user_rtc_init(void) 0x1000, 0); require_noerr_string(err, exit, "ERROR: Unable to start the rtc thread."); - if (kNoErr != err) os_log("ERROR, app thread exit err: %d", err); + if (kNoErr != err) os_log("ERROR1, app thread exit err: %d kNoErr[%d]", err, kNoErr); exit: return err; diff --git a/TC1/time_server/user_sntp.c b/TC1/time_server/user_sntp.c index 17b6989..8a44d52 100644 --- a/TC1/time_server/user_sntp.c +++ b/TC1/time_server/user_sntp.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("SNTP", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("SNTP", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "main.h" //#include "user_gpio.h" diff --git a/TC1/user_gpio.c b/TC1/user_gpio.c index bd637b1..39a5353 100644 --- a/TC1/user_gpio.c +++ b/TC1/user_gpio.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("KEY", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("KEY", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "main.h" #include "user_gpio.h" diff --git a/TC1/user_power.c b/TC1/user_power.c index e475f1a..f3fc128 100644 --- a/TC1/user_power.c +++ b/TC1/user_power.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("OTA", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("OTA", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "TimeUtils.h" #include "mico.h" diff --git a/TC1/user_udp.c b/TC1/user_udp.c index 0dfbef5..4ec5640 100644 --- a/TC1/user_udp.c +++ b/TC1/user_udp.c @@ -1,5 +1,5 @@ #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("UDP", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("UDP", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) #include "main.h" #include "mqtt_server/user_function.h" @@ -29,7 +29,7 @@ OSStatus user_udp_init(void) 0x1000, 0); require_noerr_string(err, exit, "ERROR: Unable to start the rtc thread."); - if (kNoErr != err) os_log("ERROR, app thread exit err: %d", err); + if (kNoErr != err) os_log("ERROR3, app thread exit err: %d kNoErr[%d]", err, kNoErr); exit: return err; diff --git a/TC1/user_wifi.c b/TC1/user_wifi.c index 52300f7..fd8ff94 100644 --- a/TC1/user_wifi.c +++ b/TC1/user_wifi.c @@ -7,7 +7,7 @@ #include "mqtt_server/user_function.h" #include "http_server/web_log.h" -#define os_log(format, ...) custom_log("WIFI", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) +#define os_log(format, ...) do { custom_log("WIFI", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__) } while(0) char wifi_status = WIFI_STATE_NOCONNECT;