Commit cc9122a4 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

ixed DEG MIN SEC display and changed headers to gpslib files

parent 751c0546
/* /*
*============================================================================== * Copyright (C) 2014 Julian Lewis
* CERN (BE-CO-HT) * @author Theodor Stana <theodor.stana@gmail.com>
* Source file for Antenova M10478 GPS module
*==============================================================================
* *
* author: Theodor Stana (t.stana@cern.ch) * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* *
* date of creation: 2014-08-24 * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* version: 1.0 * You should have received a copy of the GNU General Public License
* * along with this program; if not, you may find one here:
* description: * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* * or you may search the http://www.gnu.org website for the version 2 license,
* dependencies: * or you may write to the Free Software Foundation, Inc.,
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* references:
*
*==============================================================================
* GNU LESSER GENERAL PUBLIC LICENSE
*==============================================================================
* This source file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version. This source is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. You should have
* received a copy of the GNU Lesser General Public License along with this
* source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
*==============================================================================
* last changes:
* 2014-08-24 Theodor Stana t.stana@cern.ch File created
*==============================================================================
* TODO: -
*==============================================================================
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
......
/* /*
*============================================================================== * Copyright (C) 2014 Julian Lewis
* CERN (BE-CO-HT) * @author Theodor Stana <theodor.stana@gmail.com>
* Header file for Antenova M10478 GPS module
*==============================================================================
* *
* author: Theodor Stana (t.stana@cern.ch) * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* *
* date of creation: 2014-08-24 * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* version: 1.0 * You should have received a copy of the GNU General Public License
* * along with this program; if not, you may find one here:
* description: * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* * or you may search the http://www.gnu.org website for the version 2 license,
* dependencies: * or you may write to the Free Software Foundation, Inc.,
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* references:
*
*==============================================================================
* GNU LESSER GENERAL PUBLIC LICENSE
*==============================================================================
* This source file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version. This source is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details. You should have
* received a copy of the GNU Lesser General Public License along with this
* source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
*==============================================================================
* last changes:
* 2014-08-24 Theodor Stana t.stana@cern.ch File created
*==============================================================================
* TODO: -
*==============================================================================
*/ */
#ifndef __GPS_H_ #ifndef __GPS_H_
...@@ -50,19 +34,24 @@ ...@@ -50,19 +34,24 @@
/*=================*/ /*=================*/
/* Data structures */ /* Data structures */
/*=================*/ /*=================*/
/*
* Latitude and longitude can have different formats, see gps_get_coord() for
* details
*/
struct gps_coord { struct gps_coord {
double lat; double lat;
double lon; double lon;
double elev; double elev;
}; };
/* UTC time from GPS */
struct gps_utc { struct gps_utc {
int yr; int yr; // years since 1900
int mon; int mon; // months since January (0-11)
int day; int day; // day of month
int hr; int hr; // hours (0-23)
int min; int min; // minutes (0-59)
int sec; int sec; // seconds (0-59)
}; };
/*=====================*/ /*=====================*/
......
...@@ -57,6 +57,7 @@ static void gps_redraw(struct ui_widget *w) ...@@ -57,6 +57,7 @@ static void gps_redraw(struct ui_widget *w)
if (gps_fixed()) if (gps_fixed())
gps_get_coord(&coord, coord_format); gps_get_coord(&coord, coord_format);
/* Decompose degrees, mins, secs for formats 0 & 1 */
latdeg = coord.lat/100; latdeg = coord.lat/100;
latmin = 100 * (latdeg - (int)latdeg); latmin = 100 * (latdeg - (int)latdeg);
latsec = coord.lat - (int)coord.lat; latsec = coord.lat - (int)coord.lat;
...@@ -84,20 +85,20 @@ static void gps_redraw(struct ui_widget *w) ...@@ -84,20 +85,20 @@ static void gps_redraw(struct ui_widget *w)
/* [deg] [min] [sec] */ /* [deg] [min] [sec] */
sprintf(buf, "L: %d deg", (int)latdeg); sprintf(buf, "L: %d deg", (int)latdeg);
gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0); gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0);
sprintf(buf, "%d'%2.2f''", (int)latmin, 0.6 * latsec); sprintf(buf, "%d'%2.2f\"", (int)latmin, 100 * latsec);
gfx_text(&w->dc, &font_helv22b, 22, 20, buf, 0); gfx_text(&w->dc, &font_helv22b, 5, 20, buf, 0);
sprintf(buf, "l: %d deg", (int)londeg); sprintf(buf, "l: %d deg", (int)londeg);
gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0); gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0);
sprintf(buf, "%d'%2.2f''", (int)lonmin, 60 * lonsec); sprintf(buf, "%d'%2.2f\"", (int)lonmin, 100 * lonsec);
gfx_text(&w->dc, &font_helv22b, 15, 70, buf, 0); gfx_text(&w->dc, &font_helv22b, 5, 70, buf, 0);
} else if (coord_format == 2) { } else if (coord_format == 2) {
/* [deg].[min/60] */ /* [deg].[min/60] */
sprintf(buf, "L: %2.4f", coord.lat); sprintf(buf, "L: %2.4f", coord.lat);
gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0); gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0);
sprintf(buf, "l: %2.4f", coord.lon); sprintf(buf, "l: %2.4f", coord.lon);
gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0); gfx_text(&w->dc, &font_helv22b, 5, 50, buf, 0);
} }
/* Display elevation */ /* Display elevation */
} else { } else {
......
/* /*
* Copyright (C) 2014 Julian Lewis * Copyright (C) 2014 Julian Lewis
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Theodor Stana <theodor.stana@gmail.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment