Announcement

Collapse
No announcement yet.

Logic Issue

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logic Issue

    I have 3 buttons that I want to control the power of my amplifiers. I have 2 amplifiers and each turn on lean runs through a relay. "Main Amp" button triggers output 0 and "Sub Amp" button triggers output 1. Now I want a "All Amps" button to trigger both outputs.

    I made a button like this:
    Code:
    <button id="ALL_AMPS" enabled="yes" function="change variable" functionTargetID="amps" vote_opinion="d+1" vote_priority="medium">
            <images imagePrimary="content\images\button_images\button_center_down.png" imageSecondary="content\images\button_images\button_center.png" imageDisabled="content\images\button_images\button_center.png" imagePushed="content\images\button_images\button_center_down.png"></images>
            <display size="254,74" location="257,367" page="0" z_order="0.9"></display>
            <vote_options minimum_delta_vote_time_down="20" ></vote_options>
    		<text font="verdana" font_size="18"></text>
            <text colourPrimaryARGB="255,255,255,255" textPrimary="All Amplifiers"></text>
            <text colourSecondaryARGB="255,255,255,255" textSecondary="All Amplifiers"></text>
          </button>
    Then a Variable:
    Code:
    <variable name="amps">0</variable>
    Then my logic statement:
    Code:
    <if fire_on="logic" minimum_delta_vote_time="100" id="amps_off">
            <boolean_operation type="equal to">
              <parameter1>
                <variable do="get" name="amps"></variable>
              </parameter1>
              <parameter2>
                <number>1</number>
              </parameter2>
            </boolean_operation>
            <then>
              <do function="Trigger Output" functionTargetID="Digital Output 0" vote_opinion="on" vote_priority="medium"></do>
              <do function="Trigger Output" functionTargetID="Digital Output 1" vote_opinion="on" vote_priority="medium"></do>
    		  <do function="Change Variable" functionTargetID="amps" vote_opinion="2" vote_priority="medium"></do>
    		</then>
          </if>
    	  <if fire_on="logic" minimum_delta_vote_time="100" id="amps_on">
            <boolean_operation type="equal to">
              <parameter1>
                <variable do="get" name="amps"></variable>
              </parameter1>
              <parameter2>
                <number>3</number>
              </parameter2>
            </boolean_operation>
            <then>
              <do function="Trigger Output" functionTargetID="Digital Output 0" vote_opinion="off" vote_priority="medium"></do>
              <do function="Trigger Output" functionTargetID="Digital Output 1" vote_opinion="off" vote_priority="medium"></do>
    		  <do function="Change Variable" functionTargetID="amps" vote_opinion="0" vote_priority="medium"></do>
    		</then>
          </if>
    Now in theory when I click the button the variable should change to 1 and trigger both outputs 0 and 1, then change the variable to 2. Then when I click the button again it should change the variable to 3 and trigger the outputs 0 and 1 again and reset the variable back to 0.

    Now in reality when I click the button it changes the variable to 1 but nothing happens to the outputs. When i click the button again it changes to 2 for a split second then goes back to 1. I can hit the button 100 times and it does the same. If I take out the logic statement the variable goes up by 1 every time I hit the button as it should.

    I made the logic in the configurator. The variable "amps" is not used in any other part of my logic other than a text label just so I can monitor it since it wasn't working. Am I doing something wrong in the logic? I remember in pre-mdx software you could link buttons together. Is this still an option also?

  • #2
    Can you try changing vote_priority="medium" to vote_priority="high" for the amps=2?
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

    Comment


    • #3
      I went through my config file and deleted some stuff I don't need that is unrelated to the "amps" logic and I didn't test it before i did that today but now the numbers go up by 1 each time you hit the button w/o it jumping back, but it still does not trigger the logic for that variable.

      I tried changing the priority as you suggested and no difference.

      Comment


      • #4
        So weird... At one point the variable was changing as it should, but with much delay, and the outputs weren't triggering. Then it just stopped working all together again... just goes up by one each time you press the button. Tried changing the button priority to "low" and the logic variables to "high" like you suggested above and the output statements in the logic to "high" and still nothing. Also tried it on a second computer with same results.

        Comment

        Working...
        X