2021-09-24 16:28:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "power.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <gui/view_dispatcher.h>
|
|
|
|
#include <gui/gui.h>
|
2021-10-06 15:41:22 +00:00
|
|
|
|
|
|
|
#include <gui/modules/popup.h>
|
2021-09-24 16:28:02 +00:00
|
|
|
#include "views/power_off.h"
|
|
|
|
|
|
|
|
#include <notification/notification-messages.h>
|
|
|
|
|
2022-01-02 22:52:45 +00:00
|
|
|
#define POWER_BATTERY_HEALTHY_LEVEL 70
|
|
|
|
|
2021-09-24 16:28:02 +00:00
|
|
|
typedef enum {
|
|
|
|
PowerStateNotCharging,
|
|
|
|
PowerStateCharging,
|
|
|
|
PowerStateCharged,
|
|
|
|
} PowerState;
|
|
|
|
|
|
|
|
struct Power {
|
|
|
|
ViewDispatcher* view_dispatcher;
|
2021-10-06 15:41:22 +00:00
|
|
|
Popup* popup;
|
2021-09-24 16:28:02 +00:00
|
|
|
PowerOff* power_off;
|
|
|
|
|
|
|
|
ViewPort* battery_view_port;
|
|
|
|
Gui* gui;
|
|
|
|
NotificationApp* notification;
|
2021-11-01 20:35:54 +00:00
|
|
|
FuriPubSub* event_pubsub;
|
2021-09-24 16:28:02 +00:00
|
|
|
PowerEvent event;
|
|
|
|
|
|
|
|
PowerState state;
|
|
|
|
PowerInfo info;
|
|
|
|
|
|
|
|
bool battery_low;
|
2022-01-02 22:52:45 +00:00
|
|
|
bool show_low_bat_level_message;
|
2021-09-24 16:28:02 +00:00
|
|
|
uint8_t battery_level;
|
|
|
|
uint8_t power_off_timeout;
|
2022-01-02 22:52:45 +00:00
|
|
|
|
|
|
|
osMutexId_t api_mtx;
|
2021-09-24 16:28:02 +00:00
|
|
|
};
|
|
|
|
|
2021-10-06 15:41:22 +00:00
|
|
|
typedef enum {
|
|
|
|
PowerViewPopup,
|
|
|
|
PowerViewOff,
|
|
|
|
} PowerView;
|