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>
|
2022-10-28 14:08:50 +00:00
|
|
|
#include <assets_icons.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"
|
2022-08-22 17:54:01 +00:00
|
|
|
#include "views/power_unplug_usb.h"
|
2021-09-24 16:28:02 +00:00
|
|
|
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <notification/notification_messages.h>
|
2021-09-24 16:28:02 +00:00
|
|
|
|
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;
|
|
|
|
PowerOff* power_off;
|
2022-08-22 17:54:01 +00:00
|
|
|
PowerUnplugUsb* power_unplug_usb;
|
2021-09-24 16:28:02 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2022-07-20 10:56:33 +00:00
|
|
|
FuriMutex* api_mtx;
|
2021-09-24 16:28:02 +00:00
|
|
|
};
|
|
|
|
|
2021-10-06 15:41:22 +00:00
|
|
|
typedef enum {
|
|
|
|
PowerViewOff,
|
2022-08-22 17:54:01 +00:00
|
|
|
PowerViewUnplugUsb,
|
2021-10-06 15:41:22 +00:00
|
|
|
} PowerView;
|