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

Add GPS icon to status bar

parent 6865ed43
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
#include "application.h" #include "application.h"
static struct rle_bitmap gps_ico;
static int gps_ico_blink = 0;
static int asdf = 0;
static void gps_redraw(struct ui_widget *w) static void gps_redraw(struct ui_widget *w)
{ {
char buf[16]; char buf[16];
...@@ -48,8 +43,6 @@ static void gps_redraw(struct ui_widget *w) ...@@ -48,8 +43,6 @@ static void gps_redraw(struct ui_widget *w)
gps_get_utc(&utc); gps_get_utc(&utc);
asdf++;
gfx_clear(&w->dc, 0); gfx_clear(&w->dc, 0);
sprintf(buf, "%d:%d:%d", utc.hr, sprintf(buf, "%d:%d:%d", utc.hr,
utc.min, utc.min,
...@@ -59,17 +52,8 @@ static void gps_redraw(struct ui_widget *w) ...@@ -59,17 +52,8 @@ static void gps_redraw(struct ui_widget *w)
static void gps_event(struct ui_widget *w, const struct event *evt) static void gps_event(struct ui_widget *w, const struct event *evt)
{ {
if (evt->type == GPS_FIX_LOST) { if (evt->type == RTC_TICK)
gps_ico_blink ^= 1; w->flags |= WF_DIRTY;
if (gps_ico_blink)
memcpy(&gps_ico, &gps_searching,
sizeof(struct rle_bitmap));
else
memcpy(&gps_ico, 0, sizeof(struct rle_bitmap));
} else if (evt->type == GPS_FIX_ACQ) {
memcpy(&gps_ico, &gps_receiving, sizeof(struct rle_bitmap));
}
w->flags |= WF_DIRTY;
} }
static struct ui_widget gps_coord_display = { static struct ui_widget gps_coord_display = {
...@@ -116,17 +100,11 @@ void gpscoord_main(void *params) ...@@ -116,17 +100,11 @@ void gpscoord_main(void *params)
return; return;
break; break;
case RTC_TICK: case RTC_TICK:
if (gps_fixed()) evt.type = GPS_FIX_ACQ;
else evt.type = GPS_FIX_LOST;
ui_update(&evt); ui_update(&evt);
} }
} }
//if (gps_fixed()) {
// evt.type = GPS_FIX_ACQ;
// ui_update(&evt);
//} else {
// evt.type = GPS_FIX_LOST;
// ui_update(&evt);
//}
} }
} }
......
...@@ -27,15 +27,32 @@ ...@@ -27,15 +27,32 @@
#include "status_bar.h" #include "status_bar.h"
#include <string.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) static void status_bar_event(struct ui_widget *w, const struct event *evt)
{ {
// TODO update info about GPS signal, time, etc. if (evt->type == GPS_FIX_LOST) {
w->flags |= WF_DIRTY;
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));
} else if (evt->type == GPS_FIX_ACQ) {
w->flags |= WF_DIRTY;
memcpy(&gps_ico, &gps_receiving, sizeof(struct rle_bitmap));
}
} }
static void status_bar_redraw(struct ui_widget *w) static void status_bar_redraw(struct ui_widget *w)
{ {
gfx_round_box(&w->dc, 30, -10, 127-30, 10, 9, COLOR_BLACK); gfx_round_box(&w->dc, 30, -10, 127-30, 10, 9, COLOR_BLACK);
gfx_centered_text(&w->dc, &font_helv11, 0, "Home", 1); gfx_centered_text(&w->dc, &font_helv11, 0, "Home", 1);
gfx_draw_bitmap(&w->dc, 0, 0, &gps_ico);
} }
struct ui_widget status_bar = { struct ui_widget status_bar = {
......
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