Jump to content
The simFlight Network Forums

hawkt1

Members
  • Posts

    26
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    UK

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

hawkt1's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. hello I'm using LUA to extra values from the aerosoft airbus. I've used writeUB as an example, obviously this limits the value to 255, then back to zero. What would be the right option? DD? Many thanks AB_AP_SPEED_Select_OFFSET = 0x66C3 AB_AP_HDG_Select_OFFSET = 0x66C4 function Autopilot_AP_SPEED_Select(varname, value) ipc.writeUB(AB_AP_SPEED_Select_OFFSET, value) end function Autopilot_AP_HDG_Select(varname, value) ipc.writeUB(AB_AP_HDG_Select_OFFSET, value) end
  2. Removed Linda, removed the problem. Thanks for your help
  3. I will do Pete,Linda I have installed and when I created that script that was the error Linda was giving me. Really stupid question, I add an auto section to FSUIPC.ini with the name of the script right? It must be me doing something stupid
  4. Hi Pete, That is the entire script and its the latest I brought it a few days ago 4.949. In essence what I want too do is detect the autopilot state AB_AP_AP1 and write to 66C0 so I can then write and read from that offset. Best regards
  5. Hello Pete and team, My script is as below, and the error I get is below, what I don't understand is what have I missed? Syntax error! ...Steam\steamapps\common\FSX\Modules Line: 22: attempt to call field 'Lvar' (a nil value) stack traceback: ...Steam\steamapps\common\FSX\Modules\linda\lua\tmp.lua:22: in main chunk -- This function will be called when the lvars -- change. (See events below) function lvarChanged(varname, value) -- Check which lvar has changed if varname == "AB_AP_AP1" then -- Write the value (in this case 1 byte) -- into an offset ipc.writeUB(0x66C0, value) elseif varname == "AB_AP_AP2" then ipc.writeUB(0x66C1, value) end end -- Set up events to call the function above -- when the lvar changes. event.Lvar("AB_AP_AP1", 100, "lvarChanged")
  6. Afternoon all I need to display my set value always as 5 figures, ie 200ft would show 00200 i tried the below, no joy Dim fsAPAltitudeValue As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H07D4) Dim APAltitudeValue Me.APAltitudeValue = fsAPAltitudeValue.Value * 3.28084 / 65536 Me.APAltitudeValue = Math.Round(APAltitudeValue, 0) TextBox1.Text = Me.APAltitudeValue.ToString("00000") Similar thing with the VS, negative VS gives a value or 65,000 Dim fsAPVSValue As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H07F2) Dim APVSValueMe.APVSValue = fsAPVSValue.Value
  7. Thanks Paul for confirming that. I think the best thing to do would be to literally compare the current value against the old value and then call the relevant sub routine to action, something like Dim nav1 = 1 Dim nav1old = "" nav1old = nav1 if nav1 <> nav1old then 'do something endif
  8. Hello Paul, FSUIPC related but more a question of vb, or more specifically the most productive way to achieve a result. At present I have a textbox.text changed event which then triggers another sub routine. However I want to get rid of the textboxes and detect when values change that I have pulled from fsuipc So for example detect the com value change and then trigger an event Dim nav1bcd As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H0350)Dim nav1String = ""nav1String = nav1bcd.Value.ToString("X4")I did think a timer to check the value might be the best way but im sure thats not the most resource easy way to do that.Need to monitor upto 40 different variables Any thoughts?
  9. i'm just going to try that Paul, thank you. Your tireless effort to the community should be recognised. Whilst trying the above, question about the com frequencies. When its a whole number say 132.000, my textbox shows 132 I hoped to format it to show 132.000, same as i'd like 132.50 to shows 132.500, I thought a simple format like below would work but no joy, any thoughts? Me.com1DecStby = getFreqFromBCD(com1bcdstby.Value) Me.com1DecStby.ToString("##0.000")
  10. Ah a Eureka Moment I amended this from <> to = 0 and voila I can tune 126.02 126.05 126.07 126.1 Brilliant! Thanks Paul as always so helpful If (freq * 1000) Mod 25 = 0 Then freq -= 0.005 End If For the ADF frequency (because you knew that was coming! :cool: ) I need to be able to extract the ADF frequency and then use buttons to increase each digit individually ie like a digital ADF and then send back. Any pointers for that?
  11. Hmm ok, thats a pain, 126.03 wont tune 126.025 on vatsim for example, if I tune using the mouse I get 126.02 (126.025 when hovering over) - 126.05 - 126.07 (126.075 when hovering over) - 126.10
  12. Thanks Paul, Bear with me, stupid question. By rounding say 126.025 and then encoding, were actually sending 126.03 to FSX? Dim com1bcdstby As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H311A) Dim com1DecStby As Decimal Me.com1DecStby = getFreqFromBCD(com1bcdstby.Value) com1DecStby += 0.025 com1bcdstby.Value = encodeFreqAsBCD(com1DecStby) Private Function encodeFreqAsBCD(freqDecimal As Decimal) As Short encodeFreqAsBCD = Short.Parse(((Decimal.Round(freqDecimal, 2, MidpointRounding.AwayFromZero) - 100) * 100).ToString("F0"), Globalization.NumberStyles.AllowHexSpecifier) End Function Private Function getFreqFromBCD(freqBCD As Short) As Decimal Dim freq As Decimal = ((Decimal.Parse(freqBCD.ToString("X")) / 100) + 100) TextBox1.Text = freq.ToString ' If the freqency is not a multiple of 0.025 then it's been rounded ' Subtract 5Khz to get real value If (freq * 1000) Mod 25 <> 0 Then freq -= 0.005 End If getFreqFromBCD = freq End Function
  13. See too over complicating things!!! Doh Back to the frequency issue Paul This is my variable: Dim com1bcdstby As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H311A) This is my addition Me.com1maths.Text = com1bcdstby.Value.ToString("x") + 0.025 any my process to fsuipc com1bcdstby.Value = Short.Parse(com1maths.Text, Globalization.NumberStyles.AllowHexSpecifier) FSUIPCConnection.Process() Now it doesnt accept it because its a decimal number, can you point me in the right direction? BR
  14. Thanks Paul, helpful as always So to change the two frequencies with a button? my two frequencies are Dim com2bcd As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H3118) Dim com2bcdstby As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H311C) Logically I created a value to hold com2bcd swapped com2bcd = com2bcdstby and combcdstby = value but then I cannot update it within the app
  15. Perfect Paul, I thought I was over complicating this! I have a rotary encoder and arduino, works fine up and down but will exceed the limits ie 138 if I keep turning. Logic in VB would suggest something like if exceeds 136 then start at 118 etc. Or would you suggest a simpler alternative? Clearly I am overthinking it!
×
×
  • 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.