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

Working towards displaying GPS coords on app screen

parent c87d837e
......@@ -36,18 +36,26 @@
#include "application.h"
static int i = 0;
static void gps_redraw(struct ui_widget *w)
{
char buf[16];
struct gps_utc utc;
struct gps_coord c;
gps_get_utc(&utc);
gps_get_coord(&c);
gfx_clear(&w->dc, 0);
sprintf(buf, "%d:%d:%d", utc.hr,
utc.min,
utc.sec);
gfx_text(&w->dc, &font_helv17b, 0, 0, buf, 0);
sprintf(buf, "%2.4f", c.lat);
gfx_text(&w->dc, &font_helv17b, 10, 0, buf, 0);
i++;
sprintf(buf, "(%d)%d", i, gps_fixed());
gfx_text(&w->dc, &font_helv17b, 10, 50, buf, 0);
// sprintf(buf, "%2.4f", c.lon);
// gfx_text(&w->dc, &font_helv38b, 30, 0, buf, 0);
// sprintf(buf, "%2.4fm", c.elev);
// gfx_text(&w->dc, &font_helv38b, 50, 0, buf, 0);
}
static void gps_event(struct ui_widget *w, const struct event *evt)
......@@ -100,9 +108,9 @@ void gpscoord_main(void *params)
return;
break;
case RTC_TICK:
if (gps_fixed()) evt.type = GPS_FIX_ACQ;
else evt.type = GPS_FIX_LOST;
ui_update(&evt);
default:
break;
}
}
}
......
......@@ -162,7 +162,7 @@ void menu_main(void* params) {
menu_size = get_menu_size(*current_menu);
// run clock as the the initial application
clock.main(NULL);
gpscoord.main(NULL);
menu_ui_init();
// Once it is deactivated - display the menu
......
......@@ -29,27 +29,32 @@
#include <string.h>
#include <drivers/gps/gps.h>
static struct rle_bitmap gps_ico;
static int gps_ico_blink = 0;
static void status_bar_event(struct ui_widget *w, const struct event *evt)
{
if (evt->type == GPS_FIX_LOST) {
if (evt->type == RTC_TICK) {
w->flags |= WF_DIRTY;
gps_ico_blink ^= 1;
if (gps_ico_blink)
memcpy(&gps_ico, &gps_searching,
if (gps_fixed()) {
memcpy(&gps_ico, &gps_receiving,
sizeof(struct rle_bitmap));
else
memcpy(&gps_ico, 0, sizeof(struct rle_bitmap));
} else if (evt->type == GPS_FIX_ACQ) {
w->flags |= WF_DIRTY;
memcpy(&gps_ico, &gps_receiving, sizeof(struct rle_bitmap));
} else {
gps_ico_blink ^= 1;
if (gps_ico_blink) {
memcpy(&gps_ico, &gps_searching,
sizeof(struct rle_bitmap));
} else
memcpy(&gps_ico, 0, sizeof(struct rle_bitmap));
}
}
}
static void status_bar_redraw(struct ui_widget *w)
{
gfx_clear(&w->dc, 0);
gfx_round_box(&w->dc, 30, -10, 127-30, 10, 9, COLOR_BLACK);
gfx_centered_text(&w->dc, &font_helv11, 0, "Home", 1);
gfx_draw_bitmap(&w->dc, 0, 0, &gps_ico);
......
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