Commit 9e60e1cc authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Moving to Fede's branch to check bootloader code

parent cfa74c96
......@@ -183,10 +183,19 @@ void gps_get_utc(struct gps_utc *utc)
utc->sec = gps_info.utc.sec;
}
void gps_get_coord(struct gps_coord *coord)
void gps_get_coord(struct gps_coord *coord, int format)
{
coord->lat = gps_info.lat;
coord->lon = gps_info.lon;
if (format == 0) {
/* Raw [deg][min].[sec/60] data */
coord->lat = gps_info.lat;
coord->lon = gps_info.lon;
} else if (format == 1) {
/* [deg][min].[sec] */
coord->lat = (int)gps_info.lat + 0.6 * (
gps_info.lat - (int)gps_info.lat);
coord->lon = (int)gps_info.lon + 0.6 * (
gps_info.lon - (int)gps_info.lon);
}
coord->elev = gps_info.elv;
}
......
......@@ -64,7 +64,7 @@ int gps_puts(char *s);
int gps_nmea_crc(const char *nmeastr);
int gps_fixed();
void gps_get_utc(struct gps_utc *utc);
void gps_get_coord(struct gps_coord *coord);
void gps_get_coord(struct gps_coord *coord, int format);
void gps_get_speed(double *spd);
void gps_get_direction(double *dir);
......
......@@ -37,21 +37,31 @@
#include "application.h"
static struct gps_coord coord;
static int coord_format;
static void gps_redraw(struct ui_widget *w)
{
char buf[16];
if (gps_fixed())
gps_get_coord(&coord);
gps_get_coord(&coord, coord_format);
gfx_clear(&w->dc, 0);
sprintf(buf, "%4.4f", coord.lat);
gfx_text(&w->dc, &font_helv22b, 10, 10, buf, 0);
sprintf(buf, "%4.4f", coord.lon);
gfx_text(&w->dc, &font_helv22b, 10, 30, buf, 0);
sprintf(buf, "%5.0f m", coord.elev);
gfx_text(&w->dc, &font_helv22b, 10, 50, buf, 0);
sprintf(buf, "L: -90", (int)(coord.lat / 100));
gfx_text(&w->dc, &font_helv22b, 0, 0, buf, 0);
sprintf(buf, "60.7777'");
gfx_text(&w->dc, &font_helv22b, 15, 20, buf, 0);
sprintf(buf, "l: -180", (int)(coord.lon / 100));
gfx_text(&w->dc, &font_helv22b, 0, 40, buf, 0);
sprintf(buf, "60.7777'");
gfx_text(&w->dc, &font_helv22b, 15, 60, buf, 0);
sprintf(buf, "h: 8848m");
gfx_text(&w->dc, &font_helv22b, 0, 80, buf, 0);
// sprintf(buf, "%2.4f" )
// gfx_text(&w->dc, &font_helv22b, 0, 30, buf, 0);
// sprintf(buf, "%5.0f m", coord.elev);
// gfx_text(&w->dc, &font_helv22b, 0, 50, buf, 0);
}
static void gps_event(struct ui_widget *w, const struct event *evt)
......@@ -102,6 +112,10 @@ void gpscoord_main(void *params)
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
return;
else if (evt.data.button == BUT_BR) {
coord_format += 1;
coord_format %= 2;
}
break;
case RTC_TICK:
ui_update(&evt);
......
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