forked from asherao/DCS-ExportScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
M-2000C.lua
1655 lines (1458 loc) · 61 KB
/
M-2000C.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Mirage M-2000C
-- for DCS Export Scripts
-- initial version by s-d-a with additions and update by Blue Storm + Bearcat
-- __ __ _ ___ ___ ___ ___ _____
-- | \/ (_) |__ \ / _ \ / _ \ / _ \ / ____|
-- | \ / |_ _ __ __ _ __ _ ___ ) | | | | | | | | | | |
-- | |\/| | | '__/ _` |/ _` |/ _ \ / /| | | | | | | | | | |
-- | | | | | | | (_| | (_| | __/ / /_| |_| | |_| | |_| | |____
-- |_| |_|_|_| \__,_|\__, |\___| |____|\___/ \___/ \___/ \_____|
-- __/ |
-- |___/
ExportScript.FoundDCSModule = true
ExportScript.Version.M2000C = "2.1.8"
-----------------------------
-- Helper functions --
-----------------------------
local function decodeSegment(segment)
local segDecode = {
["1111101"] = "0",
["0011000"] = "1",
["0110111"] = "2",
["0111110"] = "3",
["1011010"] = "4",
["1101110"] = "5",
["1101111"] = "6",
["0111000"] = "7",
["1111111"] = "8",
["1111110"] = "9",
["0000000"] = " "
}
local retval = segDecode[segment]
if retval == nil then
retval = "X" -- a digit is malfunctionning
end
return retval
end
local function decodePCNDisplay(digits, seg1, seg2, seg3, seg4, seg5, seg6, seg0, seg7)
local lPCN_DIGIT = {}
local lPCN_DECODED = ""
for i = 1, digits do
lPCN_DIGIT[i] = string.sub(seg1, i, i)..string.sub(seg2, i, i)..string.sub(seg3, i, i)..string.sub(seg4, i, i)..string.sub(seg5, i, i)..string.sub(seg6, i, i)..string.sub(seg0, i, i)
lPCN_DIGIT[i] = string.gsub(lPCN_DIGIT[i], "([a-z])", "1")
lPCN_DIGIT[i] = string.gsub(lPCN_DIGIT[i], " ", "0")
lPCN_DECODED = lPCN_DECODED..string.format("%s", decodeSegment(lPCN_DIGIT[i]))
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog('PCN_DIGIT['..string.format("%s", i)..']='..string.format("%s", lPCN_DIGIT[i]))
ExportScript.Tools.WriteToLog('PCN_DIGIT['..string.format("%s", i)..']='..string.format("%s", decodeSegment(lPCN_DIGIT[i])))
end
end
local n = 0
local m = 1
for i = 1, digits do
if string.sub(seg7, i, i) ~= " " then
lPCN_DECODED = string.sub(lPCN_DECODED, 1, i - n).."."..string.sub(lPCN_DECODED, i + m, string.len(lPCN_DECODED))
n = n - 1
m = m + 1
end
end
return lPCN_DECODED
end
local function getPCN2DigitR()
local li = list_indication(9)
local m = li:gmatch("-----------------------------------------\n([^\n]+)\n([^\n]*)\n")
local east = " "
local west = " "
local plus = " "
local minus = " "
while true do
local name, value = m()
if not name then break end
if name == "PCN_UR_E" then
east="E"
end
if name == "PCN_UR_W" then
west="W"
end
if name == "PCN_UR_P" then
plus="+"
end
if name == "PCN_UR_M" then
minus="-"
end
end
return string.format("%-4s", string.sub(east..west..plus..minus,1,4))
end
local function getPCN2DigitL()
local li = list_indication(9)
local m = li:gmatch("-----------------------------------------\n([^\n]+)\n([^\n]*)\n")
local north = " "
local south = " "
local plus = " "
local minus = " "
while true do
local name, value = m()
if not name then break end
if name == "PCN_UL_N" then
north="N"
end
if name == "PCN_UL_S" then
south="S"
end
if name == "PCN_UL_P" then
plus="+"
end
if name == "PCN_UL_M" then
minus="-"
end
end
return string.format("%-4s", string.sub(north..south..plus..minus,1,4))
end
local function getPCNValue(nameStr, id)
local li = list_indication(id)
local m = li:gmatch("-----------------------------------------\n([^\n]+)\n([^\n]*)\n")
while true do
local name, value = m()
if not name then break end
if name == nameStr then
value = " " .. value
return value:sub(-2)
end
end
return " "
end
function ExportScript.M2000C_getListIndicatorValueByName(IndicatorID, NameID, Length)
local ListIindicator = list_indication(IndicatorID)
if ListIindicator == "" then
return nil
end
local data = ""
while data:len() < Length do data = data .. " " end
local ListindicatorMatch = ListIindicator:gmatch("-----------------------------------------\n([^\n]+)\n([^\n]*)\n")
while true do
local Key, Value = ListindicatorMatch()
if not Key then
break
end
if Key == NameID then
Value = data .. Value
return Value:sub(-Length)
end
end
return data
end
-- Uses unicode characters to mask part of a streamdeck icon with text.
-- Make sure that streamdeck text is in Courier New, 9pts, centered.
function text_for_split_indicator_light(first_light, second_light)
local stringOutput = ""
if first_light == true then
stringOutput = stringOutput .. "\n \n"
else
stringOutput = stringOutput .. "██████████\n▀▀▀▀▀▀▀▀▀▀\n"
end
if second_light == true then
stringOutput = stringOutput .. " \n \n\n"
else
stringOutput = stringOutput .. "▄▄▄▄▄▄▄▄▄▄\n██████████\n"
end
return stringOutput
end
-----------------------------
-- Core M-2000C --
-----------------------------
ExportScript.ConfigEveryFrameArguments =
{
--[[
every frames arguments
based of "mainpanel_init.lua"
Example (http://www.lua.org/manual/5.1/manual.html#pdf-string.format)
[DeviceID] = "Format"
[4] = "%.4f", <- floating-point number with 4 digits after point
[19] = "%0.1f", <- floating-point number with 1 digit after point
[129] = "%1d", <- decimal number
[5] = "%.f", <- floating point number rounded to a decimal number
]]
-- LAMPS / DISPLAYS --------------------------------------
[185] = "%.1f", --LIM, MIP,
[186] = "%.1f", --IFF, MIP, Acc
[187] = "%.1f", --LED green, ADI
[188] = "%.1f", --LED green, ADI
-- VCM voyants (RWR)
[229] = "%.1f", --V
[230] = "%.1f", --BR
[231] = "%.1f", --DA
[232] = "%.1f", --D2M
[233] = "%.1f", --LL
-- Autopilot Controls/Indicator Lights
[267] = "%.1f", --button P light
[268] = "%.1f", --button MIS light
[270] = "%.1f", --button AUT light
[271] = "%.1f", --button MAN light
[273] = "%.1f", --button MAG-P light
[274] = "%.1f", --button MAG-MAG light
[280] = "%.1f", --button TOT light
[281] = "%.1f", --button PAP light
-- Weapon panel
[236] = "%.1f", --button1 S 001 light
[238] = "%.1f", --button2 S 001 light
[240] = "%.1f", --button3 S 001 light
[242] = "%.1f", --button4 S 001 light
[244] = "%.1f", --button5 S 001 light
[251] = "%.1f", --button1 S 002 light
[252] = "%.1f", --button1 P 002 light
[254] = "%.1f", --button2 S 002 light
[255] = "%.1f", --button2 P 002 light
[257] = "%.1f", --button3 S 002 light
[258] = "%.1f", --button3 P 002 light
[260] = "%.1f", --button4 S 002 light
[261] = "%.1f", --button4 P 002 light
[263] = "%.1f", --button5 S 002 light
[264] = "%.1f", --button5 P 002 light
[246] = "%.1f", --button KL1 light
[247] = "%.1f", --button KL2 light
[321] = "%.1f", --ADI ILS light
[374] = "%.1f", --Fire light 1
[375] = "%.1f", --Fire light 2
-- AUTOPILOT lights
[283] = "%.1f", --P
[284] = "%.1f", --A
[286] = "%.1f", --Alt 1
[287] = "%.1f", --blank Alt
[289] = "%.1f", --Alt 2
[290] = "%.1f", --AFF
[292] = "%.1f", --blank1
[293] = "%.1f", --blank2
[295] = "%.1f", --left
[296] = "%.1f", --blank L
[297] = "%.1f", --G
[298] = "%.1f", --blank G
-- div. lights
[373] = "%.1f", --Afterburner light
[376] = "%.1f", --starter light
[198] = "%.1f", --tranfer
-- Master Caution / Warning Lights
[199] = "%.1f", --master-warning
[200] = "%.1f", --master-caution
-- INSTRUMENTS -------------------------------------------
-- Display Settings
--[224] = "%.1f", --Drum X000
--[225] = "%.1f", --Drum 0X00
--[226] = "%.1f", --Drum 00X0
--[227] = "%.1f", --Drum 000X
-- AUTOPILOT ALTITUDE SELECTOR: Adjust autopilot altitude hold value.
--[299] = "%.4f", --Alt Drum X00
--[300] = "%.4f", --Alt Drum 0X0
--[301] = "%.4f", --Alt Drum 00X
-- BINGO FUEL SELECTOR: Adjust the value for the Bingo Fuel warning
[360] = "%.4f", --Drum X0
[361] = "%.4f", --Drum 0X
-- ASI
[303] = "%.4f", --asi needle
[304] = "%.4f", --mach wheel
-- ALTITUDE INDICATOR: indicates barometric altitude (MSL) in feet
[305] = "%.4f", --Needle
[306] = "%.4f", --Alt Drum X00
[307] = "%.4f", --Alt Drum 0X0
[308] = "%.4f", --Alt Drum 00X
[310] = "%.4f", --Pressure Drum X000
[311] = "%.4f", --Pressure Drum 0X00
[312] = "%.4f", --Pressure Drum 00X0
[313] = "%.4f", --Pressure Drum 000X
-- ADI
[316] = "%.4f", --pitch
[317] = "%.4f", --bank
[318] = "%.4f", --heading
[319] = "%.1f", --off flag
[320] = "%.4f", --slip ball
[322] = "%.4f", --ILS bar course
[323] = "%.4f", --ILS bar alt
-- VVI
[324] = "%.4f", --VVI needle
-- ADI Standby
[327] = "%.4f", --pitch
[326] = "%.4f", --bank
[328] = "%.4f", --adjust / White Silhouette
[329] = "%.1f", --off flag
-- AOA
[331] = "%.4f", --needle
-- Flag black/red
[332] = "%.1f", --flag
-- HSI
[333] = "%.4f", --HDG Indicator
[334] = "%.4f", --Needle
[335] = "%.4f", --Needle small
[336] = "%.4f", --Drum X000
[337] = "%.4f", --Drum 0X00
[338] = "%.4f", --Drum 00X0
[339] = "%.4f", --Drum 000X
[340] = "%.4f", --HSI Heading Selector
[341] = "%.1f", --HSI Mode Selector Switch
[342] = "%.4f", --Compass rose
[344] = "%.1f", --HSI Flag 1
[345] = "%.1f", --HSI Flag 2
[346] = "%.1f", --HSI Flag CAP
--[341] = "%.1f", --HSI Mode
[343] = "%.1f", --DME Off Flag
-- ACC indicator
[347] = "%.4f", --needle
-- JAUG fuel
[349] = "%.4f", --Drum X00
[350] = "%.4f", --Drum 0X0
[351] = "%.4f", --Drum 00X
-- DETOT fuel
[352] = "%.4f", --Drum X00
[353] = "%.4f", --Drum 0X0
[354] = "%.4f", --Drum 00X
[357] = "%.1f", --Intercom
-- Fuel indicator
[358] = "%.4f", --v-needle left
[359] = "%.4f", --v-needle right
[362] = "%.1f", --light L RL
[363] = "%.1f", --light C RL
[364] = "%.1f", --light R RL
[365] = "%.1f", --light L AV
[366] = "%.1f", --light R AV
[367] = "%.1f", --light L V
[368] = "%.1f", --light R V
-- ENGINE INSTRUMENTS: Indicates engine RPM and Temperature.
[369] = "%.4f", --N needle
[370] = "%.4f", --Tt7 needle
[371] = "%.4f", --Drum XX0
[372] = "%.4f", --Drum 00X
-- Center console IFF
[377] = "%.4f", -- X0 MODE
[378] = "%.4f", -- 0X
[379] = "%.4f", -- X000 MODE 3A
[380] = "%.4f", -- 0X00
[381] = "%.4f", -- 00X0
[382] = "%.4f", -- 000X
[388] = "%.1f", -- Voyant de contrôle rouge Panneau MODE-4
[394] = "%.1f", -- voyant jaune "PANNE"
-- Pressure
[397] = "%.4f", --Needle left
[398] = "%.4f", --Needle right
-- Cabin climb (x 1000 ft)
[399] = "%.4f", --Needle
-- Clock
[401] = "%.4f", --hours
[402] = "%.4f", --minutes
[403] = "%.4f", --seconds
-- GEARPANEL
[405] = "%.1f", -- Eclairage Manette de commande train rouge
[410] = "%.1f", -- „A“ Warnlamp
[411] = "%.1f", -- „F“ Warnlamp
[412] = "%.1f", -- „DIRAV“ Warnlamp, bleu
[413] = "%.1f", -- „FREIN“
[414] = "%.1f", -- „Cross“
[415] = "%.1f", -- „SPAD“
[416] = "%.1f", -- voyant rouge „BIP“
[417] = "%.1f", -- Left Gear, lampe verte
[418] = "%.1f", -- Nose Gear
[419] = "%.1f", -- Right Gear
-- CS indicator
[424] = "%.4f", -- 1. waagerechte Balkenanzeige
[425] = "%.4f", -- 2.
[426] = "%.4f", -- 1. senkrechte Balkenanzeige
[427] = "%.4f", -- 3. waagerechte BA
[428] = "%.4f", -- 4.
-- Com
--[436] = "%.4f", -- Preset display (1-20)
--[440] = "%.4f", -- Drum X000 (0-9-0) COM Panel
--[441] = "%.4f", -- Drum 0X00.00
--[442] = "%.4f", -- Drum 00X0.00
--[443] = "%.4f", -- Drum 000X.00
--[444] = "%.4f", -- Drum 0000.XX (00-25-50-75-00)
--[190] = "%.4f", -- Drum X0 Preset (0-1-2)
--[189] = "%.4f", -- Drum 0X Preset (0-9-0)
[675] = "%.1f", -- TEST Button COM Panel, red
[676] = "%.1f", -- Test Button Panel over COM Panel, red
[677] = "%.1f", -- Left green lamp
-- Compass
[906] = "%.4f", --Rose
-- Oxygen
[518] = "%.4f", --Needle
[519] = "%.1f", --Oxy flow lamp (blue)
-- Left consule Lamps
[490] = "%.1f", -- „VAL”
[492] = "%.1f", -- „A“ voyant Panneau
[494] = "%.1f", -- „DEC“ Voyant
[496] = "%.1f", -- „VISU“
[505] = "%.1f", -- „PSIC“
[510] = "%.1f", -- „ELEC“
[511] = "%.1f", -- „HYD“
[512] = "%.1f", -- Red
[513] = "%.1f", -- GREEN
-- TRIM
[508] = "%.1f", -- Trim mode
[509] = "%.1f", -- Trim direction
-- LOX
--[518] = "%.4f", -- needle
--[519] = "%.4f", -- LOX flow blinker
-- WARNING PANEL
[525] = "%.1f", -- BATT
[526] = "%.1f", -- TR
[527] = "%.1f", -- ALT 1
[528] = "%.1f", -- ALT2
[529] = "%.1f", -- HUILLE
[530] = "%.1f", -- T7
[531] = "%.1f", -- CALC C
[532] = "%.1f", -- SOURIS
[533] = "%.1f", -- PELLE
[534] = "%.1f", -- B.P
[535] = "%.1f", -- BP.G
[536] = "%.1f", -- BP.D
[537] = "%.1f", -- TRANSF
[538] = "%.1f", -- NIVEAU
[539] = "%.1f", -- HYD 1
[540] = "%.1f", -- HYD 2
[541] = "%.1f", -- HYD 3
[542] = "%.1f", -- EP
[543] = "%.1f", -- BINGO
[544] = "%.1f", -- P.CAB
[545] = "%.1f", -- TEMP
[546] = "%.1f", -- REG O2
[547] = "%.1f", -- 5nm O2
[548] = "%.1f", -- O2 HA
[549] = "%.1f", -- ANEMO
[550] = "%.1f", -- CC
[551] = "%.1f", -- DSV
[552] = "%.1f", -- CONDIT
[553] = "%.1f", -- CONF
[554] = "%.1f", -- PA
[555] = "%.1f", -- MAN
[556] = "%.1f", -- DOM
[557] = "%.1f", -- BECS
[558] = "%.1f", -- U.S.EL
[559] = "%.1f", -- ZEICHEN
[560] = "%.1f", -- GAIN
[561] = "%.1f", -- RPM
[562] = "%.1f", -- DECOL
[563] = "%.1f", -- PARK.
-- Lamps Right Console
[564] = "%.1f", -- “PRET” Indicateur Vert
[565] = "%.1f", -- „ALN“
[566] = "%.1f", -- „MIP“
[567] = "%.1f", -- „N.DEG“
[568] = "%.1f", -- „SEC“
[569] = "%.1f", -- „UNI“
[669] = "%.1f", -- „M01”
[670] = "%.1f", -- „M02“
[671] = "%.1f", -- „M03“
[571] = "%.1f", -- “PREP” WL, jaune
[573] = "%.1f", -- “DEST” WL, jaune
[577] = "%.1f", -- “BAD” WL jaune/vert
[579] = "%.1f", -- “REC”
[581] = "%.1f", -- “VAL”
[583] = "%.1f", -- “MRC”
[595] = "%.1f", -- “EFF” bouton lampe rond jaune
[597] = "%.1f", -- “INS” bouton lampe rond jaune
[668] = "%.1f", -- “ENC” WL jaune/vert
-- VIERER ANZEIGE
[601] = "%.4f", -- 1. Drum
[602] = "%.4f", -- 2.
[603] = "%.4f", -- 3.
[604] = "%.4f", -- 4.
-- VOR ILS
[611] = "%.4f", -- 1. Drum
[612] = "%.4f", -- 2.
[613] = "%.4f", -- 3.
[614] = "%.4f", -- 4.
[615] = "%.4f", -- 5.
-- TACAN
[620] = "%.1f", -- X/Y
[621] = "%.4f", -- Drum XX0 left (--;1-12;--)
[622] = "%.4f", -- Drum 00X right (0;1-9;0)
[632] = "%.1f", -- Bouton avec voyant "C"
[634] = "%.1f", -- Bouton avec voyant "F"
-- Panel lights
[720] = "%.4f", -- Flash MIP, rouge
[721] = "%.4f", -- Rétroéclairage MIP, rouge
[722] = "%.4f", -- Flash MIP, blanc
[723] = "%.4f", -- Rétroéclairage des panneaux latéraux gauche et droit, rouge
[724] = "%.4f", -- Eclairage des panneaux latéraux, rouge (gauche, droite)
[726] = "%.4f", -- variateur de lampe d'avertissement
[727] = "%.4f", -- variateur de lampe d'avertissement (panneaux latéraux)
}
ExportScript.ConfigArguments =
{
--[[
arguments for export in low tick interval
based on "clickabledata.lua"
]]
-- Fuel
[193] = "%.1f", --Refuel Transfer Switch
-- Landing Gear
[404] = "%.1f", --Landing Gear Lever
-- HUD/VTB
[201] = "%.1f", --HUD Power Switch
[203] = "%.1f", --HUD Decluter Switch
[204] = "%.1f", --HUD Altimeter Selector Switch
[205] = "%.1f", --Radar Altimeter Power Switch
[206] = "%.1f", --Auxiliary Gunsight
[207] = "%.1f", --Auxiliary Gunsight Deflection
[208] = "%.1f", --Gun AG Reticle Selector
[209] = "%.1f", --Gun Target Wingspan Selector
[210] = "%.1f", --HUD Clear Switch
[192] = "%.4f", --Radar Altimeter Minimum Altitude Selector
[213] = "%.1f", --Radar Interception Switch
[214] = "%.1f", --Radar N Parameter Switch
[215] = "%.1f", --Radar P Parameter Switch
[216] = "%.1f", --Radar B Parameter Switch
[217] = "%.1f", --Radar C Parameter Switch
[218] = "%.1f", --Radar Z Parameter Switch
[219] = "%.1f", --Radar M Parameter Switch
[220] = "%.1f", --Radar T Parameter Switch
[221] = "%.1f", --VTB Power Switch
[222] = "%.1f", --VTB Switch
[223] = "%.1f", --VTB Switch
-- PCA/PPA +++++++++++ HJP HBook Side 129
[463] = "%.1f", --Gun Arm/Safe Switch
[234] = "%.1f", --Master Arm Switch
[248] = "%.1f", --Jett Switch Cover
[249] = "%.1f", --Selective Jettison Switch
[235] = "%.1f", --PCA Button 1
[237] = "%.1f", --PCA Button 2
[239] = "%.1f", --PCA Button 3
[241] = "%.1f", --PCA Button 4
[243] = "%.1f", --PCA Button 5
[245] = "%.1f", --Gun Mode Selector
[250] = "%.1f", --Weapons Selector Button 1
[253] = "%.1f", --Weapons Selector Button 2
[256] = "%.1f", --Weapons Selector Button 3
[259] = "%.1f", --Weapons Selector Button 4
[262] = "%.1f", --Weapons Selector Button 5
[266] = "%.1f", --S530 Standby
[269] = "%.1f", --AUTO/MAN Button
[272] = "%.1f", --MAGIC Standby
[279] = "%.1f", --Cannon Fire rate/Rockets Simul Launch
[265] = "%.1f", --Missile Selector Switch
[275] = "%.1f", --PPA Test Switch
[276] = "%.1f", --Bomb Fuze Selector Switch
[277] = "%.1f", --Bomb Release Quantity Selector Switch
[278] = "%.1f", --Bomb Release Interval Selector Switch
[409] = "%.1f", --Emergency Jettison
--AFCS
[282] = "%.1f", --Autopilot Master
[285] = "%.1f", --Autopilot - Altitude Hold
[288] = "%.1f", --Autopilot - Selected Altitude Hold
[294] = "%.1f", --Autopilot - Approach Hold
[302] = "%.1f", --Autopilot - Lights Test
[299] = "%.1f", --Autopilot - Altitude Selector 10K
[300] = "%.1f", --Autopilot - Altitude Selector 1K
[301] = "%.1f", --Autopilot - Altitude Selector 1C
[514] = "%.1f", --Autopilot Test Cover
[515] = "%.1f", --Autopilot Test Switch
[516] = "%.1f", --FBW Test Cover
[517] = "%.1f", --FBW Test Switch
--FBW
[330] = "%.1f", --FBW Spin Switch
[420] = "%.1f", --FBW Disconnect Cover
[421] = "%.1f", --FBW Disconnect Switch
[422] = "%.1f", --FBW G Limiter Switch
[460] = "%.1f", --Intake slats Operation Switch
[461] = "%.1f", --Intake cones Operation Switch
-- PELLES, SOURIS AND BECS
[462] = "%.1f", --Slats Operation Switch
[395] = "%.1f", --Hydraulic System Selector
[396] = "%.1f", --Pedal Adjust Lever
-- RADAR
[481] = "%.1f", --Radar Illumination Switch
[482] = "%.1f", --Radar Test Switch
[483] = "%.1f", --Radar Rearm Switch
[484] = "%.1f", --Radar Doppler Reject Selector
[486] = "%.1f", --Radar Power Switch
[488] = "%.4f", --Radar Gain Dial
[491] = "%.1f", --A/G Radar A Mode
[493] = "%.1f", --A/G Radar DEC Mode
[495] = "%.1f", --A/G Radar VISU Mode
[499] = "%.1f", --Radar Grid Selector
[500] = "%.1f", --Target Memory Time Selector
[502] = "%.1f", --Radar Scan Lines Selector
[503] = "%.1f", --Radar Range Selector
[504] = "%.1f", --AA Radar STT Selector
[506] = "%.1f", --Radar Azimuth Aperture Selector
[598] = "%.1f", --Radar IFF Mode Switch
[599] = "%.1f", --Radar IFF L/R Selector
[600] = "%.1f", --Radar IFF Power Switch
[601] = "%.1f", --Radar IFF Code-4 Selector
[602] = "%.1f", --Radar IFF Code-3 Selector
[603] = "%.1f", --Radar IFF Code-2 Selector
[604] = "%.1f", --Radar IFF Code-1 Selector
[109] = "%.1f", --Radar PRF Selector
[710] = "%.1f", --TDC Mode
-- ELECTRICAL PANEL
[520] = "%.1f", --Main Battery Switch
[521] = "%.1f", --Electric Power Transfer Switch
[522] = "%.1f", --Alternator 1 Switch
[523] = "%.1f", --Alternator 2 Switch
[524] = "%.1f", --Lights Test Switch
[654] = "%.1f", --Alert Network (QRA) Switch
-- PCN
[570] = "%.1f", --INS PREP Switch
[572] = "%.1f", --INS DEST Switch
[574] = "%.1f", --INS Parameter Selector
[575] = "%.4f", --Light Brightnes Control/Test
[576] = "%.1f", --Offset Waypoint/Target
[578] = "%.1f", --INS Update
[580] = "%.1f", --Validate Data Entry
[582] = "%.1f", --Mark Position
[584] = "%.1f", --INS Button 1
[585] = "%.1f", --INS Button 2
[586] = "%.1f", --INS Button 3
[587] = "%.1f", --INS Button 4
[588] = "%.1f", --INS Button 5
[589] = "%.1f", --INS Button 6
[590] = "%.1f", --INS Button 7
[591] = "%.1f", --INS Button 8
[592] = "%.1f", --INS Button 9
[593] = "%.1f", --INS Button 0
[594] = "%.1f", --INS Clear Button
[596] = "%.1f", --INS ENTER Button
[667] = "%.1f", --AUTO Navigation
[437] = "%.1f", --BAD button light
[438] = "%.1f", --REC button light
[439] = "%.1f", --MRQ button light
[440] = "%.1f", --VAL button light
-- PSM
[627] = "%.1f", --INS Mode Selector
[628] = "%.1f", --MIP Data Slot
[629] = "%.1f", --INS Operational Mode
[665] = "%.1f", --INS Auxiliary Heading/Horizon
[673] = "%.1f", --DTC Cartridge Position
[674] = "%.1f", --DTC Cartridge Presence
-- EW PANEL
[228] = "%.4f", --RWR Light Brightnes Control
[605] = "%.1f", --EW Mode Selector Switch
[606] = "%.1f", --BR Switch
[607] = "%.1f", --RWR Switch
[608] = "%.1f", --D2M Switch
[609] = "%.1f", --LL (Jammer) Switch
[610] = "%.1f", --Jammer Strength
-- ECM BOX
[194] = "%.1f", --ECM Box Mode Switch
[195] = "%.1f", --ECM Box Switch
[196] = "%.1f", --ECM Box Lighs Switch
[197] = "%.1f", --ECM Box LCD Display Brightness
-- Panel Lights
[449] = "%.1f", --Police Lights
[450] = "%.1f", --Landing Lights
[452] = "%.1f", --Refuel Lights
[453] = "%.1f", --Anti-Collision Lights
[454] = "%.1f", --Navigation Lights
[455] = "%.1f", --Formation Lights
[639] = "%.4f", --Dashboard Flood Lights
[640] = "%.4f", --Dashboard Panel Lights
[641] = "%.4f", --Console Flood Lights
[642] = "%.4f", --Console Panel Lights
[643] = "%.4f", --Casution/Advisory Lights Rheostat
[644] = "%.4f", --White Flood Lights Knob
[920] = "%.4f", --Refuel Lights Brightness Knob
-- Engine Start Panel
[468] = "%.1f", --Engine In-Flight Start Switch
[467] = "%.1f", --Engine Shutdown Button
[645] = "%.1f", --Engine Start Switch Cover
[646] = "%.1f", --Starter Fuel Pump Switch
[647] = "%.1f", --Engine Fuel Left Boost Pump Switch
[648] = "%.1f", --Engine Fuel Right Boost Pump Switch
[649] = "%.1f", --Engine Start Switch
[650] = "%.1f", --Ventilation Selector Switch
[651] = "%.1f", --Fuel Cutoff Switch Cover
[652] = "%.1f", --Fuel Cutoff Switch
[477] = "%.1f", --Fuel Dump Switch Cover
[478] = "%.1f", --Fuel Dump Switch
[471] = "%.1f", --A/B Emergency Cutoff Switch Cover
[472] = "%.1f", --A/B Emergency Cutoff Switch
[464] = "%.1f", --Emergency Throttle Cover
[465] = "%.1f", --Emergency Throttle Handle
[473] = "%.1f", --Secondary Oil Control Cover
[474] = "%.1f", --Secondary Oil Control Switch
[475] = "%.1f", --Engine Emergency Control Cover
[476] = "%.1f", --Engine Emergency Control Switch
[470] = "%.1f", --Radar WOW Emitter Authorize Switch
-- Navigational Antennas
[616] = "%.1f", --VOR/ILS Frequency Change Whole
[617] = "%.1f", --VOR/ILS Power Dial
[618] = "%.2f", --VOR/ILS Frequency Change Decimal
[619] = "%.1f", --VOR/ILS Test Dial
-- TACAN
[623] = "%.1f", --TACAN Channel Change Tens
[624] = "%.1f", --TACAN X/Y Select
[625] = "%.1f", --TACAN Channel Change Ones
[626] = "%.1f", --TACAN Mode Select
-- Miscelaneous Right Panel
[657] = "%.1f", -- Hydraulic Emergency Pump Switch
[658] = "%.1f", -- Audio Warning Switch
[659] = "%.1f", -- Pitot Heat Cover
[660] = "%.1f", -- Pitot Heat Switch
-- Miscelaneous Left Panel
[191] = "%.1f", --Audio Warning Reset
-- Miscelaneous Seat
[458] = "%.1f", --Anti-Skid Cover
[459] = "%.1f", --Anti-Skid Switch
[666] = "%.1f", --Parking Brake Lever
[807] = "%.1f", --Nose Wheel Steering / IFF
-- Télé Affichage TAF - GCI
[968] = "%.2f", --EVF Channel selector
[970] = "%.2f", --EVF Panel Test
-- Jumelles de Vision Nocturnes (JNV - NVG)
[672] = "%.1f", --NVG lights Filter Switch
-- Sound Panel
[700] = "%.1f", --AMPLIS Selector
[701] = "%.1f", --VOR/ILS Volume {0.0,1.0} in 0.1 steps
[702] = "%.1f", --TACAN Volume {0.0,1.0} in 0.1 steps
[703] = "%.1f", --MAGIC Tone Volume {0.0,1.0} in 0.1 steps
[704] = "%.1f", --TB APP Volume {0.0,1.0} in 0.1 steps
[705] = "%.1f", --Marker Signal Volume {0.0,1.0} in 0.1 steps
[706] = "%.1f", --V/UHF Radio Volume {0.0,1.0} in 0.1 steps
[707] = "%.1f", --VHF Radio Volume {0.0,1.0} in 0.1 steps
-- ALT
[309] = "%.1f", --Barometric Pressure Calibration
[314] = "%.1f", --ADI Cage Lever
[315] = "%.1f", --ADI Backlight Switch
[325] = "%.1f", --Backup ADI Cage
[328] = "%.4f", --Backup ADI Pitch Adjust Knob {-1.0,1.0} in 0.1 steps
-- Center console IFF
[383] = "%.1f", --Ident Power Switch {-1.0,0.0,1.0}
[384] = "%.1f", --Mode-1 Switch
[385] = "%.1f", --Mode-2 Switch
[386] = "%.1f", --Mode-3A Switch
[387] = "%.1f", --Mode-C Switch
-- Miscelaneous Seat
[900] = "%.1f", --Seat Adjustment Switch
[910] = "%.1f", --LOX Dilution Lever
[912] = "%.1f", --LOX Emergency Supply
[911] = "%.1f", --LOX Test Switch
-- ECS Panel
[630] = "%.1f", --ECS Main Mode Switch
[631] = "%.1f", --ECS C Button
[633] = "%.1f", --ECS F Button
[635] = "%.1f", --ECS Cond Switch
[636] = "%.1f", --ECS Air Exchange Switch
[637] = "%.1f", --ECS Temperature Select Knob {-1.0,1.0} in 0.1 steps
[638] = "%.1f", --ECS Defog Switch
-- Radio Panel
[429] = "%.1f", --UHF Power 5W/25W Switch
[430] = "%.1f", --UHF SIL Switch
[431] = "%.1f", --UHF E-A2 Switch
[432] = "%.1f", --UHF CDE Switch
[433] = "%.3f", --UHF Mode Switch
[434] = "%.1f", --UHF TEST Switch
[435] = "%.1f", --UHF Knob
[441] = "%.1f", --U/VHF Select 10 MHz
[442] = "%.1f", --U/VHF Select 1 MHz
[443] = "%.1f", --U/VHF Select 100 KHz
[444] = "%.1f", --U/VHF Select 25 KHz
[445] = "%.1f", --U/VHF Knob
[446] = "%.1f", --U/VHF Mode Switch 1
[447] = "%.1f", --U/VHF Power 5W/25W Switch
[448] = "%.1f", --U/VHF Manual/Preset
[950] = "%.1f", -- Mode knob
-- Countermeasures
[991] = "%d", -- LL
[992] = "%d", -- EM
[993] = "%d", -- IR
[994] = "%d", -- EO
}
-----------------------------
-- HIGH IMPORTANCE EXPORTS --
-- done every export event --
-----------------------------
-- Pointed to by ProcessIkarusDCSHighImportance
function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) -- <- special function for get frequency data
ExportScript.Tools.SendData(2000, ExportScript.Tools.RoundFreqeuncy((UHF_RADIO:get_frequency()/1000000))) -- ExportScript.Tools.RoundFreqeuncy(frequency (MHz|KHz), format ("7.3"), PrefixZeros (false), LeastValue (0.025))
]]
end
function ExportScript.ProcessDACConfigHighImportance(mainPanelDevice)
--[[
export in low tick interval to DAC
Example from A-10C
Get Radio Frequencies
get data from device
local UHF_RADIO = GetDevice(54)
ExportScript.Tools.SendDataDAC("ExportID", "Format")
ExportScript.Tools.SendDataDAC("ExportID", "Format", HardwareConfigID)
ExportScript.Tools.SendDataDAC("2000", string.format("%7.3f", UHF_RADIO:get_frequency()/1000000))
ExportScript.Tools.SendDataDAC("2000", ExportScript.Tools.RoundFreqeuncy((UHF_RADIO:get_frequency()/1000000))) -- ExportScript.Tools.RoundFreqeuncy(frequency (MHz|KHz), format ("7.3"), PrefixZeros (false), LeastValue (0.025))
]]
end
-----------------------------------------------------
-- LOW IMPORTANCE EXPORTS --
-- done every gExportLowTickInterval export events --
-----------------------------------------------------
-- Pointed to by ExportScript.ProcessIkarusDCSConfigLowImportance
function ExportScript.ProcessIkarusDCSConfigLowImportance(mainPanelDevice)
--[[
export in low tick interval to Ikarus
Example from A-10C
Get Radio Frequencies
get data from device
local lUHFRadio = GetDevice(54)
ExportScript.Tools.SendData("ExportID", "Format")
ExportScript.Tools.SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000)) -- <- special function for get frequency data
ExportScript.Tools.SendData(2000, ExportScript.Tools.RoundFreqeuncy((UHF_RADIO:get_frequency()/1000000))) -- ExportScript.Tools.RoundFreqeuncy(frequency (MHz|KHz), format ("7.3"), PrefixZeros (false), LeastValue (0.025))
]]
-- Master Caution/Warning. Uses unicode characters to mask relevant part of the icon if it's off.
local caution_on = mainPanelDevice:get_argument_value(199) == 1.0
local warning_on = mainPanelDevice:get_argument_value(200) == 1.0
ExportScript.Tools.SendData(2100, text_for_split_indicator_light(caution_on, warning_on))
-- Autopilot master lamp. Uses unicode characters to mask relevant part of the icon if it's off.
local AP_yellow = mainPanelDevice:get_argument_value(283) == 1.0
local AP_green = mainPanelDevice:get_argument_value(284) == 1.0
ExportScript.Tools.SendData(2101, text_for_split_indicator_light(AP_yellow, AP_green))
-- ECM Mode Switch
-- [194] = "%.1f", --ECM Box Mode Switch
local lECM_On = (mainPanelDevice:get_argument_value(194) > 0.0 and true or false)
-- FUEL
local lFUEL = ExportScript.Tools.getListIndicatorValue(3)
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog('lFUEL : '..ExportScript.Tools.dump(lFUEL))
end
if lFUEL ~= nil and lFUEL.txt_fuel_g ~= nil then
-- string with max 3 charachters
ExportScript.Tools.SendData(2003, string.format("%s", lFUEL.txt_fuel_g))
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog('2003: '..ExportScript.Tools.dump(lFUEL.txt_fuel_g))
end
else
ExportScript.Tools.SendData(2003, " ")
end
-- PCA_UR (Weappon Panel top line)
local lPCAUR = list_indication(4)
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog('lPCAUR : '..ExportScript.Tools.dump(lPCAUR))
end
local to1, to2, from1, from2 = nil, nil, nil, nil
local lPCA_UR = {"", "", "", "", ""}
to1, to2 = lPCAUR:find("PCA_UR")
local lIndex, lIndex2
if (to1 ~= nil) then
for lIndex = 1, 5, 1 do
lIndex2 = lIndex - 1
from1, from2 = lPCAUR:find("PCA_LCD_1_"..lIndex2.."%c")
if (from2 ~= nil) then
to1, to2 = lPCAUR:find("%c", from2+2)
if (to1 ~= nil) then
lPCA_UR[lIndex] = lPCAUR:sub(from2+1, to1-1)
if (lPCA_UR[lIndex]:len() > 3) then
-- ExportScript.Tools.WriteToLog("cleanup UR "..string.format("%s", lPCA_UR[lIndex]))
lPCA_UR[lIndex] = ""
end
end
end
end -- for
end
-- string with max 3 charachters
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("2010: "..string.format("%s", lPCA_UR[1]))
ExportScript.Tools.WriteToLog("2011: "..string.format("%s", lPCA_UR[2]))
ExportScript.Tools.WriteToLog("2012: "..string.format("%s", lPCA_UR[3]))
ExportScript.Tools.WriteToLog("2013: "..string.format("%s", lPCA_UR[4]))
ExportScript.Tools.WriteToLog("2014: "..string.format("%s", lPCA_UR[5]))
end
ExportScript.Tools.SendData(2010, string.format("%s", lPCA_UR[1]))
ExportScript.Tools.SendData(2011, string.format("%s", lPCA_UR[2]))
ExportScript.Tools.SendData(2012, string.format("%s", lPCA_UR[3]))
ExportScript.Tools.SendData(2013, string.format("%s", lPCA_UR[4]))
ExportScript.Tools.SendData(2014, string.format("%s", lPCA_UR[5]))
-- PCA_BR (Weappon Panel bottom line)
local lPCABR = list_indication(5)
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog('lPCABR : '..ExportScript.Tools.dump(lPCABR))
end
local to1, to2, from1, from2 = nil, nil, nil, nil
local lPCA_BR = {"", "", "", "", ""}
to1, to2 = lPCABR:find("PCA_BR")
if (to1 ~= nil) then
for lIndex = 1, 5, 1 do
lIndex2 = lIndex - 1
from1, from2 = lPCABR:find("PCA_LCD_2_"..lIndex2.."%c")
if (from2 ~= nil) then
to1, to2 = lPCABR:find("%c", from2+2)