MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

Go to page 1Go to page 2123Go to page 4Go to page 3
Avatar
Hannes
From: Austria
Posts: 151
Supporter
Hallo,

Eine Frage zu dem oben angeführten Script. Habe dies so übernommen und auf einige Werte von mir abgeändert. Funktioniert perfekt. Jedoch jegliche weitere Lvar die ich hinzufüge funktionieren nicht mehr. Weiß aber nicht warum. Könnte es eventuell mit den Byte Werten zusammenhängen. Wie finde ich heraus, welchen Wert ich verwenden muss. In der Lvar Liste der A2A stehen nur die Lvars aber sonst keine Informationen. Hier noch mein Code, der soweit funktioniert.

iconCode:
local UB = {r=ipc.readUB,w=ipc.writeUB} -- 1 Byte Int
local UW = {r=ipc.readUW,w=ipc.writeUW} -- 2 Byte Int
local UD = {r=ipc.readUD,w=ipc.writeUD} -- 4 Byte Int
local FLT = {r=ipc.readFLT,w=ipc.writeFLT} -- 4 Byte Float
local DBL = {r=ipc.readDBL,w=ipc.writeDBL} -- 8 Byte Float
local STR = {r=ipc.readSTR,w=ipc.writeSTR} -- String

local EN1 = "66FF" -- master offset enable

local R = 0
local W = 1

--[[
	Every entry in lvar_list corresponds to one offset.
	How to build an entry:
	{"offset", mode, {enable_switches}, {lvars}}
	- offset = fsuipc offset (between 0x66C0 and 0x66FF)
	- mode is either R or W. R means only read from lvar
	and W means only write to lvar. (e.g. an LED displaying
	the flaps status is R. A switch that extends the gear
	is W.)
	- enable_switches = list of offsets which all have to
	be set to 1 otherwise the line gets ignored. This is useful
	for shared cockpit so that if you are not in charge of the
	buttons your switches won't override the switches of the 
	other pilot.
	-- lvars = list of lvars that get the same value written to.
	You should only use one lvar when mode=R.
]]
local lvar_list = {
    {"66D1", W, {}, UB, { "Panellightknob" }},
    {"66D3", R, {}, UB, { "OILPRESSLIGHT" }},
    {"66D4", R, {}, UB, { "VOLTSLIGHT" }},
    {"66D5", R, {}, UB, { "VACLIGHT" }},
    {"66D6", R, {}, UB, { "FUELLIGHT" }},
--Weitere Einträge funktionieren nicht mehr ???
}

-- set this to true if you want to force your own switch positions on start
local initialized = false

while true do
	for _,v in pairs(lvar_list) do
		local offset = v[1]
		local mode = v[2]
		local enable_offsets = v[3]
		local offset_type = v[4]
		local lvars = v[5]
			
		-- check all enable switches are set
		local enabled = true
		for _, enable_offset in pairs(enable_offsets) do
			local val = ipc.readUB(enable_offset)
			if val == 0 then
				enabled = false
			end
		end
		
		if enabled == true then -- skip line if disabled
			if initialized == true and mode == W then -- write mode			
				-- read offset
				local offset_val = offset_type.r(offset)
				
				-- update lvars
				for _, lvar in pairs(lvars) do
					ipc.writeLvar(lvar, offset_val)
				end
			else -- read mode
				-- read lvars
				local lvar_val = ipc.readLvar(lvars[1])
				
				-- update offset
				offset_type.w(offset, lvar_val)
			end
		end
	end
	initialized = true
end


Und die aktuelle Lvar Liste der A2A C172:

