unknown type name ‘bit’

More
1 year 5 months ago #328967 by Z3rni3
Hey Guys
I'm trying to write a function at the moment but it does'nt accept me using a bit.
Probably jsut missing something small.
I get following Error with following function;

CODE:
pos_latch.c:29:5: error: unknown type name ‘bit’
   29 | bit last_Tin;
        | ^~~
make: *** [/usr/share/linuxcnc/Makefile.modinc:117: pos_latch.o] Error 1


FUNCTION:
component pos_latch;
license "GPL";

pin in float Pin;
pin in bit Tin;
pin out float out;

variable bit last_Tin = FALSE;

function _;

;;

FUNCTION(_) {
    if (Tin && !last_Tin) {
        out = Pin;
    }
    last_Tin = Tin;
}

 

Please Log in to join the conversation.

More
1 year 5 months ago #328968 by Hakan
Replied by Hakan on topic unknown type name ‘bit’
Name the file pos_latch.comp, the comp thing makes it go through the preprocessor.

Please Log in to join the conversation.

More
1 year 5 months ago #328970 by Z3rni3
Replied by Z3rni3 on topic unknown type name ‘bit’
I acctually name it pos_latch.comp when creating the document.


I've created working functions before but those only used floats.
Follwing File installs no problem...:
Code:
component Test; license "GPL"; pin in float in; pin out float out1; pin out bit out2; function _ nofp; ;; FUNCTION(_) { out1 = in * 3; if (out1 == 3.0)    { out2 = true; } else    { out2 = false; } }  

Please Log in to join the conversation.

More
1 year 5 months ago #328971 by cmorley
Replied by cmorley on topic unknown type name ‘bit’
try:

variable int last_Tin = 0;

Please Log in to join the conversation.

More
1 year 5 months ago #328972 by Z3rni3
Replied by Z3rni3 on topic unknown type name ‘bit’
I was able to install it now, thank you!
Will update if it works as planed.

Please Log in to join the conversation.

Time to create page: 0.145 seconds
Powered by Kunena Forum