Sign in to follow this  
DemonDNF

XML gauge needle points the wrong way

Recommended Posts

Hi,

 

Searched the forum but couldn't find something for this (doesn't mean there was none, just that I couldn't see it in front of my face). clear.png

 

The flap position needle is defined towards west and the brake pressure needle is defined towards east.  But the flap needle points the same way as the brake pressure needle when both are 0.

 

Gauges%20at%20zero_zpslz4zhoiu.png

 

Both needles behave and turn as they should once I move data to them.

 

Gauges%20with%20data_zpsnon0bfjy.png

 


<Gauge Name="KK_BrakePressure" Version="1.0">
  <Image Name="BrakePressureBackground.bmp"/>
 
    <!-- ========================= BrakePressure ===================== -->
  <Element>
    <Position X="50" Y="50"/>
    <Image Name="BrakePressureNeedle.bmp" PointsTo="East">
      <Axis X="13" Y="35"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="40">(L:KK_BrakePressure,number)</Value>
      <Delay DegreesPerSecond="18"/>
      <Nonlinearity>
        <Item Value="0" Degrees="90"/>
        <Item Value="10" Degrees="150"/>
        <Item Value="20" Degrees="210"/>
        <Item Value="30" Degrees="270"/>
        <Item Value="40" Degrees="330"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>

 

<Gauge Name="KK_FlapPosition" Version="1.0">
  <Image Name="FlapPositionBackground.bmp"/>
 
    <!-- ========================= Flap Position - Left ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapLeftNeedle.bmp" PointsTo="East">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapLeft,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="270"/>
        <Item Value="1062" Degrees="315"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
 
    <!-- ========================= Flap Position - Right ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapRightNeedle.bmp" PointsTo="East">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapRight,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="270"/>
        <Item Value="1062" Degrees="315"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>

 

I don't get it.  I've tried DegreesPointTo=270 for west and 90 for east; same results.  The flap needle would point backwards from where it should.

 

All needle BMPs are painted the same way; vertically with tip pointing upwards.

 

I defined the flap position needle as east for a temporary fix, but there has to be something wrong.

 

Robert

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

If you want to play with <Item Value="xx" Degrees="xx"/>

 

Best to have your needle PointsTo="North" (make the needle point bitmap points upwards and change axis to suit)

 

Then

 

        <Item Value="0" Degrees="-90"/>

        <Item Value="1062" Degrees="-45"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>

  • Upvote 1

Share this post


Link to post
Share on other sites

Nope, the needle has a 90degree offset this way.

 

Thanks, but that was one of the many combinations I had tried.

 

Flap%20needle%2090%20offset_zpsb87xvnmn.

 

All my needles are drawn pointing upwards.

 

Needles_zpstu6irlkh.png

<Gauge Name="KK_FlapPosition" Version="1.0">
  <Image Name="FlapPositionBackground.bmp"/>
 
    <!-- ========================= Flap Position - Left ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapLeftNeedle.bmp" PointsTo="North">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapLeft,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="-90"/>
        <Item Value="1062" Degrees="-45"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
 
    <!-- ========================= Flap Position - Right ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapRightNeedle.bmp" PointsTo="North">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapRight,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="-90"/>
        <Item Value="1062" Degrees="-45"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>

I'm stumped.  The Brake Pressure gauge was done using the Flap Position XML, and yet the Brake Pressure gauge works fine but the Flap Position is wonky.

 

Robert

 

Share this post


Link to post
Share on other sites

 

 


The needle operates properly, it's just off by 90 degrees.

 

So just change PointsTo="North,South,East or West"> until you get it right. :)

Share this post


Link to post
Share on other sites

That's what I ended up doing, but it's wrong.

 

Using 270 or -90 degrees makes no difference, both work fine.  But for some reason that eludes me, I have to use East in this case.

 

I fired up FS-X and loaded a flight with the Alternate Flap Selector and Flaps already at 5 degrees.  For a fraction of a second the needle was pointing West, and then blipped to the proper direction for 5 degrees.

 

And yet the XML instructs to point the needle East as an initial state.

 

Flap%20needle%20East%20pos%202_zps3s1ixi

<Gauge Name="KK_FlapPosition" Version="1.0">
  <Image Name="FlapPositionBackground.bmp"/>
 
    <!-- ========================= Flap Position - Left ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapLeftNeedle.bmp" PointsTo="East">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapLeft,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="-90"/>
        <Item Value="1062" Degrees="-45"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
 
    <!-- ========================= Flap Position - Right ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapRightNeedle.bmp" PointsTo="East">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapRight,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="-90"/>
        <Item Value="1062" Degrees="-45"/>
        <Item Value="2560" Degrees="0"/>
        <Item Value="5120" Degrees="45"/>
        <Item Value="5888" Degrees="90"/>
        <Item Value="8525" Degrees="135"/>
        <Item Value="10624" Degrees="180"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>

