Jump to content
Sign in to follow this  
Guest LOT

Rotating Knob Gauge

Recommended Posts

Hi,The solution goes through Jan's original code, slightly amended:(M:Event) 'LeftSingle' scmp 0 == (L:Button,bool) ! and if{ 1 (>L:dsd_xml_sound_id_03,enum) 1 (>L:Button,bool) } (M:Event) 'Leave' scmp 0 == if{ 1 (>L:dsd_xml_sound_id_04,enum) 0 (>L:Button,bool)} It is important that you understand the meaning of and how to code inside this tag, otherwise you won't get the result you're looking for no matter the hard you try. I recommend you to go back to Nick's tutorial Chapter 2, Interaction Sections, where this topic is well detailed.Tom

Share this post


Link to post
Share on other sites
Guest Harrier

>Hi,>>The solution goes through Jan's original code, slightly>amended:>Thanks Tom! Works perfectly. Now I have to add a knob that works like this:It has 3 positions: Left (-20 degree angle), Right (20 degree angle), and the main Center position. knobgg5.jpgWhen you turn it to the right (or left) and then release it it should return back to its cneter postion. Like in the above press/release button example it should also produce 2 sounds (that sound once): when turned and held - L:dsd_xml_sound_id_05; when the knob returns back - L:dsd_xml_sound_id_06. Any clues?

Share this post


Link to post
Share on other sites

Hi, You could try something like:(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:sound 1,enum) "click" -1 (>L:your action,enum) "switch left" } (M:Event) 'Leave' scmp 0 == if{ 1 (>L:sound 2,enum) "clack" 0 (>L:your action,enum) "switch center" }and(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:sound 1,enum) "click" 1 (>L:your action,enum) "switch right" } (M:Event) 'Leave' scmp 0 == if{ 1 (>L:sound 2,enum) "clack" 0 (>L:your action,enum) "switch center" }Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

You can use a single bmp, centered, and then use the axis commands to make it rotate 20 deg to the left and 20 to the right..Soemthing like: (L:Knob position,enum) And in the sections-Left Area(M:Event) 'LeftSingle' scmp 0 ==if{ (L:Knob position,enum) -1 != (>L:dsd_xml_sound_id_05) -1 (>L:Knob position,enum) }(M:Event) 'Leave' scmp 0 ==if{ (L:Knob position,enum) 0 != (>L:dsd_xml_sound_id_06) 0 (>L:Knob position,enum) }-Right Area replace -1 with 1 and that's itHope this works in real as I think it should be :-)Tom

Share this post


Link to post
Share on other sites
Guest LOT

Thanks! Perfect as always ;) Now I face a more complicated task. I need to make the ADF Loop Antenna Control Switch ("Knob position" gauge) work for 3 ADF modes switched by ADF Mode Selector ("RotatingKnob" gauge (see the above posts)): the main COMP (compass) mode; ANT (nondirectional antenna) mode; and the LOOP (loop antenna) mode.The Cold Dark ADF panel:http://harrierpanels.avsim.ru/XML/adf_cold_dark.htmlOld ADF receivers have several operating modes that the pilot can select. In the COMP mode, both the loop and the sense antennas are used, the pointer is activated, and the ADF tries to point to the station. (This is the normal mode of operation.) Switching the loop antenna control switch to either left or right position will cause the loop antenna and pointer to move left or right. Releasing the switch causes the loop antenna and pointer to rotate and point to the station again.The ADF COMP Mode:http://harrierpanels.avsim.ru/XML/adf_comp_mode.htmlI added some code to the "Knob position" gauge but it does not seem to work properly :) By switching the Loop Antenna Control Switch to the left or right position it does make the RMI pointer or needle rotate accordingly but when the ADF catches the station it doesn't work. Now the "Knob position" gauge looks like this: (L:Knob position,enum)ADF Loop Antenna Control Switch: Rotate Left (M:Event) 'LeftSingle' scmp 0 == if{ (L:Knob position,enum) -1 != (>L:dsd_xml_sound_id_05,number) -1 (>L:Knob position,enum) } (M:Event) 'Leave' scmp 0 == if{ (L:Knob position,enum) 0 != (>L:dsd_xml_sound_id_06,number) 0 (>L:Knob position,enum) } (L:Var7, number) 1 - s0 0 < if{ 359 } els{ l0 } (>L:Var7, number) ADF Loop Antenna Control Switch: Rotate Right (M:Event) 'LeftSingle' scmp 0 == if{ (L:Knob position,enum) 1 != (>L:dsd_xml_sound_id_05,number) 1 (>L:Knob position,enum) } (M:Event) 'Leave' scmp 0 == if{ (L:Knob position,enum) 0 != (>L:dsd_xml_sound_id_06,number) 0 (>L:Knob position,enum) } (L:Var7, number) 1 + 360 % (>L:Var7, number) The gauge is supposed to work in connection with the "RotatingKnob" gauge, ADF Signal Strength gauge, and the RMI gauge provided that the Main Battery is on: (A:Electrical master battery,bool) (or there's a powerfrom the generator (A:General ENG1 Generator Active,bool)), Avionics is on: (A:Avionics master switch,bool), ADF Power is on: (L:ADFPower, bool), and the ADF Mode Selector is in any of the 3 positions except OFF: (L:RotatingKnob,enum) 0 >. The gauges' codes are below: (L:RotatingKnob,enum)ADF Mode Selector (L:RotatingKnob,enum) 0 > if{ 1 (>L:dsd_xml_sound_id_04,number) } (L:RotatingKnob,enum) -- 0 max (>L:RotatingKnob,enum) ADF Mode Selector (L:RotatingKnob,enum) 3 < if{ 1 (>L:dsd_xml_sound_id_03,number) } (L:RotatingKnob,enum) ++ 3 min (>L:RotatingKnob,enum) ------------------------------------------------------ (A:Electrical master battery,bool) if{ (L:ADFPower, bool) (L:RotatingKnob,enum) && if{ (A:Adf signal:1,number) 200000 min } els{ 0 } } (A:General ENG1 Generator Active,bool) if{ (L:ADFPower, bool) (L:RotatingKnob,enum) && if{ (A:Adf signal:1,number) 200000 min } els{ 0 } } ------------------------------------------------------ (A:ADF Signal:1,bel) ! if{ (L:Var7, number) (L:Var3, number) + (>L:Var7, number) (L:Var7, number) 20 (P:Absolute time,minutes) 60 % + > if{ -0.05 (>L:Var3, number) } (L:Var7, number) (A:Plane heading degrees gyro,degrees) /-/ < if{ (P:Absolute time,seconds) 60 % 200 / (>L:Var3, number) } } els{ 0 (>L:Var7, number) } (L:Var9, number) 0 == if{ 0.1 (>L:Var3, number) -0.4 (>L:Var4, number) 1 (>L:Var9, number) }(A:Electrical master battery,bool) if{ (L:ADFPower, bool) (L:RotatingKnob,enum) && if{ (A:ADF Radial:1,radians) (L:Var7, number) 20 / + } els{ 0 } } (A:General ENG1 Generator Active,bool) if{ (L:ADFPower, bool) (L:RotatingKnob,enum) && if{ (A:ADF Radial:1,radians) (L:Var7, number) 20 / + } els{ 0 } } ------------------------------------------------------In the ANT mode, the loop antenna is disabled and all receiving is done through the sense antenna. I guess the RMI pointer will move (or won't?:-)) if you switch the loop antenna control switch left or right and stay where you leave it but it has no use for the antenna. (This is the best mode for listening to your favorite ball game.) It is also good for identifying the station. Thus, for this mode I need a code to be added to the "Knob position" gauge (and the RMI gauge) that will cause the RMI pointer to rotate with the help of the loop antenna control switch and to freeze where you leave it (when you release the loop antenna control switch). :)The ADF LOOP Mode:http://harrierpanels.avsim.ru/XML/adf_loop_mode.htmlIf the LOOP mode is selected, the sense antenna is disabled and all the receiving is done through the loop antenna. Switching the loop antenna control switch to either left or right position will cause the loop antenna and pointer to rotate in the selected direction for as long as the switch is held. Releasing the control switch causes the loop antenna and pointer to stay where it is. You may also notice that the reception gets better when the pointer is 90 degrees away from the station and worse when the pointer is either pointed directly at or 180 degrees away from the station. As to the Signal Strength Indicator in the LOOP mode when the pointer and the loop antenna point directly to the NDB station I guess the signal strength indicator needle will indicate the minimum signal strenght. That's it. I need a code for this mode as well (in connection with the Signal Strength Indicator needle if possible) and would love to hear your ideas! ;)