iconCode:
A2A C172 Trainer
variables list and notes for simpit builders
Gauges:
(L:AirspeedIndicatedNeedle,number) - airspeed needle
(L:AirspeedTAS,number) - IAS/TAS conversion chart (range: 0 – 110)
(A:ATTITUDE INDICATOR PITCH DEGREES:1,degrees) - artificial horizon, attitude
(A:ATTITUDE INDICATOR BANK DEGREES:1,grad) - artificial horizon, bank
(A:INDICATED ALTITUDE:1,feet) 1000 % 10 / 100 + - altimeter needle (hundreds feet) (range: 0 –200)
(A:INDICATED ALTITUDE:1,feet) 10000 % 100 / 100 + - altimeter needle (thousands feet) (range: 0 –200)
(A:INDICATED ALTITUDE:1,feet) 100000 % 1000 / 100 + - altimeter needle (ten thousands feet) (range: 0 –200)
(A:KOHLSMAN SETTING HG:1,inHg) 27.99 - 24.87562 * - Kohlsman knob in inHg (range: 0 – 100)
(A:KOHLSMAN SETTING HG:1,hectopascals) 950 - - Kohlsman knob in hPa (range: 0 – 100)
(L:Nav1ObsNeedle,number) - nav1 obs (range: 0 -180) – read only – inc/dec by default events
(>K:VOR1_OBI_INC) and (>K:VOR1_OBI_DEC)
(L:Gsi1Needle,keyframe) - glideslope indicator (range: 0 – 100)
(L:Gsi1Flag,enum) - glideslope indicator flag (0 – off, 1 – on)
(L:Cdi1Needle,keyframe) - course deviation indicator (range: 0 – 100)
(L:ToFrom1Needle,enum) - to/from flag (0 – off, 1 – to, 2 – from)
(L:FuelLeftWingTank,gallons) - left fuel tank
(L:FuelRightWingTank,gallons) - right fuel tank
(L:Eng1_EGTGauge,number) - exhaust gas temp in F
(L:EGTGauge_ref,percent) - egt ref needle (range: 0 – 100)
(L:Eng1_GPH,gallons) - fuel flow in gallons per hour
(L:Eng1_OilTemp,celsius) - oil temp in C
(L:Eng1_OilPressure,psi) - oil pressure in psi
(A:SUCTION PRESSURE,inHg) - suction
(L:Ammeter1,amps) - ammeter
(A:DELTA HEADING RATE,degrees per second) 1.1 * -10 max 10 min 10 + 5 * - turn indicator (range: 0 – 100)
(A:TURN COORDINATOR BALL,position) -1 max 1 min 1 + 25 * - ball (range: 0 – 50)
(L:HiAdjust,number) - heading indicator knob
(L:AutopilotHeadingBug,number) - heading bug – read only – inc/dec by default events
(>K:HEADING_BUG_INC) and (>K:HEADING_BUG_DEC)
(L:HeadingGyro,degrees) - heading gyro
(A:VERTICAL SPEED,feet per minute) - vertical speed indicator
(L:Cdi2Needle,keyframe) - course deviation indicator (range: 0 – 100)
(L:ToFrom2Needle,enum) - to/from flag (0 – off, 1 – to, 2 – from)
(L:Cdi2Flag,bool) - course deviation indicator flag (0 – off, 1 – on)
(L:Nav2ObsNeedle,number) - nav2 obs (range: 0 -180) – read only – inc/dec by default events
(>K:VOR2_OBI_INC) and (>K:VOR2_OBI_DEC)
(L:Eng1_RPM,RPM) - engine rpm
(L:e1Hour4,number) - engine hours, thousands
(L:e1Hour3,number) - engine hours, hundreds
(L:e1Hour2,number) - engine hours, tens
(L:e1Hour1,number) - engine hours, ones
(L: e1HourFract1,number) - engine hours, tenths
(L:AdfHdgNeedle,number) - adf heading – read only – inc/dec by default events
(>K:ADF_CARD_INC) and (>K: ADF_CARD _DEC)
(L:AdfCdiNeedle,keyframe) - ADF course deviation needle
(A:WISKEY COMPASS INDICATION DEGREES,degrees) - Whiskey compass
Switches:
(L:Eng1_GeneratorSwitch,bool) - generator switch
(L:Battery1Switch,bool) - battery switch
(>K:TOGGLE_ELECT_FUEL_PUMP1) - fuel pump
(>K:TOGGLE_BEACON_LIGHTS) - default beacon light toggle event
(>K:LANDING_LIGHTS_TOGGLE) - default landing light toggle event
(>K:TOGGLE_TAXI_LIGHTS) - default taxi light toggle event
(>K:TOGGLE_NAV_LIGHTS) - default nav light toggle event
(>K:STROBES_TOGGLE) - default strobe light toggle event
(>K:PITOT_HEAT_TOGGLE) - default pitot heat toggle event
1 (>K:AVIONICS_MASTER_SET) (on)
0 (>K:AVIONICS_MASTER_SET) (off) - default avionics master set event
Center pedestal/lower main dash:
(L:Magnetos1Pct,percent) - starter key (range: 0 – 15: off; 16 – 37: R magneto; 38 – 63: L magneto;
64 – 85: both magnetos; 86 – 100: starter)
(L:FSelC172State,enum) - fuel selector (0 – left, 1 – both, 2 – right)
(L:Eng1_FuelCutOffSwitch,bool) - fuel cutoff lever (on/off)
(L:TrimtabPosition,percent) - elevator trim position– read only – inc/dec by default events
(>K:ELEV_TRIM_DN) and (>K:ELEV_TRIM_UP)
(L:GlareshieldLightKnob,number) - illumination of the main dash (range: 0 – 32)
(L:PedestalLightKnob,number) - illumination of the fuel selector (range: 0 – 32)
(L:RadioLightKnob,number) - illumination of the radiostack (range: 0 – 32)
(L:PanelLightKnob,number) - illumination of the gauges (range: 0 – 32)
(L:StaticAir,bool) - static air lever (on/off)
(L:Throttle1Position,percent) - throttle lever (range: 0 – 100)
(L:Eng1_MixtureManualLever,percent) - mixture lever (range: 0 – 100)
(L:LandFlapsPos,enum) - flaps position lever (0 – up, 1 – 2/4, 2 – 3/4, 3 – down)
(A:TRAILING EDGE FLAPS LEFT PERCENT,percent) - flaps position indicator (range: 0 – 100)
(L:CabinTempControl,percent) - cockpit heat (range: 0 – 100)
(L:CabinVent,percent) - cockpit ventilation (range: 0 – 100)
(>K:PARKING_BRAKES) - default parking brakes event
Radiostack:
KMA 26 Audioselector:
(L:kma26SelectorKnob_pos,enum) - Audio selector knob (0 – inop/com1, 1 – com1, 2 – com2, 3 – inop/com2, 4 – inop/com2)
Com1 button - if com2 transmit selected use default (>K:COM_RECEIVE_ALL_TOGGLE)
Com2 button - if com1 transmit selected use default (>K:COM_RECEIVE_ALL_TOGGLE)
Com3 button - inop (FSX supports just two com channels)
Nav1 button - if (L:kma26Nav1Switch,bool) is zero, toggle default
(>K:RADIO_VOR1_IDENT_DISABLE) event
Nav2 button - if (L:kma26Nav2Switch,bool) is zero, toggle default
(>K:RADIO_VOR2_IDENT_DISABLE) event
Mkr button - if (L:kma26MkrSwitch,bool) is 1 and (A:MARKER SOUND,bool) is 0 toggle default
(>K:MARKER_SOUND_TOGGLE)
if (L:kma26MkrSwitch,bool) is 0 and (A:MARKER SOUND,bool) is 1 toggle default
(>K:MARKER_SOUND_TOGGLE)
DME button - if (L:kma26DmeSwitch,bool) is 1 toggle default
(>K:RADIO_DME1_IDENT_ENABLE)
if (L:kma26DmeSwitch,bool) is 0 toggle default
(>K:RADIO_DME1_IDENT_DISABLE)
ADF button - if (L:kma26AdfSwitch,bool) is 1 toggle default
(>K:RADIO_ADF_IDENT_ENABLE)
if (L:kma26AdfSwitch,bool) is 0 toggle default
(>K:RADIO_ADF_IDENT_DISABLE)
Aux button - inop
Moni button - inop
Marker lights - (L:kma26OMarker,bool) – outer marker; (L:kma26MMarker,bool) – middle marker;
(L:kma26IMarker,bool) – inner marker
KX 155A Com1/Nav1 unit:
Com1 on/off knob - (L:Com1OnOff,bool)
Com1 STBY button - (L:Com1StbySwitch,bool)
Com1 CHAN button - (L:Com1ChanSwitch,bool)
Com1 outer knob - (L:Com1FreqOuterKnob,percent) (range: 0 – 100)
Com1 inner knob - (L:Com1FreqInnerKnob,percent) (range: 0 -100)
Com1 inner knob pull - (L:Com1InnerKnobPull,bool)
Nav1 ident knob - (L:Nav1Ident,bool)
If (L:Nav1Ident,bool) is equal to zero, toggle the (>K:RADIO_VOR1_IDENT_DISABLE) event
Nav1 STBY button - (L:Nav1StbySwitch,bool)
Nav1 MODE button - (L:Com1NavSwitch,bool)
Nav1 outer knob - (L:Nav1FreqOuterKnob,percent) (range: 0 – 100)
Nav1 inner knob - (L:Nav1FreqInnerKnob,percent) (range: 0 – 100)
Nav1 inner knob pull - (L:Nav1InnerKnobPull,bool)
KX 155A Com2/Nav2 unit:
Com2 on/off knob - (L:Com2OnOff,bool)
Com2 STBY button - (L:Com2StbySwitch,bool)
Com2 CHAN button - (L:Com2ChanSwitch,bool)
Com2 outer knob - (L:Com2FreqOuterKnob,percent) (range: 0 – 100)
Com2 inner knob - (L:Com2FreqInnerKnob,percent) (range: 0 -100)
Com2 inner knob pull - (L:Com2InnerKnobPull,bool)
Nav2 ident knob - (L:Nav2Ident,bool)
If (L:Nav2Ident,bool) is equal to zero, toggle the (>K:RADIO_VOR2_IDENT_DISABLE) event
Nav2 STBY button - (L:Nav2StbySwitch,bool)
Nav2 MODE button - (L:Com2NavSwitch,bool)
Nav2 outer knob - (L:Nav2FreqOuterKnob,percent) (range: 0 – 100)
Nav2 inner knob - (L:Nav2FreqInnerKnob,percent) (range: 0 – 100)
Nav2 inner knob pull - (L:Nav2InnerKnobPull,bool)
ADF unit:
ADF on/off knob - (L:AdfOnOffKnob,bool)
ADF button - (L:AdfAdfButton,bool)
BFO button - (L:AdfBfoButton,bool)
FRQ/Arrows button - (L:AdfFrqButton,bool), also set (L:FrqButton,bool) to 1, don’t change to 0 on button release
FRQ/ET button - (L:AdfFrqEtButton,bool) , also set (L:FrqEtButton,bool) to 1, don’t change to 0 on button release
SET/RST button - (L:AdfFrqRstButton,bool) , also set (L:FrqRstButton,bool) to 1, don’t change to 0 on button release
ADF outer knob - (L:AdfFreqOuterKnob,percent) (range: 0 – 100)
ADF inner knob - (L:AdfFreqInnerKnob,percent) (range: 0 – 100)
ADF inner knob pull - (L:AdfFreqInnerKnobPull,bool)
KT76C transponder unit:
0 button - (L:xpdr_0_button,bool) , also set (L:xpdr_digit0,bool) to 1, don’t change to 0 on button release
1 button - (L:xpdr_1_button,bool) , also set (L:xpdr_digit1,bool) to 1, don’t change to 0 on button release
2 button - (L:xpdr_2_button,bool) , also set (L:xpdr_digit2,bool) to 1, don’t change to 0 on button release
3 button - (L:xpdr_3_button,bool) , also set (L:xpdr_digit3,bool) to 1, don’t change to 0 on button release
4 button - (L:xpdr_4_button,bool) , also set (L:xpdr_digit4,bool) to 1, don’t change to 0 on button release
5 button - (L:xpdr_5_button,bool) , also set (L:xpdr_digit5,bool) to 1, don’t change to 0 on button release
6 button - (L:xpdr_6_button,bool) , also set (L:xpdr_digit6,bool) to 1, don’t change to 0 on button release
7 button - (L:xpdr_7_button,bool) , also set (L:xpdr_digit7,bool) to 1, don’t change to 0 on button release
IDT button - (L:xpdr_ident_button,bool)
CLR button - (L:xpdr_clr_button,bool) , also set (L:xpdr_clr,bool) to 1, don’t change to 0 on button release
VFR button - (L:xpdr_vfr_button,bool) , also set (L:xpdr_vfr,bool) to 1, don’t change to 0 on button release
On/off knob - (L:xpdr_onoff_knob_pos,enum) (0 – off, 1 – Standby, 2 – Test, 3 – On, 4 – Alt)
KAP 140 Autopilot unit:
AP button - (L:kap140_ap_button,bool), also set (L:kap140_ap,bool) to 1, don’t change to 0 on button release
HDG button - (L:kap140_hdg_button,bool) , also set (L:kap140_hdg,bool) to 1, don’t change to 0 on button release
NAV button - (L:kap140_nav_button,bool) , also set (L:kap140_nav,bool) to 1, don’t change to 0 on button release
APR button - (L:kap140_apr_button,bool) , also set (L:kap140_apr,bool) to 1, don’t change to 0 on button release
REV button - (L:kap140_rev_button,bool) , also set (L:kap140_rev,bool) to 1, don’t change to 0 on button release
ALT button - (L:kap140_alt_button,bool) , also set (L:kap140_alt,bool) to 1, don’t change to 0 on button release
UP button - (L:kap140_up_button,bool) , also set (L:kap140_up,bool) to 1, don’t change to 0 on button release
DN button - (L:kap140_dn_button,bool) , also set (L:kap140_dn,bool) to 1, don’t change to 0 on button release
ARM button - (L:kap140_arm_button,bool) , also set (L:kap140_arm,bool) to 1, don’t change to 0 on button release
BARO button - (L:kap140_baro_button,bool) , also set (L:kap140_baro,bool) to 1, don’t change to 0 on button release
AP inner knob - (L:kap140_InnerKnob,percent) (range: 0 – 100)
AP outer knob - (L:kap140_OuterKnob,percent) (range: 0 – 100)
KN62 DME unit:
On/off switch - (L:kn62OnOff,bool)
Function switch - (L:kn62Function,enum) (0 – Remote, 1 – Frequency, 2 – Groundspeed/Time to station
DME outer knob - (L:Kn62OuterKnob,percent) (range: 0 – 100)
DME inner knob - (L:Kn62InnerKnob,percent) (range: 0 – 100)
DME inner knobPull - (L:Kn62InnerKnobPull,bool)
FSX GNS400 GPS:
gps_on_switch - toggle (L:GpsOnSwitch,bool), (>K:GPS_POWER_BUTTON) and (>K:GPS_CLEAR_ALL_BUTTON)
NRST button - (>K:GPS_NEAREST_BUTTON)
OBS button - (>K:GPS_OBS_BUTTON)
MSG button - (>K:GPS_MSG_BUTTON)
FPL button - (>K:GPS_FLIGHTPLAN_BUTTON)
TERR button - (>K:GPS_TERRAIN_BUTTON)
PROC button - (>K:GPS_PROCEDURE_BUTTON)
RNG plus button - (>K:GPS_ZOOMOUT_BUTTON)
RNG minus button - (>K:GPS_ZOOMIN_BUTTON)
D button - (>K:GPS_DIRECTTO_BUTTON)
MENU button - (>K:GPS_MENU_BUTTON)
CLR button - toggle (>K:GPS_CLEAR_BUTTON) event and increase (L:GpsClrSwitchCounter,enum) by one.
If (L:GpsClrSwitchCounter,enum) is equal 90 toggle (>K:GPS_CLEAR_ALL_BUTTON) event and reset the counter.
ENT button - (>K:GPS_ENTER_BUTTON)
GPS outer knob - (L:GpsOuterKnob,percent) for knob rotation in VC, use (>K:GPS_GROUP_KNOB_DEC) and
(>K:GPS_GROUP_KNOB_INC) events for GPS function.
GPS inner knob - (L:GpsInnerKnob,percent) for knob rotation in VC, use (>K:GPS_PAGE_KNOB_DEC) and
(>K:GPS_PAGE_KNOB_INC) events for GPS function.
GPS inner knob push - toggle (L:GpsInnerKnobPush,bool) for VC animation, use (>K:GPS_CURSOR_BUTTON) event for GPS function.
Misc:
Headphones simulation:
To set the headphones on three things are needed in this sequence:
(L:Headphones,bool) set to 1; (L:SystemCondSelectFSX,number) set to 57; (L:SystemCondValueFSX,number) set to 1
To set the headphones off these three variables has to be set in this sequence:
(L:Headphones,bool) set to 0; (L:SystemCondSelectFSX,number) set to 57; (L:SystemCondValueFSX,number) set to 0
Airframe hours counter:
(L:a1Hour4,number) - airframe hours, thousands
(L:a1Hour3,number) - airframe hours, hundreds
(L:a1Hour2,number) - airframe hours, tens
(L:a1Hour1,number) - airframe hours, ones
(L: a1HourFract1,number) - airframe hours, tenths
Doors:
(>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_1) - left doors (toggle)
(>K:TOGGLE_AIRCRAFT_EXIT) (>K:SELECT_2) - right doors (toggle)
(L:WindowLeft,bool) - left window (toggle)
(L:WindowRight,bool) - right window (toggle)
Defrosters:
(L:WindowDefrosterControl1,number) - left defroster levers (range: 0 – 50)
(L:WindowDefrosterControl2,number) - right defroster levers (range: 0 – 50)


Benötigen würde ich noch die Buttons für HDG Hold, ALT Hold, usw. vom Autopiloten und die Buttons für Com1, Com2, NAV1, NAV2, BOTH, MKR, ADF, usw.

Wenn jemand eine Idee hat wäre ich froh. Vielen Dank
www.modellbau-technik.at
hannes.dobersberger@modellbau-technik.at
2019-01-08 06:52
Avatar
Hannes
From: Austria
Posts: 151
Supporter
Hat jemand eine Idee?
www.modellbau-technik.at
hannes.dobersberger@modellbau-technik.at
2019-01-13 13:51
Avatar
Hannes
From: Austria
Posts: 151
Supporter
Hallo Tommy1332,

Könntest du mir hier eventuell noch weiterhelfen?

Vielen Dank
www.modellbau-technik.at
hannes.dobersberger@modellbau-technik.at
2019-01-30 13:38
Avatar
jensenvphilip@gmail.com
Posts: 5
Hi there,

I have just started on the CRJ, any chance you can send an example of the LED out lua script you made?

cheers
2019-05-13 11:29
Avatar
CaptainJack
Posts: 5
Guys working on qw787 lua scripts how to programm lvar with encoder I don't have any idea how to do that. Will be there simple tutorial how to use lua in mobiflight since it's added at 7.5 version
2019-06-16 13:52
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2765
Supporter
The Lua PlugIn is just a "transmitter" that can Start/Stop Lua Cripts or Macros.

so you can not include Lua scripts or so in Mobiflight itself. Those scripts must be written/saved and included in FSUIPC like in the past....
The "Lua Plugin" is just a plattform you can "start/Stop" a script or to fire a single Macro .

Without that it is needed to controll that things by a FSUIPC Key/Joybutton binding.

A Tutorial was never done by the guy who write this PlugIn. The only stuff we got a.t.m. is this.... https://www.mobiflight.com/forum/message/10232.html
Good Luck !
2019-06-16 15:36
Go to page 1Go to page 2123Go to page 4Go to page 3