mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-03 13:19:03 +00:00
modbus: add an option to disable log
Introduce new configuration option that allow disable all logging functionality for FreeModBus. This option is useful for small systems when we don't use any logging features. Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
parent
494554618e
commit
e280e9bdb4
3 changed files with 15 additions and 0 deletions
|
|
@ -251,4 +251,13 @@ config MB_MASTER_FUNC_READWRITE_HOLDING_ENABLED
|
|||
|
||||
endif # MB_ASCII_MASTER || MB_RTU_MASTER
|
||||
endif # MODBUS
|
||||
|
||||
config MODBUS_DISABLE_LOG
|
||||
bool "Disable logging for FreeModBus"
|
||||
default !FILE_STREAM
|
||||
---help---
|
||||
Disable all logging features for FreeModBus which can be useful
|
||||
for small optimized systems without console or log file support.
|
||||
This also must be enabled when fputs() is not supported.
|
||||
|
||||
endmenu # FreeModBus
|
||||
|
|
|
|||
|
|
@ -79,8 +79,12 @@ typedef enum
|
|||
|
||||
void vMBPortEnterCritical(void);
|
||||
void vMBPortExitCritical(void);
|
||||
#ifndef CONFIG_MODBUS_DISABLE_LOG
|
||||
void vMBPortLog(eMBPortLogLevel eLevel, const char *szModule,
|
||||
const char *szFmt, ...) printf_like(3, 4);
|
||||
#else
|
||||
# define vMBPortLog(l, m, c, ...)
|
||||
#endif
|
||||
void vMBPortTimerPoll(void);
|
||||
bool xMBPortSerialPoll(void);
|
||||
bool xMBPortSerialSetTimeout(uint32_t dwTimeoutMs);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ void vMBPortLogFile(FILE * fNewLogFile)
|
|||
fLogFile = fNewLogFile;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MODBUS_DISABLE_LOG
|
||||
void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule,
|
||||
const char * szFmt, ...)
|
||||
{
|
||||
|
|
@ -103,6 +104,7 @@ void vMBPortLog(eMBPortLogLevel eLevel, const char * szModule,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void vMBPortEnterCritical(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue