• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Multi-state (Image/state assignments problem)

    How-To
    4
    15
    6.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Jokke
      last edited by

      The metapoints use other points as inputs. In your case you could use metapoint to take the value an modify it(filter the bits out). Then you could use the metapoint on the view.

      You need to add meta datasource and the metapoints into it.

      BR
      -Jokke

      1 Reply Last reply Reply Quote 0
      • H
        huexit
        last edited by

        there are a metapoint documentation? what's the script langurage?
        how i filter bits?

        1 Reply Last reply Reply Quote 0
        • S
          skiv71
          last edited by

          i used this to derive bit status from a word to drive a binary meta point...

          b="1";
          if (word.value & Math.pow(2,b)) value=true;
          else value=false;
          return value;

          b is the bit u want... 0-15
          word is the context variable (i chose to name is word)

          maybe it can point u in the right direction...

          the script language is described in the help.... its ECMAscript i think

          Neil

          1 Reply Last reply Reply Quote 0
          • J
            Jokke
            last edited by

            if you create the meta data source there is the symbol with (?).

            Help tells the script is JavaScript / ECMAScript so basicly the same as every where else on mango.

            you could add something like this to the meta point script to mask the bits 2, 3 and 4 out.

            return (p100.value & 0xFFE3);

            replace p100 with the script context var appropriate on your case.

            if you data value is alphanumeric then it maybe a different solution. (and if you want to be able to set the value then there might be needed some point link)

            BR
            -Jokke

            1 Reply Last reply Reply Quote 0
            • M
              mlohbihler
              last edited by

              Note that all the usual bitwise operators work in ECMAScript (and apparently Javascript too). So, you can do stuff like:

              if (word.value & 8) { ... stuff to do when the third bit is on }
              

              ... or:

              if ((word.value &gt&gt 3) & 1) { ... stuff to do when the third bit is on }
              

              If you have a byte value b, and you want to remove bits 4, 5, and 6 (counting from LSB), i.e. xx***xxx, you could do this:

              
              var b = source.value;
              b = (b & 7) | ((b &gt&gt 3) & 24);
              return b;
              
              

              This will leave you with only the other 5 bits, a number from 0 to 31.

              Best regards,
              Matthew

              1 Reply Last reply Reply Quote 0
              • M
                mlohbihler
                last edited by

                Jokke beat me to the response.

                Best regards,
                Matthew

                1 Reply Last reply Reply Quote 0
                • J
                  Jokke
                  last edited by

                  :)

                  You took an other cup of coffee while responding. :) Luckily the answers were not same but different aspect on same.

                  btw bit offtopic. It has been a while since doing any bit filtering. Happen to know is there any way to represent binary values on JS? (like hex is 0x prefix) atleast 0b is not working. With quick internet search I did not find anything.

                  BR
                  -Jokke

                  1 Reply Last reply Reply Quote 0
                  • M
                    mlohbihler
                    last edited by

                    Mmmm, coffee. AFAIK, the '0b' prefix is not supported.

                    Best regards,
                    Matthew

                    1 Reply Last reply Reply Quote 0
                    • H
                      huexit
                      last edited by

                      thx for much help
                      I have another solution, but I do not know if that's possible

                      part 1 : .(..) regex
                      part 2: .{5}(..) regex

                      it is possible to write a row? with script?
                      two points (or more) in metadatasource who multiplicated?
                      image

                      1 Reply Last reply Reply Quote 0
                      • M
                        mlohbihler
                        last edited by

                        You can include as many points as you need in a meta point script.

                        Best regards,
                        Matthew

                        1 Reply Last reply Reply Quote 0
                        • H
                          huexit
                          last edited by

                          and how does it work?
                          whats the script term?
                          may anyone help me pls :)

                          • it must be multistate
                          
                          var b =  p46.value + p47.value;
                          return b;
                          

                          does not work, because..
                          1000 = 10
                          0010 = 10
                          :/
                          mango think the figueres are dezimal not bitwise

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post