1
0
Fork 0

- GPS update by Zakharov

This commit is contained in:
helijah 2008-07-21 22:42:01 +00:00
parent ea43922437
commit 454950d0f9
6 changed files with 856 additions and 608 deletions

View file

@ -35,6 +35,10 @@ var screenModeAndSettings = { # screen for changing the GPS mode and settings
mode = me.mode_ + 1;
page = 0;
displayed_screen = page_list[mode][page];
if (mode == 3)
screenTaskSelect.n = list_routes();
elsif (mode == 2)
screenTurnpointSelect.n = load_bookmarks();
}
},
lines : func {

File diff suppressed because it is too large Load diff

View file

@ -52,31 +52,31 @@ var gps_wp = gps_data.getNode("wp",1);
#### warps for buttons and knobs ########################################"
var right_knob = func(dir) { #manage right knob, depends of displayed screen
isOn == 1 or return;
isOn > 0 or return;
screen[displayed_screen].right(dir);
refresh_display();
}
var enter_button = func() { #manage enter button, depends of displayed screen
isOn == 1 or return;
isOn > 0 or return;
screen[displayed_screen].enter();
refresh_display();
}
var escape_button = func() { #manage escape button, depends of displayed screen
isOn == 1 or return;
isOn > 0 or return;
screen[displayed_screen].escape();
refresh_display();
}
var start_button = func() { #manage start button, depends of displayed screen
isOn == 1 or return;
isOn > 0 or return;
screen[displayed_screen].start();
refresh_display();
}
var left_knob = func(dir) { #manage left button, cycle in mode's pages if not blocked
isOn == 1 or return;
isOn > 0 or return;
if (blocked == 0) {
page = cycle(size(page_list[mode]), page, dir);
displayed_screen = page_list[mode][page];
@ -85,7 +85,7 @@ var left_knob = func(dir) { #manage left button, cycle in mode's pages if not bl
}
var select_mode = func(dir) { #manage mode knob, cycle into available modes
isOn == 1 or return;
isOn > 0 or return;
blocked = 0;
if (displayed_screen != 0) {
displayed_screen = 0; #screenModeAndSettings
@ -98,17 +98,19 @@ var select_mode = func(dir) { #manage mode knob, cycle into available modes
}
var switch_ON_OFF = func() { #manage ON/OFF knob
if (isOn) {
isOn = 0;
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 {
isOn = 1;
screenTaskSelect.n = list_routes();
screenTurnpointSelect.n = load_bookmarks();
refresh_display();
}
props.globals.getNode("/instrumentation/gps/serviceable",1).setBoolValue(isOn);
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);
refresh_display();
}
### useful funcs #########################################################
@ -252,20 +254,16 @@ var EditMode = func (length, title, start_command, numcar = 0) {
}
### initialisation stuff ###################################################
var init = func() {
mode = 0;
page = 0;
displayed_screen = 0; #screenModeAndSettings
blocked = 0; #unlock left_knob
isOn = 0; #start OFF
startpos = nil; #unset start position
waypointindex = 0; #route waypoint index on beginning
var load_screens = func {
var zkv500_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/zkv500/";
io.load_nasal(zkv500_dir ~ "AirportScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "TurnpointScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "MainScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "TaskScreens.nas","zkv500");
}
var organize_screens = func {
screen = []; #empty screens
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);
append(screen, zkv500.screenModeAndSettings); #0
append(screen, zkv500.screenPositionMain); #1
append(screen, zkv500.screenOdometers); #2
@ -280,12 +278,34 @@ var init = func() {
append(screen, zkv500.screenWaypointInfos); #11
append(screen, zkv500.screenWaypointsList); #12
append(screen, zkv500.screenEdit); #13
}
var init_gps_variables = func {
mode = 0;
page = 0;
displayed_screen = 0; #screenModeAndSettings
blocked = 0; #unlock left_knob
isOn = 0; #start OFF
startpos = nil; #unset start position
waypointindex = 0; #route waypoint index on beginning
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);
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/wp/wp[1]/desired-course", obsMode, 0, 0);
}
var init = func() {
load_screens();
organize_screens();
init_gps_variables();
print("GPS... initialized");
}

View file

@ -21,6 +21,24 @@
</top-left>
</panel>
<animation>
<type>material</type>
<object-name>LCD.display</object-name>
<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.MODE.circle</object-name>
<object-name>knob.RIGHT.circle</object-name>
<object-name>knob.LEFT.circle</object-name>
<emission>
<red>0.1</red>
<blue>0.1</blue>
<green>0.8</green>
<factor-prop>/instrumentation/zkv500/retro-light</factor-prop>
</emission>
</animation>
<animation>
<type>select</type>
<condition>
@ -37,19 +55,45 @@
<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>
<factor>30</factor>
<axis>
<x>-1</x>
<y>0</y>
<z>0</z>
</axis>
<center>
<x-m>0</x-m>
<y-m>0.03</y-m>
<z-m>-0.03</z-m>
</center>
</animation>
<animation>
<type>pick</type>
<object-name>knob.ONOFF</object-name>
<object-name>knob.ONOFF.circle</object-name>
<visible>true</visible>
<action>
<name>switch on and off</name>
<!-- this one will manage volume control soon too,
but for now keep it simple -->
<name>increase gps state off - on - enlighted</name>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>zkv500.switch_ON_OFF()</script>
<script>zkv500.switch_ON_OFF(1)</script>
</binding>
</action>
<action>
<name>decrease gps state off - on - enlighted</name>
<button>2</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>zkv500.switch_ON_OFF(-1)</script>
</binding>
</action>
</animation>
@ -57,6 +101,7 @@
<animation>
<type>pick</type>
<object-name>knob.LEFT</object-name>
<object-name>knob.LEFT.circle</object-name>
<visible>true</visible>
<action>
<name>next menu</name>
@ -81,6 +126,7 @@
<animation>
<type>pick</type>
<object-name>knob.RIGHT</object-name>
<object-name>knob.RIGHT.circle</object-name>
<visible>true</visible>
<action>
<name>next item</name>
@ -105,6 +151,7 @@
<animation>
<type>pick</type>
<object-name>knob.MODE</object-name>
<object-name>knob.MODE.circle</object-name>
<visible>true</visible>
<action>
<name>select next mode</name>

View file

@ -16,7 +16,7 @@ CONTENTS
3. Without 3D interface
3. Global presentation
4. User's Manual
1. Powering ON
1. Powering ON / Enlight / Switch OFF
2. List of screens
3. The modes
4. Editing some text
@ -51,10 +51,6 @@ available for all aircrafts. To install it, just add these lines in your config
files, inside the <nasal> section:
<zkv500>
<file>Aircraft/Instruments-3d/zkv500/ZKV500.nas</file>
<file>Aircraft/Instruments-3d/zkv500/MainScreens.nas</file>
<file>Aircraft/Instruments-3d/zkv500/TurnpointScreens.nas</file>
<file>Aircraft/Instruments-3d/zkv500/TaskScreens.nas</file>
<file>Aircraft/Instruments-3d/zkv500/AirportScreens.nas</file>
</zkv500>
[example from Lionceau: Aircraft/Lionceau/lionceau-base.xml]
Please note that <zkv500> is mandatory for namespaces reasons.
@ -123,7 +119,6 @@ The ZKV500 is quite useful to create bookmarks on the fly.
2. Debugging installation
if you want to debug the nasal, you can use the "debugging tool" I've created:
- comment in your aircraft files all gps-related installation
- edit the Aircraft/Instruments-3d/zkv500/*.nas files with your favourite
text editor
- in the Nasal console from FGside type:
@ -142,13 +137,11 @@ var zkv_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/zkv500/";
io.load_nasal(zkv_dir ~ "zkv_dbg.nas", "zkv_dbg");
zkv_dbg.test();
3. GLOBAL PRESENTATION
======================
The interface is simple:
(http://seb.marque.free.fr/fichiers/flightgear/zkv500/presentation.png)
* 4 knobs turning left (left mouse clic) or right (right mous clic)
* 4 knobs turning left (left mouse click) or right (right mous click)
* 3 white buttons
* 1 LCD display
* 2 LEDs (red and green)
@ -170,24 +163,27 @@ 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, note it is a knob
because I plan to associate some sounds with the ZKV500, this knob then
could be used to change the volume.
-> ON/OFF 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.
4. USER'S MANUAL
================
1. Powering ON
To power ON, just left click on the ON/OFF knob. Clicking again wil make it
turning OFF. When powered you are on the ModeAndSettings screen.
1. Powering ON / Enlight / Switch OFF
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
switch the ZKV500 off.
2. Screens list
[] -> button
() -> knob
*** ModeAndSettings ***
From this screen you can change from a mode to another mode (see 4.3 Modes, below)
START...enter in a mode
PAGE....enter in settings pages (cycle)
SELECT..modify settings
[START] enter in a mode
(PAGE) enter in settings pages (cycle)
(SELECT) modify settings
the available settings are:
* units
@ -201,7 +197,7 @@ the available settings are:
*** PositionMain ***
This page gives you infos about the aircraft position.
You find it in every modes.
ENTER...save the position as a bookmark (entering in Edit screen)
[ENTER] save the position as a bookmark (entering in Edit screen)
LAT: latitude in deg:min:sec
LON: longitude in deg:min:sec
@ -211,7 +207,7 @@ You find it in every modes.
*** Odometers ***
This screen gives you odo-values. You can find it in every modes.
ESCAPE...reset odometers, except TRIP
[ESCAPE] reset odometers, except TRIP
ODO: travelled distance
TRIP: total travelled distance
@ -233,9 +229,9 @@ screen is available on every modes
This screen gives the related position of the aircraft about the calcualted
route. It is only available in TURNPOINT and TASK modes.
ENTER...TURNPOINT mode: add the actual position to the route,
[ENTER] TURNPOINT mode: add the actual position to the route,
TASK mode: jump to next waypoint
START...save the route (mode TURNPOINT only)
[START] save the route (mode TURNPOINT only)
ID: Id of the waypoint to go [waypoint type]
BRG: bearing from the aircraft to the waypoint (geographic)
@ -249,9 +245,9 @@ the | symbol represents the route, the little aircraft represents... the aircraf
This screen gives infos about the nearest, or a specific searched airport (see
SearcAirport screen, below). It is only reachable from AIRPORT mode.
ENTER...add the airport to route
ESCAPE..get the nearest airport
START...add airport to bookmarks, and enter TURNPOINT mode, to go directly
[ENTER] add the airport to route
[ESCAPE] get the nearest airport
[START] add airport to bookmarks, and enter TURNPOINT mode, to go directly
NEAREST or SEARCHED APT: OACI code of airport
ELEV: airport altitude
@ -265,7 +261,7 @@ SearcAirport screen, below). It is only reachable from AIRPORT mode.
This screen gives infos about the airport (nearest or searched). It is only
reachable from AIRPORT mode.
SELECT...navigate in the runway list (not yet implemented)
(SELECT) navigate in the runway list (not yet implemented)
First line gives the full name of airport
Lines below show the runways with the format
@ -277,17 +273,17 @@ AIRPORT mode.
If the search is successful, the AirportMain screen is shown, in other case the text
is erased, and you are invited to retry.
SELECT...modify letter (from A to Z then 0 to 9, cycled)
ENTER....next step
ESCAPE...back to AirportMain screen, without search
START....search the given OACI code
(SELECT) modify letter (from A to Z then 0 to 9, cycled)
[ENTER] next step
[ESCAPE] back to AirportMain screen, without search
[START] search the given OACI code
*** TurnpointSelect ***
This screen shows a list of already bookmarked gps points. It is only available
in TURNPOINT mode.
SELECT...navigate through the list (eventually through multiple pages)
START....begin the navigation from actual position to the bookmark
(SELECT) navigate through the list (eventually through multiple pages)
[START] begin the navigation from actual position to the bookmark
*** TurnpointInfos ***
This screen is not yet implemented. It will gives infos about the bookmark
@ -296,29 +292,29 @@ This screen is not yet implemented. It will gives infos about the bookmark
This screen allows you to choose a route (if one available). It is only available
in TASK mode.
SELECT...navigate through the routes list (eventually through multiple pages)
START....load the route, and begins navigation
(SELECT) navigate through the routes list (eventually through multiple pages)
[START] load the route, and begins navigation
*** WaypointInfos ***
Not yet implemented, will give infos about waypoint. Only available in TASK mode.
*** WaypointsList ***
This screen shows the list of waypoint loaded from a route.
SELECT...navigate through the list
(SELECT) navigate through the list
*** WaypointEdit ***
This screen allows you to name a gps point in order to bookmark it.
SELECT...cycle letters (from A to Z then 1 to 9)
ENTER....next step
ESCAPE...abort saving bookmark
START....save bookmark
(SELECT) cycle letters (from A to Z then 1 to 9)
[ENTER] next step
[ESCAPE] abort saving bookmark
[START] save bookmark
3. the 4 modes
*** POSITION ***
The simpliest one, just give information about the aircraft position. You can
save bookmarks from this mode (pressing ENTER in PositionMain screen).
PAGE...cycle through these screens (both ways):
(PAGE) cycle through these screens (both ways):
PositionMain, Odometers, WindInfos
*** AIRPORT ***
@ -326,12 +322,12 @@ Useful to know wher you can put you aircraft safely on the ground, gives other i
as the best runway, it is possible to search an airport (turn the PAGE knob until
Search airport page), add the airport to a route or as a bookmark (automatically
called by airports ID and name).
PAGE...cycle through these screens (both ways)
(PAGE) cycle through these screens (both ways)
AirportMain, NavigationMain, PositionMain, Odometers, WindInfos, AirportInfos, SearchAirport
*** TURNPOINT ***
Useful mode to join a specific point of interest, or to navigate around.
PAGE...cycle through these screens (both ways)
(PAGE) cycle through these screens (both ways)
TurnpointSelect, NavigationMain, PositionMain, Odometers, WindInfos, TurnpointInfos
*** TASK ***
@ -342,7 +338,7 @@ When approaching a waypoint, a red led blink (this can be set in ModeAndSettings
When on the point (idem), it loads autmatically the next point and calculate the leg infos
When the last point is reached, it come back to TaskSelect screen to allow chosing an other
route.
PAGE...cycle through these screens (both ways)
(PAGE) cycle through these screens (both ways)
TaskSelect, NavigationMain, PositionMain, Odometers, WindInfos, WaypointInfos, WaypointsList
5. FG INTEGRATION
@ -377,10 +373,14 @@ for now, as I want it to be the more bug-free possible before creating other bug
8. ANNEXES
==========
1. creating flightplans with ./flightplan
You can get ./flightplan from this link: http://seb.marque.free.fr/fichiers/scripts/perl/flightplan
Make it executable, best to set $FGROOT and $FGHOME to respectives folders
For creating a flightplan from LFPT to LFBD:
You can get ./flightplan from this link:
http://seb.marque.free.fr/fichiers/scripts/perl/flightplan
-> Make it executable,
-> best to set $FGROOT and $FGHOME to respectives folders
-> For creating a flightplan from LFPT to LFBD:
$ ./flightplan -d lfpt -a lfbd --wpt
This will write in $FGHOME/Routes a file named lfpt-lfbd.xml, suitable for the
ZKV500

View file

@ -77,12 +77,7 @@ var _bottom_buttons = func {
var reload_zkv_code = func {
var zkv500_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/zkv500/";
io.load_nasal(zkv500_dir ~ "ZKV500.nas","zkv500");
io.load_nasal(zkv500_dir ~ "AirportScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "TurnpointScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "MainScreens.nas","zkv500");
io.load_nasal(zkv500_dir ~ "TaskScreens.nas","zkv500");
print("debugger: zkv500 loaded");
zkv500.isOn = 0;
zkv500.init();
}