Totally stumped.  Either I'm clearly not seeing the forest, or there's a bug.

 

I'm a programmer by trade and this makes no sense to me.  I can easily imagine an average person facing a situation like this and just giving up.

 

Robert

 

EDIT: Weird, that's the second time the bottom of my post beyond the code gets trimmed off and I have to edit.

Share this post


Link to post
Share on other sites

 

 


Using 270 or -90 degrees makes no difference,

 

The way I see it this should make a difference.

 

 

 


 I can easily imagine an average person facing a situation like this and just giving up

 

But we are not average people are we? I never give up.

 

 

 


and this makes no sense to me

 

This has happened to me on occasion with "rotating/points to/degrees" but I have always succeeded in the end.

 

Just wish I could rotate alpha channels.  :smile:

Share this post


Link to post
Share on other sites

This is one of the flaps indicators for the VC10. The needle points to North but in the cold and dark state points to 8 o'clock i.e. zero.

<Gauge Name="Flap Indicator" Version="1.0">
   <Image Name="FLAP.bmp" Luminous="1" ImageSizes="80,80"/>
   <Element>
      <Position X="39.5" Y="39.5"/>
      <Image Name="NEEDLE_1.bmp" Luminous="1" PointsTo="North" ImageSizes="11,35">
         <Axis X="5" Y="29"/>
      </Image>
      <Rotate>
         <Value Minimum="-1" Maximum="100">(A:TRAILING EDGE FLAPS0 LEFT PERCENT, percent)</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="-1"/>
         </Failures>
         <Nonlinearity>
            <Item Value="-1" X="15" Y="58"/>
            <Item Value="0" X="40" Y="8"/>
            <Item Value="32.22" X="71" Y="30"/>
            <Item Value="44.44" X="70" Y="37"/>
            <Item Value="77.78" X="63" Y="58"/>
            <Item Value="100" X="40" Y="70"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="60"/>
      </Rotate>
   </Element>
   <Mouse>
      <Area Left="0" Top="0" Width="80" Height="80">
         <Tooltip>Flaps indicator</Tooltip>
         <Area Left="0" Top="0" Right="40" Bottom="80">
            <Cursor Type="DownArrow"/>
            <Click Event="FLAPS_DECR"/>
         </Area>
         <Area Left="40" Top="0" Right="80" Bottom="80">
            <Cursor Type="UpArrow"/>
            <Click Event="FLAPS_INCR"/>
         </Area>
      </Area>
   </Mouse>
</Gauge>

Share this post


Link to post
Share on other sites
Ok, so I simplified the XML to a single needle with only 3 positions;

 

- Left Flap = 0

- PointsTo="North"

- <Item Value="0" Degrees="0"/>

 

This is what I was trying to explain, the needle behaves at a 90 degree offset from where it should.

 

Flaps%20North%200-45-90_zpstvmxf8kq.png

 



<Gauge Name="KK_FlapPosition" Version="1.0">
  <Image Name="FlapPositionBackground.bmp"/>
 
    <!-- ========================= Flap Position - Left ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapLeftNeedle.bmp" PointsTo="North">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapLeft,number)</Value>
      <Nonlinearity>
        <Item Value="0" Degrees="0"/>
        <Item Value="1062" Degrees="45"/>
        <Item Value="2560" Degrees="90"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>


 

The needle should have been pointing North.

 

Robert

Share this post


Link to post
Share on other sites

I reverted back to coordinates for both needles, and pointed Right needle to North, Left needle to West.  Right needle is working fine, Left is offset 90 degrees.

 

PointsTo is behaving really weird.  I thought it was just a starting point to paint the needle until all the data came in, and then the rotation entries would take over.  Apparently there's more going on.

 

North-West%20x-y%20coordinates_zpsc7pw8p

