From 4b9161c1e63b7e69c84b9e2abd63c2bb18f76e9b Mon Sep 17 00:00:00 2001 From: nnhy Date: Wed, 19 Aug 2015 09:53:47 +0000 Subject: [PATCH] =?UTF-8?q?RTM=E7=BC=96=E8=AF=91=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E7=BC=96=E8=AF=91=E8=B0=83=E8=AF=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E7=94=9A=E8=87=B3=E8=B0=83=E8=AF=95=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E9=83=BD=E4=B8=8D=E8=A6=81=E5=8F=82=E4=B8=8E?= =?UTF-8?q?=E7=BC=96=E8=AF=91=EF=BC=8C=E6=B5=8B=E8=AF=95=E9=80=9A=E8=BF=87?= =?UTF-8?q?=EF=BC=8C=E5=9B=BA=E4=BB=B6=E5=87=8F=E5=B0=8F12.4%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Debug.cpp | 4 ++-- Flash.cpp | 2 +- Sys.cpp | 2 +- Sys.h | 2 +- TinyNet/TinyMessage.cpp | 4 +++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Debug.cpp b/Debug.cpp index ef1a0af5..fb0d8086 100644 --- a/Debug.cpp +++ b/Debug.cpp @@ -1,11 +1,11 @@ #include "Sys.h" // 仅用于调试使用的一些函数实现,RTM不需要 -#define MEM_DEBUG 1 +#define MEM_DEBUG DEBUG #if MEM_DEBUG #define mem_printf debug_printf #else - __inline void mem_printf( const char *format, ... ) {} + #define mem_printf(format, ...) #endif extern uint __heap_base; diff --git a/Flash.cpp b/Flash.cpp index af1f1427..6879e579 100644 --- a/Flash.cpp +++ b/Flash.cpp @@ -1,7 +1,7 @@ #include "Flash.h" #include -#define FLASH_DEBUG 1 +#define FLASH_DEBUG DEBUG //static const uint STM32_FLASH_KEY1 = 0x45670123; //static const uint STM32_FLASH_KEY2 = 0xcdef89ab; diff --git a/Sys.cpp b/Sys.cpp index 8aa615cd..b187c3f0 100644 --- a/Sys.cpp +++ b/Sys.cpp @@ -270,10 +270,10 @@ typedef struct void TSys::ShowInfo() { +#if DEBUG // 刚刚初始化完成的时间 ulong initedTime = Time.Current(); -#if DEBUG byte* ver = (byte*)&Version; debug_printf("%s::%s Code:%04X ", Company, Name, Code); debug_printf("Ver:%x.%x Build:%s\r\n", *ver++, *ver++, BuildTime); diff --git a/Sys.h b/Sys.h index 3d279c7e..1ff7f772 100644 --- a/Sys.h +++ b/Sys.h @@ -17,7 +17,7 @@ extern "C" #else -__inline void debug_printf( const char *format, ... ) {} +#define debug_printf(format, ...) #endif } diff --git a/TinyNet/TinyMessage.cpp b/TinyNet/TinyMessage.cpp index 95c4b56d..6bbc600f 100644 --- a/TinyNet/TinyMessage.cpp +++ b/TinyNet/TinyMessage.cpp @@ -7,7 +7,7 @@ #if MSG_DEBUG #define msg_printf debug_printf #else - __inline void msg_printf( const char *format, ... ) {} + #define msg_printf(format, ...) #endif void SendTask(void* param); @@ -585,6 +585,7 @@ void StatTask(void* param) // 显示统计信息 void TinyController::ShowStat() { +#if MSG_DEBUG static uint lastSend = 0; static uint lastReceive = 0; @@ -606,6 +607,7 @@ void TinyController::ShowStat() if(Last.Msg + Total.Msg > 0) retry = (Last.Send + tsend) * 100 / (Last.Msg + Total.Msg); msg_printf("Tiny::State 成功=%d%% 平均=%dus 速度=%d Byte/s 重发=%d.%02d 收发=%d/%d \r\n", rate, cost, speed, retry/100, retry%100, Last.Receive + Total.Receive, Last.Msg + Total.Msg); +#endif } void MessageNode::SetMessage(TinyMessage& msg)