custom hal component failed to compile, undeclared (first use in this function)

More
18 Dec 2022 20:03 #259850 by tommylight

I really think hal, should embrace a basic, like YAB or similar. 

Nooooooo :)
Hal is the main reason i love LinuxCNC.

Please Log in or Create an account to join the conversation.

More
18 Dec 2022 22:29 - 19 Dec 2022 02:15 #259858 by smc.collins
C is a great language, but hal is already behaving like a Basic type language. it'd make more sense to have a basic type of syntax in hal. Back to my mess, I can get it to compile, but I still can't get it to work. If someone can explain why this doesn't work, I'd love to hear the explanation. latest source and config.
Attachments:
Last edit: 19 Dec 2022 02:15 by smc.collins.

Please Log in or Create an account to join the conversation.

More
19 Dec 2022 23:26 #259910 by andypugh

C is a great language, but hal is already behaving like a Basic type language. it'd make more sense to have a basic type of syntax in hal.

 

HAL files can be Tcl files, if you want actual code in there. 

The custom comps _have_ to be C files as they are compiled into Linux kernel modules and C is the only language allowed in the kernel. 
 

Please Log in or Create an account to join the conversation.

More
20 Dec 2022 01:57 #259920 by smc.collins
i got some motion today, sniffing out a logic problem but i think i might be on the correct path now. 

any idea why iocontrol doesn't fetch the tool number from the component when homing ???

Please Log in or Create an account to join the conversation.

More
20 Dec 2022 14:12 #259955 by andypugh
iocontrol sits there waiting to handle specific tool-related NML messages. If it doesn't see any then it doesn't do anything.

Please Log in or Create an account to join the conversation.

More
20 Dec 2022 14:24 #259956 by smc.collins
wouldn't it make sense to have iocontrol poll for the changer or tool number ??? or provide a path for iocontrol to receive a pocket or tool number at startup, or a way to have a persistent tool state.

is all the tool code in iocontrolv2 or is it spread out everywhere

Please Log in or Create an account to join the conversation.

More
21 Dec 2022 01:06 #259987 by andypugh

wouldn't it make sense to have iocontrol poll for the changer or tool number ??? or provide a path for iocontrol to receive a pocket or tool number at startup, or a way to have a persistent tool state.
 


You could run a T command in [RS274NGC]RS274NGC_STARTUP_CODE

There are some posts on the forum about persistent tool numbers. But you shouldn't need that for a lathe, as the system knows where the changer is at all times.

Please Log in or Create an account to join the conversation.

More
21 Dec 2022 02:50 - 21 Dec 2022 03:06 #259992 by smc.collins
working on that issue of " knowing where the turret is parked" I decided to do a complete rewrite of the component.Let me know if you see any obvious errors. I ran out of time tonight. I got it debugged enough to build. I really don't care for the syntax of C very much, but it is what it is 


edit, noticed a misplaced pair of brackets 
Attachments:
Last edit: 21 Dec 2022 03:06 by smc.collins.

Please Log in or Create an account to join the conversation.

More
21 Dec 2022 14:01 #260008 by andypugh
Your switch statement is malformed. The format is
switch(value) {
    case 1:
      stuff
    break;
    case 2:
      more stuff
    break;
    default:
      default stuff
}

You don't have the opening and closing brace for the switch, and have the "switch(progress_level)" several times inside itself.
You don't always need, or want, the "break" but it's a good idea to comment a deliberate "fall through" to the next state.

Please Log in or Create an account to join the conversation.

More
21 Dec 2022 14:46 #260014 by smc.collins

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum