User:Lhamada

From Navit's Wiki
Jump to: navigation, search

Lanzar SNV90/WinCE[edit]


caption

The region around here is mapped in basic details even in various known commercial integrated GPS offerings, so basically I got this device for experimenting with open source navigation, as this is my first GPS device, I decided to approach from the beginning using OpenstreetMaps as the map source.


This one is a refurbished unit that I got from e-bay listings, a generic WinCE 4.2 device, marketed in various places as LANZAR SNV90, which seems to be the same as the unit Pyle PLNVB26, those units are old-style dedicated gps box, and needs any screen accepting standard rgb or composite analog video input, when coupled to matched display it should accept touchscreen inputs.


In my set up, using a Sony car DVD system as the screen, I can't use touch screen inputs, the GPS unit comes with a infrared remote with basic controls for this purpose.


After downloading a current build for WinCE, unzip it to the root of the SD card as Navit, let's see some essential configuration details in navit.xml for this specific device.


Follow the instructions that came with the unit manual adapting it to change the default navigation (Destinator) with Navit executable.




Language[edit]

Mine is set to as following, this will specify the menu language as well as an adequate speech voice.

<config xmlns:xi="http://www.w3.org/2001/XInclude"; language="pt_BR">


GPS source[edit]

After discovering its settings somehow, should set as:

<vehicle name="Local GPS" profilename="car" follow="1" enabled="yes" active="1" source="wince:com2:" baudrate="38400" >



Map source[edit]

This is the main map, a collaborative map that you can edit at OpenstreetMap if you want to contribute.

<mapset enabled="yes">
<map type="binfile" data="\StorageCard\navit\maps\osm.bin"/>
</mapset>


See Navit_on_WinCE/Windows_Mobile#Download_a_Map_from_OpenStreetmap.


Display items[edit]

Use one of the example OSD layouts for small screen devices as starting point, such as OSD_Layouts#Asus_Mypal_A696_-_QVGA_240x320, this one is nice.


Small hack #1: Enable Zoom in/out[edit]

There are zoom in/out keys on the supplied remote that does not work in Navit with this device. These keys have the virtual key codes reported by wince as: zoom_in_key=193 and zoom_out_key=194. According to ms documentation these keycodes are unmapped, so it should not interfere with the rest of Navit.

So in order to use these functions, you have to edit the HandleKeyDown function in Navit/graphics/win32/graphics_win32.c file with the following inclusions.

static void HandleKeyDown(struct graphics_priv *gra_priv, WPARAM wParam)
{
    int key = (int) wParam;
+    char menu[]={NAVIT_KEY_MENU,0};
+    char zoom_out[]={NAVIT_KEY_ZOOM_OUT,0};
+    char zoom_in[]={NAVIT_KEY_ZOOM_IN,0};
    char up[]={NAVIT_KEY_UP,0};
    char down[]={NAVIT_KEY_DOWN,0};
    char left[]={NAVIT_KEY_LEFT,0};
    char right[]={NAVIT_KEY_RIGHT,0};
    char *s=NULL;
    dbg(1,"HandleKey %d\n",key);
	switch (key) {
+    case 77:
+        s=menu;
+        break;
+    case 194:
+        s=zoom_out;
+        break;
+    case 193:
+        s=zoom_in;
+        break;
    case 37:
		s=left;
        break;
    case 38:
		s=up;
        break;
    case 39:
		s=right;
        break;
    case 40:
		s=down;
        break;
    }
    if (s)
        callback_list_call_attr_1(gra_priv->cbl, attr_keypress, (void *)s);
}

You can omit the menu key from above as it conflicts with the m key, but this device does not have a keyboard, so should not be a problem.

The above modifications will hard code the zoom in/out functions on the remote so that it will work while viewing the map on screen.

You will need to recompile from source, see Compiling_Navit_for_WinCE/WinMobile.

Particularly, I do my builds in OSX 10.5.8, this is possible, but you must rebuild all dependency for GCC and it's libraries.


Small hack #2: Set destination point by remote[edit]

Then you will want to be able to set destination points while using the device itself, realize that you don't have any pointing device input, via either mouse or touch screen.

The modification below makes Navit think there was a map click on the screen center and process it that way, when a return key is pressed while viewing the map so that you can set it as a bookmark, POI or as a destination.

Edit navit/gui/internal/gui_internal.c as:

static void gui_internal_keypress(void *data, char *key)
{
	struct gui_priv *this=data;
	int w,h;
	struct point p;
	if (!this->root.children) {
		transform_get_size(navit_get_trans(this->nav), &w, &h);
		switch (*key) {
		case NAVIT_KEY_UP:
			p.x=w/2;
			p.y=h/2-h/5;
			navit_set_center_screen(this->nav, &p, 1);
			break;
		case NAVIT_KEY_DOWN:
			p.x=w/2;
			p.y=h/2+h/5;
			navit_set_center_screen(this->nav, &p, 1);
			break;
		case NAVIT_KEY_LEFT:
			p.x=w/2-w/5;
			p.y=h/2;
			navit_set_center_screen(this->nav, &p, 1);
			break;
		case NAVIT_KEY_RIGHT:
			p.x=w/2+w/5;
			p.y=h/2;
			navit_set_center_screen(this->nav, &p, 1);
			break;
		case NAVIT_KEY_ZOOM_IN:
			navit_zoom_in(this->nav, 2, NULL);
			break;
		case NAVIT_KEY_ZOOM_OUT:
			navit_zoom_out(this->nav, 2, NULL);
			break;
		case NAVIT_KEY_RETURN:
+                       /* Simulated map click in screen center. */
+                       /* Refer to center of screen. */
+                       p.x = w/2; p.y= h/2;
+			this->mouse_button_clicked_on_map=1;
+			gui_internal_cmd_menu(this, &p, 0, NULL);
+			this->mouse_button_clicked_on_map=0;
            break;
		case NAVIT_KEY_MENU:
			gui_internal_cmd_menu(this, NULL, 0, NULL);
			break;
		}
		return;
	}
...


To make pinpointing a location a little easier, the above modification also set the panning amount of the map when using the arrow keys by a smaller amount than before which is half screen, to by about h/5 and w/5 of the screen height and width respectively, you can change to {h,w}/n, where n is to be (1/n)th the amount you want to pan the screen.

Also you can put some icon mark on the screen center as a guide:

<osd enabled="yes" type="button" x="144" y="104" command="" src="reticle.png"/>

Supply the image file reticle.png (any small image in png) and copy it to navit/xpm folder in order to make it available.

--Lhamada 21:20, 9 January 2012 (CET)