1
0
Fork 0

- GPS update by Zakharov

This commit is contained in:
helijah 2008-07-28 17:19:52 +00:00
parent 27b60a6a76
commit c231262e50
5 changed files with 87 additions and 55 deletions

View file

@ -10,10 +10,11 @@
<layer>
<name>line 0</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -36,10 +37,11 @@
<layer>
<name>line 1</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -68,10 +70,11 @@
<layer>
<name>line 2</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -100,10 +103,11 @@
<layer>
<name>line 3</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -132,10 +136,11 @@
<layer>
<name>line 4</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -164,10 +169,11 @@
<layer>
<name>line 5</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>
@ -200,10 +206,11 @@
<layer>
<name>line 6</name>
<condition>
<equals>
<property>/instrumentation/gps/serviceable</property>
<value>1</value>
</equals>
<greater-than>
<property>/instrumentation/zkv500/power</property>
<value>0</value>
</greater-than>
<property>/instrumentation/gps/serviceable</property>
</condition>
<type>text</type>
<font>lcd</font>

View file

@ -4062,7 +4062,7 @@ refs 4
22 0.0 0.0
kids 0
OBJECT poly
name "knob.ONOFF"
name "knob.POWER"
data 10
knob.ONOFF
crease 30.000000
@ -4801,7 +4801,7 @@ refs 3
96 0.0 0.0
kids 0
OBJECT poly
name "knob.ONOFF.circle"
name "knob.POWER.circle"
data 14
knob.ONOFF.001
crease 30.000000

View file

