Jump to content
The simFlight Network Forums

thedead

Members
  • Posts

    8
  • Joined

  • Last visited

About thedead

  • Birthday 01/01/1970

Contact Methods

  • Website URL
    http://

thedead's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Here is the repaired code with your math fix in thanks for your help, :) sorry about the confusion.:oops: Dim ALT_IN As Long Dim dwResult2 As Long 'NOTICE THE TWO ARE ON SEPERATE LINES, IF YOU 'COMBINE SOMETIMES VB DOES NOT GIVE YOU REAL LONGS 'TWO POSITION ENCODER If WHICHWAY = 2 Then If EncoderDisplacement = 1 Then 'DEC ALT Call FSUIPC_Read(&H7D4, 4, VarPtr(ALT_IN), dwResult2) Call FSUIPC_Process((dwResult2)) ALT_OUT = PROCESS_ALT((ALT_IN), False) 'CANT HAVE A NEG ALT If ALT_OUT <= 150 Then ALT_OUT = 0 Call FSUIPC_Write(&H7D4, 4, VarPtr(ALT_OUT), (dwResult2)) Call FSUIPC_Process((dwResult2)) End If If EncoderDisplacement = -1 Then 'INC ALT Call FSUIPC_Read(&H7D4, 4, VarPtr(ALT_IN), dwResult2) Call FSUIPC_Process((dwResult2)) ALT_OUT = PROCESS_ALT((ALT_IN), True) 'FS TAKES CARE OF MAX ALT FROM WHAT I HAVE SEEN Call FSUIPC_Write(&H7D4, 4, VarPtr(ALT_OUT), (dwResult2)) Call FSUIPC_Process((dwResult2)) End If End If End Sub Function PROCESS_ALT(INVAL As Long, ADDALT As Boolean) As Long Dim LOCAL_PROC As Long LOCAL_PROC = Round(((CCur(INVAL) * 328084) / 65536) / 100000, 0) 'VB HAS ISSUES WITH LONGS AND MULTIPLYING DONT ASK ME IT JUST DOES If Not ADDALT Then INVAL = LOCAL_PROC - 100# Else INVAL = LOCAL_PROC + 100# End If If INVAL = 0 Then Exit Function 'CHECK FOR 0 FIRST, DOING DIVISION AND HATE THAT DIVIDE BY ZERO ERROR 'WHICH WAY ARE WE GOING UP OR DOWN NOTICE THIS HANDLES INC BY 100 ROUND_OFF_ERROR = Fix(INVAL / 1000) If ROUND_OFF_ERROR < 10 Then ROUND_OFF_ERROR = 10 'DONT KNOW WHY BUT WHEN I FEED JUST THE NUMBER IN I GET ROUND OFF 'BY FS SO I START WITH 10 AND WORK MY WAY UP, CHECKED 'ALL THE WAY THRU HOWEVER YOUR RESULTS MAY DIFFER SO CHECK MY MATH PROCESS_ALT = ((INVAL * 65536#) / 3.28084) + ROUND_OFF_ERROR 'FEED IT BACK AN POST TO THE OFFSET. End Function Thanks once again Pete
  2. Pete please dont get upset, I did screw up when I was reading the docs back and forth. I combined the SDK and the users guide in my head (I have been working on this for a week solid.) :oops: I have yet to implement your correction to my code. Once it is done I will be able to use the VB code correctly to update the offset. I am sorry for the confusion. :( I did missread the docs, and I did confuse the offsets in the users guide with the offsets in the SDK. :oops: I will repost the corrections to my code with your math and will reduce my code to about 10 or 15 lines vs the current hundreds of lines. Please I have said this more than once your assistance in this has been great. :) Thanks. Robg
  3. I did miss the reading of the header and the mention of the seperat CFG's where Got the offset ides is that on page 29 I had assumed these were refs to the offsets due to the heading not changing. I had noticed that these were buttons and keys which is why when I tried to ref that section of offsets via I could not get the buttons to push which is when I turned to the hard way. You are right I did do it the hard way and once I get the hard way recoded with your corrections to my code (get rid of the hardcodeing for dec alt) I will post the update. I appricate all the help here. Thanks Robg
  4. I am talking about your FSUIPC for Advanced Users. Page 24, you list from 1001 to 2999. I call them registers an I was mistaken. I ment offset. the sample code I got from your SDK. I noticed you did not write the VB code however it is baised on your ' Copyright © 2000 Chris Brett. All rights reserved. ' e-mail: chris@formulate.clara.net ' ' FUNCTION LIBRARY FOR FSUIPC ' based on C code supplied by Pete Dowson
  5. The vb program just reads the ENCODER and updates the register. I tried to follow your info in the ADVANCED section, and failed to my own dismay. So I hard coded some of the info your functions handed me. Checking offset 3110? Never tried. However your math answer will probally clean up my code. I will be repairing the code later this evening. I noticed that you list several registers that you use in your docs about AP_ALT_INC, I just could not figure out how to access those registers thru the sample vbcode you supply. (Which btw helped me more than you will ever know thanks!) Robg
  6. I used the long list of values to decrement the alt (computed the points on the way up) I got the multiplier from FSUPIC inter.... (My spelling is terible). I tried to keep the alt in the sets of 100 just like the knobs in FS do. When I would go up or down I would run into points where the numbers would go up by 101 or 99. (Didnt think to move that dec point. Thanks sorry bout the length of that post. What I would really like is a way to turn the ENCODER and have FS do the inc up or down. Thanks Robg
  7. Fix appears later in the message after days of my confusion and hours of frustrating Pete. Robg
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.