<Gauge Name="KK_FlapPosition" Version="1.0">
  <Image Name="FlapPositionBackground.bmp"/>
 
    <!-- ========================= Flap Position - Left ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapLeftNeedle.bmp" PointsTo="West">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapLeft,number)</Value>
      <Nonlinearity>
        <Item Value="0" X="2" Y="60"/>
        <Item Value="1062" X="19" Y="19"/>
        <Item Value="2560" X="60" Y="2"/>
        <Item Value="5120" X="101" Y="19"/>
        <Item Value="5888" X="118" Y="60"/>
        <Item Value="8525" X="101" Y="101"/>
        <Item Value="10624" X="60" Y="118"/>
      </Nonlinearity>
    </Rotate>
  </Element>
 
    <!-- ========================= Flap Position - Right ============== -->
  <Element>
    <Position X="60" Y="60"/>
    <Image Name="FlapRightNeedle.bmp" PointsTo="North">
      <Axis X="8" Y="55"/>
    </Image>
    <Rotate>
      <Value Minimum="0" Maximum="10624">(L:KK_FlapRight,number)</Value>
      <Nonlinearity>
        <Item Value="0" X="2" Y="60"/>
        <Item Value="1062" X="19" Y="19"/>
        <Item Value="2560" X="60" Y="2"/>
        <Item Value="5120" X="101" Y="19"/>
        <Item Value="5888" X="118" Y="60"/>
        <Item Value="8525" X="101" Y="101"/>
        <Item Value="10624" X="60" Y="118"/>
      </Nonlinearity>
    </Rotate>
  </Element>
</Gauge>

I'm just going to point the needle North.

Share this post


Link to post
Share on other sites

As I have shown in my examples here and on fsdevelopers you need to set a cold and dark position i.e. power off which would be where the needle is resting when there is no power to the gauge. That is shown in the xml text as <Item Value="-1" x= y= etc.

Also on your fsdeveloper thread which is identical to this one I have posted an example of a brake pressure gauge with two opposing needles.

You are rather making a mountain out of a molehill in that the coding is very simple and straightforward. And all you need to do is follow the examples you have been given by myself and others.

Share this post


Link to post
Share on other sites

Thanks for your time Vololiberista, but adding an entry for value -1 would not have made a difference.  The gauge works fine without that entry.

 

You supplied an example from the VC10, but this Brake Pressure is for the Level-D 767 and comes from Lekseecon (variable 761 offfset 0x8b90).  There is no -1 value for cold & dark.  Lekseecon uses another technique to manage cockpit state.

 

 

1.8.1 Cockpit States

The values in the Level-D 767 SDK always represent the panel values, irrespective whether the cockpit is cold and dark or not.

 

And yes, I did take the time to use parts of the examples to test.  But no amount of testing is going to help if I do not understand why code behaves as it does.

 

I didn't understand properly the concept of PointsTo until Tom illustrated the meaning on FSdevelopper.

 

PointsTo is how the needle is drawn in the BMP; this is never mentionned in the SDK.  Now I understand why Flap Position gauge was offset by 90 degrees, and why Brake Pressure gauge worked fine out out of pure luck.

 

And I don't see anything wrong asking the same question in two sites.  Now if I had posted in two sub-forums on Avsim, then I'd agree that would be spamming and considered wrong.

 

I also posted on Level-D General forum, and still have a total of 0 answers there.  I did get the answer to why my Compass needle was not working from an Avsim thread; I needed a mask colour of 1,1,1.  But it's Alan on FSdevelopper that confirmed I was using the wrong type of BMP file and needed 24bit, not 256 colours.

 

Unless there's an exclusivity clause I missed when I signed up...?

 

Robert

 

Share this post


Link to post
Share on other sites

Nope. You got the correct answer and that's what counts! B)

  • Upvote 1

Share this post


Link to post
Share on other sites

Solution (can't edit my post above to add Degrees):

 

PointsTo is how the needle is drawn in the BMP, not how it is drawn by XML.  Pointing up is North, right is East, etc.

 

XML will draw the needle as it is drawn in the BMP, PointsTo is only telling it the direction for rotation calculation.

 

Degrees is relative to PointsTo, and can sweep clockwise or counterclockwise, depending on the sequence of values.

 

 

My Flaps gauge did not work because I told XML my needle was drawn pointing West, it was painted facing North (up), hence the 90 degree offset but the proper rotation.

 

The Brake Pressure needle worked out of stupid luck.  I told XML the needle was drawn pointing East, but it was also pointing North (up).  So a value = 0 with 90 degrees will intend to rotate the needle from East to South using a needle drawn on its side.  But since my needle is drawn pointing North, it rotates 90 degrees for value 0 and ends facing East, giving the correct position totally out of sheer luck.

Share this post


Link to post
Share on other sites

Solution (can't edit my post above to add Degrees):

Yeah, unfortunately user editing time is limited to 15 minutes after posting. As a Global Moderator I have unlimited editing authority, which comes in handy from time to time. :hi:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this