@ -97,19 +97,15 @@ var select_mode = func(dir) { #manage mode knob, cycle into available modes
refresh_display();
}
var switch_ON_OFF = func() { #manage ON/OFF knob
var power_knob = func() { #manage POWER knob
if (arg[0] > 0 and isOn < 11) isOn += 1;
elsif (arg[0] < 0 and isOn > 0) isOn -= 1;
else return;
if (isOn == 0) { #empty lcd display
for (var i = 0; i < LINES; i += 1) line[i].setValue("");
}
else
props.globals.getNode("/instrumentation/zkv500/retro-light").setDoubleValue((isOn - 1)/20);
props.globals.getNode("/instrumentation/zkv500/on_off_position",1).setIntValue(isOn);
props.globals.getNode("/instrumentation/gps/serviceable",1).setBoolValue((isOn > 0)? 1 : 0);
props.globals.getNode("/instrumentation/zkv500/power",1).setIntValue(isOn);
var light = 0;
if (isOn > 0 and getprop("instrumentation/gps/serviceable") != 0)
light = (isOn - 1)/20;
props.globals.getNode("/instrumentation/zkv500/retro-light").setDoubleValue(light);
refresh_display();
}
@ -285,27 +281,36 @@ var init_gps_variables = func {
page = 0;
displayed_screen = 0; #screenModeAndSettings
blocked = 0; #unlock left_knob
isOn = 0; #start OFF
#isOn = 0; #start OFF
startpos = nil; #unset start position
waypointindex = 0; #route waypoint index on beginning
}
var init_gps_props = func {
for (var i = 0; i < LINES; i += 1) {
append(line, props.globals.getNode("/instrumentation/zkv500/line[" ~ i ~ "]", 1));
line[i].setValue("");
}
props.globals.getNode("/instrumentation/gps/serviceable",1).setBoolValue(0);
props.globals.getNode("/instrumentation/zkv500/retro-light",1).setDoubleValue(0);
props.globals.getNode("/instrumentation/zkv500/on_off_position",1).setIntValue(0);
props.globals.getNode("/instrumentation/zkv500/power",1).setIntValue(0);
aircraft.light.new("/sim/model/gps/redled", [0.1, 0.1, 0.1, 0.7], "/instrumentation/gps/waypoint-alert");
aircraft.light.new("/sim/model/gps/greenled", [0.6, 0.3], "/instrumentation/gps/message-alert");
startpos = geo.Coord.new(geo.aircraft_position());
screenPositionMain.begin_time = props.globals.getNode("/sim/time/elapsed-sec",1).getValue();
setlistener("/instrumentation/gps/wp/wp[1]/TTW", waypointAlert, 0, 0);
setlistener("/instrumentation/gps/serviceable", func {
if (getprop("/instrumentation/gps/serviceable") == 0)
setprop("/instrumentation/zkv500/retro-light", 0);
elsif (isOn > 0)
setprop("/instrumentation/zkv500/retro-light", (isOn - 1)/20);
}, 0, 0);
}
var init = func() {
load_screens();
organize_screens();
init_gps_variables();
init_gps_props();
print("GPS... initialized");
}

View file

@ -27,7 +27,7 @@
<object-name>button.ENTER</object-name>
<object-name>button.START</object-name>
<object-name>button.ESCAPE</object-name>
<object-name>knob.ONOFF.circle</object-name>
<object-name>knob.POWER.circle</object-name>
<object-name>knob.MODE.circle</object-name>
<object-name>knob.RIGHT.circle</object-name>
<object-name>knob.LEFT.circle</object-name>
@ -43,6 +43,7 @@
<type>select</type>
<condition>
<property>/sim/model/gps/redled/state</property>
<property>/instrumentation/gps/serviceable</property>
</condition>
<object-name>LED.0_ON</object-name>
</animation>
@ -51,15 +52,16 @@
<type>select</type>
<condition>
<property>/sim/model/gps/greenled/state</property>
<property>/instrumentation/gps/serviceable</property>
</condition>
<object-name>LED.1_ON</object-name>
</animation>
<animation>
<type>rotate</type>
<object-name>knob.ONOFF</object-name>
<object-name>knob.ONOFF.circle</object-name>
<property>/instrumentation/zkv500/on_off_position</property>
<object-name>knob.POWER</object-name>
<object-name>knob.POWER.circle</object-name>
<property>/instrumentation/zkv500/power</property>
<factor>30</factor>
<axis>
<x>-1</x>
@ -75,8 +77,8 @@
<animation>
<type>pick</type>
<object-name>knob.ONOFF</object-name>
<object-name>knob.ONOFF.circle</object-name>
<object-name>knob.POWER</object-name>
<object-name>knob.POWER.circle</object-name>
<visible>true</visible>
<action>
<name>increase gps state off - on - enlighted</name>
@ -84,7 +86,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>zkv500.switch_ON_OFF(1)</script>
<script>zkv500.power_knob(1)</script>
</binding>
</action>
<action>
@ -93,7 +95,7 @@
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>zkv500.switch_ON_OFF(-1)</script>
<script>zkv500.power_knob(-1)</script>
</binding>
</action>
</animation>
@ -103,6 +105,9 @@
<object-name>knob.LEFT</object-name>
<object-name>knob.LEFT.circle</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>next menu</name>
<button>0</button>
@ -128,6 +133,9 @@
<object-name>knob.RIGHT</object-name>
<object-name>knob.RIGHT.circle</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>next item</name>
<button>0</button>
@ -153,6 +161,9 @@
<object-name>knob.MODE</object-name>
<object-name>knob.MODE.circle</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>select next mode</name>
<button>0</button>
@ -177,6 +188,9 @@
<type>pick</type>
<object-name>button.ENTER</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>manage ENTER button (top left)</name>
<button>0</button>
@ -192,6 +206,9 @@
<type>pick</type>
<object-name>button.ESCAPE</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>manage ESCAPE button (top middle)</name>
<button>0</button>
@ -207,6 +224,9 @@
<type>pick</type>
<object-name>button.START</object-name>
<visible>true</visible>
<condition>
<property>/instrumentation/gps/serviceable</property>
</condition>
<action>
<name>manage START button (top right)</name>
<button>0</button>

View file

@ -141,7 +141,7 @@ zkv_dbg.test();
======================
The interface is simple:
(http://seb.marque.free.fr/fichiers/flightgear/zkv500/presentation.png)
* 4 knobs turning left (left mouse click) or right (right mous click)
* 4 knobs turning left (left mouse click) or right (right mouse click)
* 3 white buttons
* 1 LCD display
* 2 LEDs (red and green)
@ -152,7 +152,7 @@ PAGE|------------------------|SELECT
KNOB| |KNOB
| LCD DISPLAY |
| 5 LINES |
MODE| |ON/OFF
MODE| |POWER
KNOB|------------------------|KNOB
red green
led led
@ -163,7 +163,7 @@ KNOB|------------------------|KNOB
edit some simple text (depending of screen).
-> MODE knob allows you to select a mode, and acces to the ZKV500 settings
you can access this knob at any time, any screen.
-> ON/OFF knob allows you to turn ON and OFF the ZKV500, and set the
-> POWER knob allows you to turn ON and OFF the ZKV500, and set the
LCD enlightment.
The goal of each button depends of the displayed screen.
@ -173,7 +173,7 @@ The goal of each button depends of the displayed screen.
To power ON, just left click on the ON/OFF knob. Clicking again will make it
more and more enlighted.
When powered ON, you are on the ModeAndSettings screen.
Right-click on ON/OFF knob will first decrease enlightment intensity until
Right-click on POWER knob will first decrease enlightment intensity until
switch the ZKV500 off.
2. Screens list