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

More
3 years 10 months ago - 3 years 10 months ago #259288 by smc.collins
working on building a custom hal component for the cinturn turret, and despite the fact that " per the man pages" this appears to be properly declared at the top of the file, I am getting compilation errors that it is in fact not properly declared. I search for about 4hrs tonight looking for a clear cut answer on declaration of functions, variable etc and came back mostly empty handed. The documentation loosely eludes to c or python style declarations, and still everything appears to be correct regarding the contradictory statements that halcompile uses hal like naming and function calls, or c or python ??? which is it ?  particularly when tied to pin/bin in/out variable term.. I see also that halcompile doesn't need to use a header file, which is nice, but do I need to use a C/python/hal ??? style init or function etc to create these instances ??? I have looked at multiple hal comp source files and I don't see the error here. 

Sorry Rod, I thought I attached the right file. damn I really dislike the new windows file manager. 
Attachments:
Last edit: 3 years 10 months ago by smc.collins.
The following user(s) said Thank You: rodw

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

More
3 years 10 months ago #259289 by rodw
It would be helpful if you could share the .comp file :)
 
The following user(s) said Thank You: smc.collins

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

More
3 years 10 months ago - 3 years 10 months ago #259290 by smc.collins

It would be helpful if you could share the .comp file :)

 

 
wiki.linuxcnc.org/uploads/oracchanger.comp

fixed, and based on the code here Rod. 
Last edit: 3 years 10 months ago by smc.collins.

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

More
3 years 10 months ago #259293 by rodw
Great stuff!
My general thoughts on comp files is that they are being called from a timer interrupt (the servo thread) so they should be short and sharp and avoid loops. Let the Servo thread to the looping for you. Often you will see state machines (as you have) controlling the execution. Most features of C are supported. equates and enums, structs etc. You can call  a function as normal. You can #include .H files. There are addidional extensions to create the man page before the code starts via python comments.

I personally think they are Linuxcnc's best kept secret. What other system lets you write custom code that is then treated as if its part of the Linuxcnc core? You can write pages of obfuscated hal or you can write  a few lines of C... :)
The following user(s) said Thank You: smc.collins

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

More
3 years 10 months ago - 3 years 10 months ago #259294 by smc.collins
oh, my code isn't fixed, it's still broken afaict with declaration failures, and I don't really understand why. Unless you are hinting that I need to include my hal file, which, could I suppose act as a header???? little help here would be nice. I think the logic looks correct, but I could be very wrong 
Last edit: 3 years 10 months ago by smc.collins.

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

More
3 years 10 months ago #259306 by rodw
What is the error text and what line number does it refer 
T​​​o?

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

Time to create page: 2.217 seconds
Powered by Kunena Forum