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
/*
*==============================================================================
* CERN (BE-CO-HT)
* Source file for Antenova M10478 GPS module
*==============================================================================
* Copyright (C) 2014 Julian Lewis
* @author Theodor Stana <theodor.stana@gmail.com>
*
* 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
*
* description:
*
* dependencies:
*
* 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: -
*==============================================================================
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* 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,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <string.h>
......
/*
*==============================================================================
* CERN (BE-CO-HT)
* Header file for Antenova M10478 GPS module
*==============================================================================
* Copyright (C) 2014 Julian Lewis
* @author Theodor Stana <theodor.stana@gmail.com>
*
* 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
*
* description:
*
* dependencies:
*
* 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: -
*==============================================================================
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* 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,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __GPS_H_
......@@ -50,19 +34,24 @@
/*=================*/
/* Data structures */
/*=================*/
/*
* Latitude and longitude can have different formats, see gps_get_coord() for
* details
*/
struct gps_coord {
double lat;
double lon;
double elev;
};
/* UTC time from GPS */
struct gps_utc {
int yr;
int mon;
int day;
int hr;
int min;
int sec;
int yr; // years since 1900
int mon; // months since January (0-11)
int day; // day of month
int hr; // hours (0-23)
int min; // minutes (0-59)
int sec; // seconds (0-59)
};
/*=====================*/
......
......@@ -57,6 +57,7 @@ static void gps_redraw(struct ui_widget *w)
if (gps_fixed())
gps_get_coord(&coord, coord_format);
/* Decompose degrees, mins, secs for formats 0 & 1 */
latdeg = coord.lat/100;
latmin = 100 * (latdeg - (int)latdeg);
latsec = coord.lat - (int)coord.lat;
......@@ -84,20 +85,20 @@ static void gps_redraw(struct ui_widget *w)
/* [deg] [min] [sec] */
sprintf(buf, "L: %d deg", (int)latdeg);
gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0);
sprintf(buf, "%d'%2.2f''", (int)latmin, 0.6 * latsec);
gfx_text(&w->dc, &font_helv22b, 22, 20, buf, 0);
sprintf(buf, "%d'%2.2f\"", (int)latmin, 100 * latsec);
gfx_text(&w->dc, &font_helv22b, 5, 20, buf, 0);
sprintf(buf, "l: %d deg", (int)londeg);
gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0);
sprintf(buf, "%d'%2.2f''", (int)lonmin, 60 * lonsec);
gfx_text(&w->dc, &font_helv22b, 15, 70, buf, 0);
sprintf(buf, "%d'%2.2f\"", (int)lonmin, 100 * lonsec);
gfx_text(&w->dc, &font_helv22b, 5, 70, buf, 0);
} else if (coord_format == 2) {
/* [deg].[min/60] */
sprintf(buf, "L: %2.4f", coord.lat);
gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0);
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 */
} else {
......
/*
* Copyright (C) 2014 Julian Lewis
* @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
* 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