mcp5500 Posted October 25, 2015 Report Share Posted October 25, 2015 (edited) Hi Pete, My first post here and your site is a great help. I have a question. I am creating a LUA Menu Display system that displays the softkeys and controls for all functions in the G1000 PFD. The user uses 1- 2 position switch to move through the menu selections up and down and 1 button to activate the item highlighted. I am working on the last part of this scrip and I have created the NAV1 and NAV2 Radio menus. The menus look like what is below so you can see what i am trying to do: As you can see I am reading offset 311E and converting them for display with: STBYNAV2R = ipc.readSW(0x311E) followed by STBYNAV2 = (string.format("%04X", STBYNAV2R) + 10000) * .01. The issue I am having is in creating the COM1 and COM2 menus and displaying the STBY frq as where 311C and 311A are only 4 BCD digits not 5 (ie 122.225) so the equations above don't give me the 6th digit. Is there a way of getting that .001 position from reading an offset or do I have to follow the users selections to determine that .001 locations value? Also, if you have the time, is there a way to fix the width of the functions above so as not to drop the lagging 0s? Thanks in advance LUA Display G1000 PFD: NAV1 1 STBY FRQ INC <--- 2 STBY FRQ DEC 3 STBY FRAC INC 4 STBY FRAC DEC STBY FREQ = 114.2 (lagging 0s wont display) (Updated with each users press) 5 ACTIVATE STBY 6 BACK 7 CLOSE WINDOW This system works really good over users having to use click-spots in 2D or 3D cockpit Edited October 25, 2015 by mcp5500 Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 25, 2015 Report Share Posted October 25, 2015 As you can see I am reading offset 311E and converting them for display with: STBYNAV2R = ipc.readSW(0x311E) followed by STBYNAV2 = (string.format("%04X", STBYNAV2R) + 10000) * .01. The issue I am having is in creating the COM1 and COM2 menus and displaying the STBY frq as where 311C and 311A are only 4 BCD digits not 5 (ie 122.225) so the equations above don't give me the 6th digit. Is there a way of getting that .001 position from reading an offset or do I have to follow the users selections to determine that .001 locations value? Also, if you have the time, is there a way to fix the width of the functions above so as not to drop the lagging 0s? I wouldn't convert it the way you've done it. I'd use string.format("1%02X.%02X", STBYNAV2R/256, STBYNAV2R%256) And why are you bothering about the last 0 or 5. It's always understood that its a 25, 50, 75 or 00. All the normal radios only show 1xx.xx not 1xx.xxx. Pete Link to comment Share on other sites More sharing options...
mcp5500 Posted October 25, 2015 Author Report Share Posted October 25, 2015 Thanks Pete, OK i see what you are doing. That also will help with the BARO as well. I am testing with the Fight1 Super B200 and it shows the .001th location in the PFD COMS display. thanks so much for your help I will give it a try. Link to comment Share on other sites More sharing options...
mcp5500 Posted October 25, 2015 Author Report Share Posted October 25, 2015 OK that worked for NAV. I had to change your line to this: string.format("1%02X.%02X", STBYNAV2R/256, STBYNAV2R%256) This does show the lagging 0s. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now