Kees69 Posted March 8 Report Share Posted March 8 Hi, To light the LEDs in my home-built overhead for the 767, I write the values of the LVARs to a free FSUIPC offset. I do that in the following way: function checkOverhead() --Check lights overhead ipc.writeUB(0x4251, ipc.readLvar("L:O16_001_BUT")) ipc.writeUB(0x4252, ipc.readLvar("L:O16_001_LT2")) ipc.writeUB(0x4253, ipc.readLvar("L:O16_002_BUT")) ipc.writeUB(0x4254, ipc.readLvar("L:O16_002_LT2")) ipc.writeUB(0x4255, ipc.readLvar("L:O16_003_BUT")) ipc.writeUB(0x4256, ipc.readLvar("L:O16_003_LT2")) ipc.writeUB(0x4257, ipc.readLvar("L:O16_004_BUT")) end event.timer(100, "checkOverhead") However, the list is getting longer (almost 200 outputs/LEDs), so it sometimes takes a long time (1 to 2 seconds) before the script checks whether a light is on and then turns on the corresponding LED in my overhead. Is there a way to make this work faster? I am using Captain Sim 767, with P3D and FSUIPC6. Thanks! Kees Link to comment Share on other sites More sharing options...
John Dowson Posted March 12 Report Share Posted March 12 I am not sure why its taking so long - I will take a look to see why, but I doubt very much there is anything that can be done to speed this up - its probably related to the gauges/panels dlls that are used to get the lvar values. You could try switching to using the event.lvar function instead, and only write the lvar value when it has changed. You can use the same handling function for all lvars, which will be passed the lvar name as well as the value, so you can have a conditional statement on the lvar name to determine the offset and then set the value. John Link to comment Share on other sites More sharing options...
John Dowson Posted March 12 Report Share Posted March 12 You can also pass the offset as a user parameter, so the script would be something like this: function checkOverhead(varname, value, offset) --Check lights overhead ipc.writeUB(offset, value) end event.lvar("L:O16_001_BUT", 100, "checkOverhead", 0x4251) event.lvar("L:O16_001_LT2", 100, "checkOverhead", 0x4252) event.lvar("L:O16_002_BUT", 100, "checkOverhead", 0x4253) event.lvar("L:O16_002_LT2", 100, "checkOverhead", 0x4254) event.lvar("L:O16_003_BUT", 100, "checkOverhead", 0x4255) event.lvar("L:O16_003_LT2", 100, "checkOverhead", 0x4256) event.lvar("L:O16_004_BUT", 100, "checkOverhead", 0x4257) John Link to comment Share on other sites More sharing options...
Kees69 Posted March 13 Author Report Share Posted March 13 Hi John, I have now programmed the entire overhead and this is the complete list, more than 250 lines. With this script it sometimes took 5 to 6 seconds before a light in my overhead panel came on. I have now divided this LUA script over 10 LUA scripts and included them in FSUIPC.ini and the lights respond within 1 second. However, the option you propose with the event.lvar seems to me to be a better option. In the near future I will see if I can rewrite my script in the way you suggested. Thanks for your comment! Kees function checkOverhead() --Check lights overhead ipc.writeUB(0x4264, ipc.readLvar("L:O01_031_DG6")) ipc.writeUB(0x4265, ipc.readLvar("L:O01_031_DG5")) ipc.writeUB(0x4266, ipc.readLvar("L:O01_031_DG4")) ipc.writeUB(0x4267, ipc.readLvar("L:O01_031_DG3")) ipc.writeUB(0x4268, ipc.readLvar("L:O01_031_DG2")) ipc.writeUB(0x4269, ipc.readLvar("L:O01_031_DG1")) ipc.writeUB(0x426A, ipc.readLvar("L:O01_032_DG7")) ipc.writeUB(0x426B, ipc.readLvar("L:O01_032_DG6")) ipc.writeUB(0x426C, ipc.readLvar("L:O01_032_DG5")) ipc.writeUB(0x426D, ipc.readLvar("L:O01_032_DG4")) ipc.writeUB(0x426E, ipc.readLvar("L:O01_032_DG3")) ipc.writeUB(0x426F, ipc.readLvar("L:O01_032_DG2")) ipc.writeUB(0x4270, ipc.readLvar("L:O01_032_DG1")) ipc.writeUB(0x428D, ipc.readLvar("L:O01_016_LT0")) ipc.writeUB(0x428E, ipc.readLvar("L:O01_017_LT0")) ipc.writeUB(0x428F, ipc.readLvar("L:O01_018_LT0")) ipc.writeUB(0x4290, ipc.readLvar("L:O01_019_LT0")) ipc.writeUB(0x4291, ipc.readLvar("L:O01_020_LT0")) ipc.writeUB(0x4292, ipc.readLvar("L:O01_021_LT0")) ipc.writeUB(0x4293, ipc.readLvar("L:O01_022_LT0")) ipc.writeUB(0x4294, ipc.readLvar("L:O01_023_LT0")) ipc.writeUB(0x4295, ipc.readLvar("L:O01_024_LT0")) ipc.writeUB(0x4296, ipc.readLvar("L:O01_025_LT0")) ipc.writeUB(0x4297, ipc.readLvar("L:O01_026_LT0")) ipc.writeUB(0x4298, ipc.readLvar("L:O01_027_LT0")) ipc.writeUB(0x4260, ipc.readLvar("L:O02_002_BUT")) ipc.writeUB(0x4261, ipc.readLvar("L:O02_002_LT2")) ipc.writeUB(0x4262, ipc.readLvar("L:O02_001_BUT")) ipc.writeUB(0x4263, ipc.readLvar("L:O02_001_LT2")) ipc.writeUB(0x4271, ipc.readLvar("L:O03_001_BUT")) ipc.writeUB(0x4272, ipc.readLvar("L:O03_001_LT2")) ipc.writeUB(0x4273, ipc.readLvar("L:O03_002_BUT")) ipc.writeUB(0x4274, ipc.readLvar("L:O03_002_LT2")) ipc.writeUB(0x4275, ipc.readLvar("L:O04_001_LT0")) ipc.writeUB(0x4276, ipc.readLvar("L:O04_002_LT0")) ipc.writeUB(0x4277, ipc.readLvar("L:O04_003_LT0")) ipc.writeUB(0x4278, ipc.readLvar("L:O04_004_LT0")) ipc.writeUB(0x4279, ipc.readLvar("L:O04_005_LT0")) ipc.writeUB(0x427A, ipc.readLvar("L:O04_006_LT0")) ipc.writeUB(0x427B, ipc.readLvar("L:O04_007_BUT")) ipc.writeUB(0x427C, ipc.readLvar("L:O04_008_BUT")) ipc.writeUB(0x427D, ipc.readLvar("L:O04_009_BUT")) ipc.writeUB(0x427E, ipc.readLvar("L:O04_010_BUT")) ipc.writeUB(0x427F, ipc.readLvar("L:O04_007_LT2")) ipc.writeUB(0x4280, ipc.readLvar("L:O04_008_LT2")) ipc.writeUB(0x4281, ipc.readLvar("L:O04_009_LT2")) ipc.writeUB(0x4282, ipc.readLvar("L:O04_010_LT2")) ipc.writeUB(0x4283, ipc.readLvar("L:O04_011_LT0")) ipc.writeUB(0x4284, ipc.readLvar("L:O04_012_LT0")) ipc.writeUB(0x4285, ipc.readLvar("L:O04_013_LT0")) ipc.writeUB(0x4286, ipc.readLvar("L:O04_014_LT0")) ipc.writeUB(0x4287, ipc.readLvar("L:O04_015_LT0")) ipc.writeUB(0x4288, ipc.readLvar("L:O04_016_LT0")) ipc.writeUB(0x4289, ipc.readLvar("L:O04_017_LT0")) ipc.writeUB(0x428A, ipc.readLvar("L:O04_018_LT0")) ipc.writeUB(0x428B, ipc.readLvar("L:O04_019_LT0")) ipc.writeUB(0x428C, ipc.readLvar("L:O04_020_LT0")) ipc.writeUB(0xA000, ipc.readLvar("L:O06_001_LT0")) ipc.writeUB(0xA001, ipc.readLvar("L:O06_002_LT0")) ipc.writeUB(0xA002, ipc.readLvar("L:O06_003_LT0")) ipc.writeUB(0xA003, ipc.readLvar("L:O06_004_LT0")) ipc.writeUB(0xA004, ipc.readLvar("L:O06_005_LT0")) ipc.writeUB(0xA005, ipc.readLvar("L:O06_006_LT0")) ipc.writeUB(0xA006, ipc.readLvar("L:O06_007_LT0")) ipc.writeUB(0xA007, ipc.readLvar("L:O06_008_LT0")) ipc.writeUB(0xA008, ipc.readLvar("L:O06_009_LT0")) ipc.writeUB(0xA009, ipc.readLvar("L:O06_010_LT0")) ipc.writeUB(0xA00A, ipc.readLvar("L:O06_011_LT0")) ipc.writeUB(0xA00B, ipc.readLvar("L:O06_012_LT0")) ipc.writeUB(0xA00C, ipc.readLvar("L:O06_013_LT0")) ipc.writeUB(0xA00D, ipc.readLvar("L:O06_014_LT0")) ipc.writeUB(0xA00E, ipc.readLvar("L:O06_016_LT0")) ipc.writeUB(0xA00F, ipc.readLvar("L:O06_017_LT0")) ipc.writeUB(0xA010, ipc.readLvar("L:O06_018_LT0")) ipc.writeUB(0xA011, ipc.readLvar("L:O06_019_LT0")) ipc.writeUB(0xA012, ipc.readLvar("L:O08_001_BUT")) ipc.writeUB(0xA013, ipc.readLvar("L:O08_001_LT2")) ipc.writeUB(0xA014, ipc.readLvar("L:O08_003_LT0")) ipc.writeUB(0xA015, ipc.readLvar("L:O08_004_LT0")) ipc.writeUB(0xA016, ipc.readLvar("L:O09_001_BUT")) ipc.writeUB(0xA017, ipc.readLvar("L:O09_002_BUT")) ipc.writeUB(0xA018, ipc.readLvar("L:O09_003_BUT")) ipc.writeUB(0xA019, ipc.readLvar("L:O09_004_BUT")) ipc.writeUB(0xA01A, ipc.readLvar("L:O09_001_LT2")) ipc.writeUB(0xA01B, ipc.readLvar("L:O09_002_LT2")) ipc.writeUB(0xA01C, ipc.readLvar("L:O09_003_LT2")) ipc.writeUB(0xA01D, ipc.readLvar("L:O09_004_LT2")) ipc.writeUB(0xA01E, ipc.readLvar("L:O09_006_BUT")) ipc.writeUB(0xA01F, ipc.readLvar("L:O09_007_BUT")) ipc.writeUB(0xA020, ipc.readLvar("L:O09_010_BUT")) ipc.writeUB(0xA021, ipc.readLvar("L:O09_011_BUT")) ipc.writeUB(0xA022, ipc.readLvar("L:O09_006_LT2")) ipc.writeUB(0xA023, ipc.readLvar("L:O09_007_LT2")) ipc.writeUB(0xA024, ipc.readLvar("L:O09_010_LT2")) ipc.writeUB(0xA025, ipc.readLvar("L:O09_011_LT2")) ipc.writeUB(0xA026, ipc.readLvar("L:O09_005_LT0")) ipc.writeUB(0xA027, ipc.readLvar("L:O09_008_LT0")) ipc.writeUB(0xA028, ipc.readLvar("L:O09_009_BUT")) ipc.writeUB(0xA029, ipc.readLvar("L:O09_012_BUT")) ipc.writeUB(0xA02A, ipc.readLvar("L:O09_009_LT2")) ipc.writeUB(0xA02B, ipc.readLvar("L:O09_012_LT2")) ipc.writeUB(0xA02C, ipc.readLvar("L:O10_001_LT0")) ipc.writeUB(0xA02D, ipc.readLvar("L:O10_002_LT0")) ipc.writeUB(0xA02E, ipc.readLvar("L:O12_005_BUT")) ipc.writeUB(0xA02F, ipc.readLvar("L:O12_005_LT2")) ipc.writeUB(0xA030, ipc.readLvar("L:O13_002_LT0")) ipc.writeUB(0xA031, ipc.readLvar("L:O13_003_BUT")) ipc.writeUB(0xA032, ipc.readLvar("L:O13_003_LT2")) ipc.writeUB(0xA033, ipc.readLvar("L:O15_001_LT1")) ipc.writeUB(0xA034, ipc.readLvar("L:O15_001_LT2")) ipc.writeUB(0xA035, ipc.readLvar("L:O15_002_LT0")) ipc.writeUB(0xA036, ipc.readLvar("L:O15_003_LT0")) ipc.writeUB(0xA037, ipc.readLvar("L:O33_001_BUT")) ipc.writeUB(0xA038, ipc.readLvar("L:O33_001_LT2")) ipc.writeUB(0xA039, ipc.readLvar("L:O33_002_BUT")) ipc.writeUB(0xA03A, ipc.readLvar("L:O33_002_LT2")) ipc.writeUB(0xA03B, ipc.readLvar("L:O33_003_LT0")) ipc.writeUB(0xA03C, ipc.readLvar("L:O16_001_BUT")) ipc.writeUB(0xA03D, ipc.readLvar("L:O16_001_LT2")) ipc.writeUB(0xA03E, ipc.readLvar("L:O16_002_BUT")) ipc.writeUB(0xA03F, ipc.readLvar("L:O16_002_LT2")) ipc.writeUB(0xA040, ipc.readLvar("L:O16_003_BUT")) ipc.writeUB(0xA041, ipc.readLvar("L:O16_003_LT2")) ipc.writeUB(0xA042, ipc.readLvar("L:O16_004_BUT")) ipc.writeUB(0xA043, ipc.readLvar("L:O16_004_LT2")) ipc.writeUB(0xA044, ipc.readLvar("L:O16_005_LT0")) ipc.writeUB(0xA045, ipc.readLvar("L:O16_006_BUT")) ipc.writeUB(0xA046, ipc.readLvar("L:O16_006_LT2")) ipc.writeUB(0xA047, ipc.readLvar("L:O16_007_BUT")) ipc.writeUB(0xA048, ipc.readLvar("L:O16_007_LT2")) ipc.writeUB(0xA049, ipc.readLvar("L:O16_008_BUT")) ipc.writeUB(0xA04A, ipc.readLvar("L:O16_008_LT2")) ipc.writeUD(0xA060, ipc.readLvar("L:O17_001_IND")) ipc.writeUD(0xA064, ipc.readLvar("L:O17_002_IND")) ipc.writeUD(0xA068, ipc.readLvar("L:O17_003_IND")) ipc.writeUB(0xA06C, ipc.readLvar("L:O17_004_IND")) ipc.writeUD(0xA070, ipc.readLvar("L:O17_005_IND")) ipc.writeUB(0xA050, ipc.readLvar("L:O18_001_BUT")) ipc.writeUB(0xA051, ipc.readLvar("L:O18_001_LT2")) ipc.writeUB(0xA052, ipc.readLvar("L:O18_002_BUT")) ipc.writeUB(0xA053, ipc.readLvar("L:O18_002_LT2")) ipc.writeUB(0xA054, ipc.readLvar("L:O18_003_BUT")) ipc.writeUB(0xA055, ipc.readLvar("L:O18_003_LT2")) ipc.writeUB(0xA056, ipc.readLvar("L:O18_004_LT0")) ipc.writeUB(0xA057, ipc.readLvar("L:O18_005_LT0")) ipc.writeUB(0xA058, ipc.readLvar("L:O20_001_BUT")) ipc.writeUB(0xA059, ipc.readLvar("L:O20_001_LT2")) ipc.writeUB(0xA05A, ipc.readLvar("L:O20_002_BUT")) ipc.writeUB(0xA05B, ipc.readLvar("L:O20_002_LT2")) ipc.writeUB(0xA05C, ipc.readLvar("L:O20_003_BUT")) ipc.writeUB(0xA05D, ipc.readLvar("L:O20_003_LT2")) ipc.writeUB(0xA05E, ipc.readLvar("L:O20_003_BUT")) ipc.writeUB(0xA05F, ipc.readLvar("L:O20_003_LT2")) ipc.writeUB(0xA060, ipc.readLvar("L:O14_001_BUT")) ipc.writeUB(0xA061, ipc.readLvar("L:O14_001_LT2")) ipc.writeUB(0xA062, ipc.readLvar("L:O14_002_BUT")) ipc.writeUB(0xA063, ipc.readLvar("L:O14_002_LT2")) ipc.writeUB(0xA064, ipc.readLvar("L:O14_003_BUT")) ipc.writeUB(0xA065, ipc.readLvar("L:O14_003_LT2")) ipc.writeUB(0xA066, ipc.readLvar("L:O14_004_BUT")) ipc.writeUB(0xA067, ipc.readLvar("L:O14_004_LT2")) ipc.writeUB(0xA068, ipc.readLvar("L:O21_001_BUT")) ipc.writeUB(0xA069, ipc.readLvar("L:O21_002_BUT")) ipc.writeUB(0xA06A, ipc.readLvar("L:O21_003_BUT")) ipc.writeUB(0xA06B, ipc.readLvar("L:O21_004_BUT")) ipc.writeUB(0xA06C, ipc.readLvar("L:O21_005_BUT")) ipc.writeUB(0xA06D, ipc.readLvar("L:O21_006_BUT")) ipc.writeUB(0xA06E, ipc.readLvar("L:O21_007_BUT")) ipc.writeUB(0xA06F, ipc.readLvar("L:O21_008_BUT")) ipc.writeUB(0xA070, ipc.readLvar("L:O21_009_BUT")) ipc.writeUB(0xA071, ipc.readLvar("L:O21_010_BUT")) ipc.writeUB(0xA072, ipc.readLvar("L:O21_011_BUT")) ipc.writeUB(0xA073, ipc.readLvar("L:O23_005_LT0")) ipc.writeUW(0xA086, ipc.readLvar("L:O23_004_IND")) ipc.writeUB(0xA074, ipc.readLvar("L:O25_001_LT0")) ipc.writeUB(0xA075, ipc.readLvar("L:O25_002_LT0")) ipc.writeUB(0xA076, ipc.readLvar("L:O25_004_LT0")) ipc.writeUB(0xA077, ipc.readLvar("L:O25_005_LT0")) ipc.writeUB(0xA078, ipc.readLvar("L:O25_006_LT0")) ipc.writeUB(0xA079, ipc.readLvar("L:O26_004_BUT")) ipc.writeUB(0xA07A, ipc.readLvar("L:O26_004_LT2")) ipc.writeUB(0xA07B, ipc.readLvar("L:O26_005_LT0")) ipc.writeUB(0xA07C, ipc.readLvar("L:O26_006_LT0")) ipc.writeUB(0xA07D, ipc.readLvar("L:O34_001_BUT")) ipc.writeUB(0xA07E, ipc.readLvar("L:O34_001_LT2")) ipc.writeUB(0xA07F, ipc.readLvar("L:O34_002_BUT")) ipc.writeUB(0xA080, ipc.readLvar("L:O34_002_LT2")) ipc.writeUB(0xA081, ipc.readLvar("L:O34_003_BUT")) ipc.writeUB(0xA082, ipc.readLvar("L:O34_003_LT2")) ipc.writeUB(0xA083, ipc.readLvar("L:O27_001_IND")) ipc.writeUB(0xA084, ipc.readLvar("L:O27_002_IND")) ipc.writeUB(0xA085, ipc.readLvar("L:O27_003_IND")) ipc.writeUB(0xA08A, ipc.readLvar("L:O28_001_LT0")) ipc.writeUB(0xA08B, ipc.readLvar("L:O28_002_LT0")) ipc.writeUB(0xA08C, ipc.readLvar("L:O28_003_LT0")) ipc.writeUB(0xA08D, ipc.readLvar("L:O28_007_BUT")) ipc.writeUB(0xA08E, ipc.readLvar("L:O28_007_LT2")) ipc.writeUB(0xA08F, ipc.readLvar("L:O28_008_BUT")) ipc.writeUB(0xA090, ipc.readLvar("L:O28_008_LT2")) ipc.writeUB(0xA091, ipc.readLvar("L:O28_009_BUT")) ipc.writeUB(0xA092, ipc.readLvar("L:O28_009_LT2")) ipc.writeUB(0xA093, ipc.readLvar("L:O28_010_BUT")) ipc.writeUB(0xA094, ipc.readLvar("L:O28_010_LT2")) ipc.writeUB(0xA095, ipc.readLvar("L:O28_011_BUT")) ipc.writeUB(0xA096, ipc.readLvar("L:O28_011_LT2")) ipc.writeUB(0xA097, ipc.readLvar("L:O28_014_LT0")) ipc.writeUB(0xA098, ipc.readLvar("L:O29_012_BUT")) ipc.writeUB(0xA099, ipc.readLvar("L:O29_012_LT2")) ipc.writeUB(0xA09A, ipc.readLvar("L:O29_013_BUT")) ipc.writeUB(0xA09B, ipc.readLvar("L:O29_013_LT2")) ipc.writeUB(0xA09C, ipc.readLvar("L:O29_005_BUT")) ipc.writeUB(0xA09D, ipc.readLvar("L:O29_005_LT2")) ipc.writeUB(0xA09E, ipc.readLvar("L:O29_009_BUT")) ipc.writeUB(0xA09F, ipc.readLvar("L:O29_009_LT2")) ipc.writeUB(0xA0A0, ipc.readLvar("L:O29_010_BUT")) ipc.writeUB(0xA0A1, ipc.readLvar("L:O29_010_LT2")) ipc.writeUB(0xA0A2, ipc.readLvar("L:O29_011_BUT")) ipc.writeUB(0xA0A3, ipc.readLvar("L:O29_011_LT2")) ipc.writeUB(0xA0A4, ipc.readLvar("L:O29_002_LT0")) ipc.writeUB(0xA0A5, ipc.readLvar("L:O29_003_LT0")) ipc.writeUB(0xA0A6, ipc.readLvar("L:O29_004_LT0")) ipc.writeUB(0xA0A7, ipc.readLvar("L:O29_006_LT0")) ipc.writeUB(0xA0A8, ipc.readLvar("L:O29_007_LT0")) ipc.writeUB(0xA0A9, ipc.readLvar("L:O29_008_LT0")) ipc.writeUB(0xA0AA, ipc.readLvar("L:O29_014_LT0")) ipc.writeUB(0xA0AB, ipc.readLvar("L:O30_001_LT0")) end event.timer(100, "checkOverhead") FSUIPC.ini: [Programs] [LuaFiles] 1=76_lua_lights_mip 2=76_lua_lights_mcp 3=76_offset 4=76_lua_overhead1 5=76_lua_overhead2 6=76_lua_overhead3 7=76_lua_overhead4 8=76_lua_overhead5 9=76_lua_overhead1a 10=76_lua_overhead2a 11=76_lua_overhead3a 12=76_lua_overhead4a 13=76_lua_overhead5a [Auto] 1=Lua 76_lua_display 2=Lua 76_lua_lights 3=Lua 76_lua_lights_mip 4=Lua 76_lua_lights_mcp 5=LUA 76_offset 6=lua 76_lua_overhead1 7=lua 76_lua_overhead2 8=lua 76_lua_overhead3 9=lua 76_lua_overhead4 10=lua 76_lua_overhead5 11=lua 76_lua_overhead1a 12=lua 76_lua_overhead2a 13=lua 76_lua_overhead3a 14=lua 76_lua_overhead4a 15=lua 76_lua_overhead5a 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