halpin of type "char".
- Grotius
- 
				 Topic Author Topic Author
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 2419
- Thank you received: 2343
			
	
						29 Jun 2021 11:33				#213226
		by Grotius
	
	
		
			
	
			
			 		
													
	
				halpin of type "char". was created by Grotius			
			
				Hi,
I need a halpin of type "char". It must hold a char text like : "/opt/linuxcnc"
Then user could set the value by "setp charpin /opt/linuxcnc"
Is there such a option? Or must the hal source code by modified to accieve this?
 			
					I need a halpin of type "char". It must hold a char text like : "/opt/linuxcnc"
Then user could set the value by "setp charpin /opt/linuxcnc"
Is there such a option? Or must the hal source code by modified to accieve this?
Please Log in or Create an account to join the conversation.
- BeagleBrainz
- 
				  
- Visitor
- 
				  
			
	
						29 Jun 2021 12:03		 -  29 Jun 2021 12:06		#213229
		by BeagleBrainz
	
	
		
			
	
	
			 		
													
	
				Replied by BeagleBrainz on topic halpin of type "char".			
			
				This is an example I've used, to specify an IP address as a string.
RTAPI_MP_STRING(ipaddress,"ESP IP Address");
option extra_setup yes; is required
Example code
Bit more info here:
linuxcnc.org/docs/2.8/html/man/man3/RTAP...Y_STRING.3rtapi.html
Thread where Andy answered my question forum.linuxcnc.org/24-hal-components/426...-when-loading#209746
					RTAPI_MP_STRING(ipaddress,"ESP IP Address");
option extra_setup yes; is required
Example code
EXTRA_SETUP(){
if (ipaddress == 0) {
rtapi_print_msg(RTAPI_MSG_ERR,"Message string for ESP32 IP Address missing\n");
return -EINVAL;
}
rtapi_print_msg(RTAPI_MSG_ERR,"Message string for ESP32 IP Address %s\n",ipaddress);
return(0);
}Bit more info here:
linuxcnc.org/docs/2.8/html/man/man3/RTAP...Y_STRING.3rtapi.html
Thread where Andy answered my question forum.linuxcnc.org/24-hal-components/426...-when-loading#209746
		Last edit: 29 Jun 2021 12:06  by BeagleBrainz.			
			Please Log in or Create an account to join the conversation.
- Grotius
- 
				 Topic Author Topic Author
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 2419
- Thank you received: 2343
			
	
						29 Jun 2021 22:28		 -  29 Jun 2021 22:28		#213281
		by Grotius
	
	
		
			
	
	
	
			 		
													
	
				Replied by Grotius on topic halpin of type "char".			
			
				Hi,
This is nice! It works. Thank you for this.
I attached a template implementation for passing a single string as argument.
 			
					This is nice! It works. Thank you for this.
I attached a template implementation for passing a single string as argument.
		Last edit: 29 Jun 2021 22:28  by Grotius.			
			Please Log in or Create an account to join the conversation.
- Grotius
- 
				 Topic Author Topic Author
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 2419
- Thank you received: 2343
			
	
						02 Jul 2021 04:00				#213479
		by Grotius
	
	
		
			
	
			
			 		
													
	
				Replied by Grotius on topic halpin of type "char".			
			
				Hi,
I think i really need a halpin of type "char".
In a upcoming project a .ngc file has to be loaded from the component.
I need to be able to pass a "char array" to a component input pin.
Passing a string at the component init stage is ok, but not usable at runtime.
Do i need to add this "char" pin to the source code?
 			
					I think i really need a halpin of type "char".
In a upcoming project a .ngc file has to be loaded from the component.
I need to be able to pass a "char array" to a component input pin.
Passing a string at the component init stage is ok, but not usable at runtime.
Do i need to add this "char" pin to the source code?
Please Log in or Create an account to join the conversation.
- rodw
- 
				  
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 11460
- Thank you received: 3843
			
	
						02 Jul 2021 12:51				#213491
		by rodw
	
	
		
			
	
	
			 		
													
	
				Replied by rodw on topic halpin of type "char".			
			
				Hal_port might do it for you. New in V 2.9 but badly documented.			
					
		The following user(s) said Thank You: Grotius 	
			Please Log in or Create an account to join the conversation.
- Grotius
- 
				 Topic Author Topic Author
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 2419
- Thank you received: 2343
			
	
						02 Jul 2021 13:47				#213495
		by Grotius
	
	
		
			
	
	
		
			
			 		
													
	
				Replied by Grotius on topic halpin of type "char".			
			
					Attachments:
Please Log in or Create an account to join the conversation.
- Grotius
- 
				 Topic Author Topic Author
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 2419
- Thank you received: 2343
			
	
						03 Jul 2021 21:17		 -  03 Jul 2021 21:22		#213590
		by Grotius
	
	
		
			
	
	
	
			 		
													
	
				Replied by Grotius on topic halpin of type "char".			
			
				Hi Rod,
You where right !.
I managed to get the port function working in a example component "port.so"
It sends a string (char array) from point a to point b trough hal.
This example uses one component.
Normally it would serve between at least 2 components.
It is indeed badly documented.
The buffer is allocated by a setsignal command, this is quite unusual.
For the rest it works out of the box ! Many thanks for your advice !
 
 			
					You where right !.
I managed to get the port function working in a example component "port.so"
It sends a string (char array) from point a to point b trough hal.
This example uses one component.
Normally it would serve between at least 2 components.
It is indeed badly documented.
The buffer is allocated by a setsignal command, this is quite unusual.
For the rest it works out of the box ! Many thanks for your advice !
		Last edit: 03 Jul 2021 21:22  by Grotius.			
			Please Log in or Create an account to join the conversation.
		Time to create page: 0.108 seconds	
 
													 
	