diff --git a/APP_Framework/Framework/control/plc/interoperability/opcua/open62541.c b/APP_Framework/Framework/control/plc/interoperability/opcua/open62541.c index 961f243a1..d4b2398fd 100755 --- a/APP_Framework/Framework/control/plc/interoperability/opcua/open62541.c +++ b/APP_Framework/Framework/control/plc/interoperability/opcua/open62541.c @@ -68096,6 +68096,9 @@ void UA_Log_Stdout_log(void *context, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args) { + char str[120]; + memset(str, 0, sizeof(str)); + /* Assume that context is casted to UA_LogLevel */ /* TODO we may later change this to a struct with bitfields to filter on category */ if ( context != NULL && (UA_LogLevel)(uintptr_t)context > level ) @@ -68115,8 +68118,8 @@ UA_Log_Stdout_log(void *context, UA_LogLevel level, UA_LogCategory category, KPrintf("%s/%s" ANSI_COLOR_RESET "\t", logLevelNames[level], logCategoryNames[category]); - - KPrintf(msg, args); + vsnprintf(str, sizeof(str) - 1, msg, args); + KPrintf(msg, str); KPrintf("\n"); // printf("\n"); @@ -70191,7 +70194,7 @@ UA_Client * UA_Client_new() { UA_StatusCode UA_ClientConfig_setDefault(UA_ClientConfig *config) { - config->timeout = 5000; + config->timeout = 20000; config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */ if(!config->logger.log) { @@ -70656,13 +70659,15 @@ UA_Log_Syslog_withLevel(UA_LogLevel minlevel) { #define configTICK_RATE_HZ TICK_PER_SECOND #define xTaskGetTickCount CurrentTicksGain -#define EHOSTUNREACH 113 /* No route to host */ -#define EINPROGRESS 115 /* Operation now in progress */ #define EADDRINUSE 98 /* Address already in use */ -#define EALREADY 114 /* Operation already in progress */ +#define ECONNABORTED 103 /* Software caused connection abort */ + #define EISCONN 106 /* Transport endpoint is already connected */ #define ENOTCONN 107 /* Transport endpoint is not connected */ -#define ECONNABORTED 103 /* Software caused connection abort */ + +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ #ifdef UA_ARCHITECTURE_FREERTOSLWIP_POSIX_CLOCK diff --git a/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.c b/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.c index 99845580f..1b2720ef6 100644 --- a/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.c +++ b/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.c @@ -81,9 +81,6 @@ #include "enet_ethernetif.h" #include -/* MAC address configuration. */ -#define configMAC_ADDR { 0x02, 0x12, 0x13, 0x10, 0x15, 0x11} - char lwip_ipaddr[] = {192, 168, 250, 253}; char lwip_netmask[] = {255, 255, 255, 0}; char lwip_gwaddr[] = {192, 168, 250, 252}; diff --git a/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.h b/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.h index dab1c5445..781e64fe9 100644 --- a/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.h +++ b/Ubiquitous/XiUOS/resources/ethernet/LwIP/arch/sys_arch.h @@ -90,6 +90,10 @@ #define GW_ADDR1 168 #define GW_ADDR2 250 #define GW_ADDR3 5 + +/* MAC address configuration. */ +#define configMAC_ADDR { 0x02, 0x12, 0x13, 0x10, 0x15, 0x11} + /* USER CODE END 0 */ #define SYS_MBOX_NULL -1 diff --git a/Ubiquitous/XiUOS/resources/ethernet/cmd_lwip/lwip_config_demo.c b/Ubiquitous/XiUOS/resources/ethernet/cmd_lwip/lwip_config_demo.c index 4268d2306..8a5c13be9 100755 --- a/Ubiquitous/XiUOS/resources/ethernet/cmd_lwip/lwip_config_demo.c +++ b/Ubiquitous/XiUOS/resources/ethernet/cmd_lwip/lwip_config_demo.c @@ -107,8 +107,10 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | setip, lwip_setip_thread, SetIp [IP] [Netmask] [Gateway]); -void lwip_getip_thread(int argc, char *argv[]) +void lwip_showip_thread(int argc, char *argv[]) { + char mac_addr[] = configMAC_ADDR; + lw_pr_info("\r\n************************************************\r\n"); lw_pr_info(" Network Configuration\r\n"); lw_pr_info("************************************************\r\n"); @@ -118,10 +120,12 @@ void lwip_getip_thread(int argc, char *argv[]) ((u8_t *)&lwip_netmask)[2], ((u8_t *)&lwip_netmask)[3]); lw_pr_info(" IPv4 Gateway : %u.%u.%u.%u\r\n", ((u8_t *)&lwip_gwaddr)[0], ((u8_t *)&lwip_gwaddr)[1], ((u8_t *)&lwip_gwaddr)[2], ((u8_t *)&lwip_gwaddr)[3]); + lw_pr_info(" MAC Address : %x:%x:%x:%x:%x:%x\r\n", mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); lw_pr_info("************************************************\r\n"); } SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(0), - showip, lwip_getip_thread, GetIp [IP] [Netmask] [Gateway]); + showip, lwip_showip_thread, GetIp [IP] [Netmask] [Gateway]); #endif