Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    25+ Posting Member
    Join Date
    Jan 2008
    Location
    Sydney, Australia
    Posts
    29
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC and Encoders (ROTATE function, etc)

    Righto, so ROTATE, LIMIT etc functions do the "magic" bit. That's fine just as long as I know what happens.
    Thanks for clearing that up man!

    Quote Originally Posted by pdpo View Post
    nope,
    if you do not want that then you have to condition the encoder value to be +1 if >=0 and -1 if <= -1.
    Yep that's exactly what I ended up doing yesterday, just following my nose and looking at what actually happens.

  2. #12
    500+ This must be a daytime job



    Join Date
    Jul 2013
    Posts
    917
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC and Encoders (ROTATE function, etc)

    Glad you got it "sorted". SIOC is powerful, but sometimes challenging, particularly the principle that the code attached to a variable is only executed when the variable changes value - caught me out many times

  3. Thanks aVaTar thanked for this post
  4. #13
    25+ Posting Member
    Join Date
    Jan 2008
    Location
    Sydney, Australia
    Posts
    29
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC and Encoders (ROTATE function, etc)

    Quote Originally Posted by fordgt40 View Post
    Glad you got it "sorted". SIOC is powerful, but sometimes challenging, particularly the principle that the code attached to a variable is only executed when the variable changes value - caught me out many times
    Yep me too... I was going nuts with the way it defied "standard practices" and that there was no clear documentation as to what exactly happens. Or I might have missed it when fiddling about yesterday.

    Must admit that code attached to variables is very natural to me. They are called event handlers in JavaScript or a Window Procedure in Windows API. Then there're processor interrupts that function in a similar way with interrupt handler only executed when hw requests it(say encoder changes value ) Anyway that's off topic.

    Thanks a lot guys, I appreciate your help!
    PS. MCP is now coming along nicely

  5. #14
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC and Encoders (ROTATE function, etc)

    Hi guys,
    SIOC's statement:
    Code:
    v2 = ROTATE 0 359 L0
    has indeed the behaviour that Peter described; the ROTATE function takes the actual value of v2 before incrementing/decrementing, 'range wraparounding' and finally 'assigning'.

    In C/C++ one would write:
    Code:
    v2 = Rotate(0, 359, L0, v2);

    best regards,
    Nico Kaan
    Last edited by kiek; 10-18-2011 at 10:24 AM.

  6. #15
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC and Encoders (ROTATE function, etc)

    Quote Originally Posted by aVaTar View Post
    Must admit that code attached to variables is very natural to me. They are called event handlers in JavaScript or a Window Procedure in Windows API.
    Indeed. SIOC is an 'event driven scripting language', not a normal procedural programming language.
    Read more about SIOC and 'the golden rule' here.
    regards,
    Nico

Page 2 of 2 FirstFirst 12

Tags for this Thread