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

Check for GPS on in status bar handler

parent 21c04678
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <drivers/gps.h> #include <drivers/gps.h>
#include "../settings/settings.h"
static const unsigned int BATTERY_POS = 111; static const unsigned int BATTERY_POS = 111;
static const unsigned int BATTERY_BARS = 10; static const unsigned int BATTERY_BARS = 10;
...@@ -46,7 +48,8 @@ static int gps_ico_blink = 0; ...@@ -46,7 +48,8 @@ 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)
{ {
switch(evt->type) { switch(evt->type) {
case RTC_TICK: case RTC_TICK:
if (setting_gps_on.val) {
if (gps_fixed()) { if (gps_fixed()) {
memcpy(&gps_ico, &gps_receiving, memcpy(&gps_ico, &gps_receiving,
sizeof(struct rle_bitmap)); sizeof(struct rle_bitmap));
...@@ -60,14 +63,17 @@ static void status_bar_event(struct ui_widget *w, const struct event *evt) ...@@ -60,14 +63,17 @@ static void status_bar_event(struct ui_widget *w, const struct event *evt)
} }
} }
w->flags |= WF_DIRTY; w->flags |= WF_DIRTY;
break; }
case BATTERY_STATUS:
if(abs(percentage - evt->data.battery.percentage) > 5 || // fall-through
charging != evt->data.battery.charging) {
percentage = evt->data.battery.percentage; case BATTERY_STATUS:
charging = evt->data.battery.charging; if(abs(percentage - evt->data.battery.percentage) > 5 ||
w->flags |= WF_DIRTY; charging != evt->data.battery.charging) {
} percentage = evt->data.battery.percentage;
charging = evt->data.battery.charging;
w->flags |= WF_DIRTY;
}
} }
} }
......
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