Share this post


Link to post
Share on other sites
Guest LOT

Please help me finish the ADF panel ;) Awaiting your ideas!

Share this post


Link to post
Share on other sites
Guest LOT

Rob, Jan, Tom, where are you guys? I need your help! :)

Share this post


Link to post
Share on other sites

LOT,I'd like to help, but you put a lot of code, info and links on your message and I don't have time at this moment to read it all, analyze it and try to compose a suitable example. Besides, it is not my style to develope kind of complete gauges for anybody, but instead give straight examples that can be used as a guide. Also I believe the other people that collaborated in this thread think the same.I hope you will understand this :-)This being said, I suggest you try to read carefully all the related info that can be found in this forum, give on testing (your code doesn't look bad at first sight) and then post specific sections (one at a time) where you keep lost. Tom

Share this post


Link to post
Share on other sites
Guest LOT

Hi Tom!Thanks for your reply. Well, I need help not for the whole gauge but for part of it which does not work properly. As a rusult of our cooperative work an old-fashioned ADF panel will be done many pilots will like ;) I'll try to make it clear and ask my questions step by step so you can deal with short examples of coding that need to be corrected. :)1. I added some code to the "Knob position" gauge. By switching the Loop Antenna Control Switch to the left or right position it does make the RMI pointer or needle rotate accordingly but when the ADF catches the station it doesn't work. Now the "Knob position" gauge looks like this: L:Knob position,enum)ADF Loop Antenna Control Switch: Rotate Left(M:Event) 'LeftSingle' scmp 0 ==if{ (L:Knob position,enum) -1 != (>L:dsd_xml_sound_id_05,number) -1 (>L:Knob position,enum) }(M:Event) 'Leave' scmp 0 ==if{ (L:Knob position,enum) 0 != (>L:dsd_xml_sound_id_06,number) 0 (>L:Knob position,enum) }(L:Var7, number) 1 - s00 < if{ 359 } els{ l0 }(>L:Var7, number)ADF Loop Antenna Control Switch: Rotate Right(M:Event) 'LeftSingle' scmp 0 ==if{ (L:Knob position,enum) 1 != (>L:dsd_xml_sound_id_05,number) 1 (>L:Knob position,enum) }(M:Event) 'Leave' scmp 0 ==if{ (L:Knob position,enum) 0 != (>L:dsd_xml_sound_id_06,number) 0 (>L:Knob position,enum) }(L:Var7, number) 1 +360 %(>L:Var7, number)See more details in the above post of Aug 26th 2006, (#19) I'd love to hear your advice about what I have to correct and encourage other people to help. Let's make the ADF Panel together! ;)

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...