From f12fc687b809389358e840e21c83daa9f16abfe3 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 23 Mar 2023 16:41:10 -0700 Subject: [PATCH 1/3] test --- test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..e69de29 From 69d8c06bdec4ca136e491be824c65a27ebbefeb0 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 23 Mar 2023 17:09:58 -0700 Subject: [PATCH 2/3] changes that allow compilation. optimized compilation. removed dict initialization --- CMakeLists.txt | 3 ++- examples/simple_ecat.c | 2 +- include/ingenialink/net.h | 4 ++-- ingenialink/base/servo.c | 18 +++++++++--------- ingenialink/ecat/lwip.c | 18 +++++++++--------- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2329307..94f18df 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(ingenialink LANGUAGES C VERSION 6.3.2) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ) +set(CMAKE_BUILD_TYPE Release) #------------------------------------------------------------------------------- # Compiler options @@ -12,7 +13,7 @@ if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /D_CRT_SECURE_NO_WARNINGS") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi") elseif(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -pedantic") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -w -O3") endif() #------------------------------------------------------------------------------- diff --git a/examples/simple_ecat.c b/examples/simple_ecat.c index c0b34b9..a97c5ef 100644 --- a/examples/simple_ecat.c +++ b/examples/simple_ecat.c @@ -8,7 +8,7 @@ int main(int argc, const char *argv[]) { il_net_t *net = NULL; il_servo_t *servo = NULL; - char* ifname = "\\Device\\NPF_{XXX}"; + char* ifname = "enp0s25"; char* dict_path = "XXX"; int port = 1061; int slave = 1; diff --git a/include/ingenialink/net.h b/include/ingenialink/net.h index 32138b4..56bb2ee 100755 --- a/include/ingenialink/net.h +++ b/include/ingenialink/net.h @@ -22,8 +22,8 @@ typedef struct il_net_emcy_subscriber il_net_emcy_subscriber_t; /** Emergency subcriber callback. */ typedef void (*il_net_emcy_subscriber_cb_t)(void *ctx, uint32_t code); -int il_net_monitoring_mapping_register[16]; -int il_net_disturbance_mapping_register[16]; +// int il_net_monitoring_mapping_register[16]; +// int il_net_disturbance_mapping_register[16]; /** * Retain a reference of the network. diff --git a/ingenialink/base/servo.c b/ingenialink/base/servo.c index 13abb67..56afe9a 100755 --- a/ingenialink/base/servo.c +++ b/ingenialink/base/servo.c @@ -431,15 +431,15 @@ int il_servo_base__init(il_servo_t *servo, il_net_t *net, uint16_t id, //il_net__retain(servo->net); /* load dictionary (optional) */ - if (dict) { - servo->dict = il_dict_create(dict); - if (!servo->dict) { - r = IL_EFAIL; - goto cleanup_net; - } - } else { - servo->dict = NULL; - } + // if (dict) { + // servo->dict = il_dict_create(dict); + // if (!servo->dict) { + // r = IL_EFAIL; + // goto cleanup_net; + // } + // } else { + // servo->dict = NULL; + // } /* configure units */ servo->units.lock = osal_mutex_create(); diff --git a/ingenialink/ecat/lwip.c b/ingenialink/ecat/lwip.c index 485e9b6..ddca990 100644 --- a/ingenialink/ecat/lwip.c +++ b/ingenialink/ecat/lwip.c @@ -41,7 +41,7 @@ #define UDP_OPEN_PORT (uint16_t)1061U /* Network instance */ -struct netif tNetif; +struct netif tNetifLwip; /* Global reply data buffer */ uint8_t pReplyData[1024U]; @@ -137,11 +137,11 @@ void LWIP_Init(void) DEFAULT_GW_IP_ADDR3, DEFAULT_GW_IP_ADDR4); /* Add the network interface */ - netif_add(&tNetif, &tIpAddr, &tNetmask, &tGwIpAddr, NULL, + netif_add(&tNetifLwip, &tIpAddr, &tNetmask, &tGwIpAddr, NULL, &LWIP_EthernetifInit, ðernet_input); - netif_set_default(&tNetif); - netif_set_up(&tNetif); - tNetif.flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; + netif_set_default(&tNetifLwip); + netif_set_up(&tNetifLwip); + tNetifLwip.flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; /* Open the Upd port and link receive callback */ ptUdpPcb = udp_new(); @@ -190,7 +190,7 @@ void LWIP_EthernetifIntput(void* pData, uint16_t u16SizeBy) memcpy((void*)pBuf->payload, (const void*)pData, u16SizeBy); pBuf->len = u16SizeBy; - tError = tNetif.input(pBuf, &tNetif); + tError = tNetifLwip.input(pBuf, &tNetifLwip); if (tError != ERR_OK) { @@ -204,7 +204,7 @@ void LWIP_SetIpAddress(uint8_t* pu8IpAddr) ip4_addr_t tNewIpAddr; IP4_ADDR(&tNewIpAddr, pu8IpAddr[0], pu8IpAddr[1], pu8IpAddr[2], pu8IpAddr[3]); - netif_set_ipaddr(&tNetif, &tNewIpAddr); + netif_set_ipaddr(&tNetifLwip, &tNewIpAddr); } void LWIP_SetNetmask(uint8_t* pu8Netmask) @@ -212,7 +212,7 @@ void LWIP_SetNetmask(uint8_t* pu8Netmask) ip4_addr_t tNewNetmask; IP4_ADDR(&tNewNetmask, pu8Netmask[0], pu8Netmask[1], pu8Netmask[2], pu8Netmask[3]); - netif_set_netmask(&tNetif, &tNewNetmask); + netif_set_netmask(&tNetifLwip, &tNewNetmask); } void LWIP_SetGwAddress(uint8_t* pu8GwAddr) @@ -220,7 +220,7 @@ void LWIP_SetGwAddress(uint8_t* pu8GwAddr) ip4_addr_t tNewGwAddr; IP4_ADDR(&tNewGwAddr, pu8GwAddr[0], pu8GwAddr[1], pu8GwAddr[2], pu8GwAddr[3]); - netif_set_gw(&tNetif, &tNewGwAddr); + netif_set_gw(&tNetifLwip, &tNewGwAddr); } void LWIP_ProcessTimeouts() From 6bcbf1ece2fd39beec4676b664662f05f0c36839 Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 29 Mar 2023 15:48:04 -0700 Subject: [PATCH 3/3] added back dict functionality --- ingenialink/base/servo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ingenialink/base/servo.c b/ingenialink/base/servo.c index 56afe9a..13abb67 100755 --- a/ingenialink/base/servo.c +++ b/ingenialink/base/servo.c @@ -431,15 +431,15 @@ int il_servo_base__init(il_servo_t *servo, il_net_t *net, uint16_t id, //il_net__retain(servo->net); /* load dictionary (optional) */ - // if (dict) { - // servo->dict = il_dict_create(dict); - // if (!servo->dict) { - // r = IL_EFAIL; - // goto cleanup_net; - // } - // } else { - // servo->dict = NULL; - // } + if (dict) { + servo->dict = il_dict_create(dict); + if (!servo->dict) { + r = IL_EFAIL; + goto cleanup_net; + } + } else { + servo->dict = NULL; + } /* configure units */ servo->units.lock = osal_mutex_create();