I tried to implement user prop in the DR400 airspeed gauge with no avail.
In Create mode, the INFO lines returned is correct, but when added to a test panel, the Gauge properties panel displays: "This instrument has no user properties".
When I quit AM then restart, there appears only one property (the last one defined, ie user_prop_add_enum).???
Maybe I did something wrong? Here's the begining of the code:
Code: Select all
-------------------------------------------
-- DR400 Airpeed indicator with vibrating needle
-- Jacques ZAHAR 08/2017
-- sur une idée de CGOA Benoît (Aircockpit)
-- VERSION AIR MANAGER 3.0 ONLY
---------------------------------------------------
-- Let's give our instrument two properties
warn_user_prop = user_prop_add_real("Warning Speed Limit", 2.2, 3.0, 4.2, "Speed limit where the warning light should be visible")
alert_user_prop = user_prop_add_real("Alert Speed Limit", 4.3, 4.3, 5.6, "Speed limit where the alert light should be visible")
-- We can check here what the user has configured
print("The warning alarm is set to " .. user_prop_get(warn_user_prop) )
print("The Alert alarm is set to " .. user_prop_get(alert_user_prop) )
-- Let's give our instrument two properties
screws_prop = user_prop_add_boolean("Show screws", false, "Show the screws")
bezel_prop = user_prop_add_boolean("Show bezel", true, "Show the bezel")
-- We can check here what the user has configured
print("Show the screw graphics: ",user_prop_get(screws_prop) )
print("Show the bezel graphics: ",user_prop_get(bezel_prop) )
-- Let's give our instrument two properties
choice_prop = user_prop_add_enum("Lighting effect", "None,Day,Dusk,Night,Auto", "Auto", "You can choose a type lighting effect for the gauge (default is automatic depending on the period of the day)")
-- We can check here what the user has configured
print("Selected choice: " .. user_prop_get(choice_prop) )
-- CUSTOMIZATION VARIABLES ------
display_bezel=true
-- sample Values for a modern single engine (Cessna, Piper, Robin)
frequency=40 -- increase the 40 value to slow down the overall vibrations for "slow running" engines (up to 100 max)
vibmax=80 --beginning of max vibrations in %power
valmax=0.05 -- range of max vibration values
vibmid=30 --beginning of medium vibrations in %power
valmid=0.07
viblow=0.5 -- low idle
vallow=0.09
1- First It appears that there is a syntax error in the Wiki, as the following line (directly copied from the sample given in the Wiki) throws an error
-- Let's give our instrument two properties
screws_prop = user_prop_add_boolean("Show screws", true, "Show the screws")
bezel_prop = user_prop_add_boolean("Show bezel", true, "Show the bezel")
-- We can check here what the user has configured
print("Show the screw graphics: " .. user_prop_get(screws_prop) ) <---- ERROR trying to concatenate a boolean and a string
print("Show the bezel graphics: " .. user_prop_get(bezel_prop) ) <---- ERROR trying to concatenate a boolean and a string
I solved these by replacing the concatenation operator ".." by a comma "," as follows:
print("Show the screw graphics: ", user_prop_get(screws_prop) )
print("Show the bezel graphics: ", user_prop_get(bezel_prop) )
2- There is no way to modify/input the user properties in Create Mode, which makes it very difficult to implement user properties in the early phase of development. If a modification is made on a user property, one has to completely close and restart AM to have the instrument updated in Panel mode. Not very practical in the development phase IMHO.
Jacques