Commit c5c435e9 authored by Projects's avatar Projects

ui: Battery indicator shows the proper status at the beginning.

parent 75f2a8f8
......@@ -29,6 +29,7 @@
#include "menu_struct.h"
#include "widgets/status_bar.h"
#include "settings/settings.h"
#include "battery_task.h"
#include <stdio.h>
......@@ -187,6 +188,7 @@ void menu_main(void* params) {
(void)(params); // suppress unused parameter warning
struct event evt;
battery_update();
menu_size = get_menu_size(*current_menu);
// run clock as the the initial application
......
......@@ -53,7 +53,7 @@ static void battery_monitor_task(void *params)
unsigned percentage = max17047_get_charge();
// Send an event if measurements are different
if(charging != cur_charging || percentage != cur_percentage) {
if(!params || charging != cur_charging || percentage != cur_percentage) {
evt.type = BATTERY_STATUS;
evt.data.battery.percentage = percentage;
evt.data.battery.charging = charging;
......@@ -63,6 +63,11 @@ static void battery_monitor_task(void *params)
}
}
void battery_update(void)
{
battery_monitor_task(NULL);
}
void battery_monitor_init(void)
{
// Set invalid values to force an update
......
......@@ -32,4 +32,9 @@
*/
void battery_monitor_init(void);
/**
* Forces a battery status update event.
*/
void battery_update(void);
#endif /* BATTERY_TASK_H */
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