2021-09-24 19:28:02 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "power.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <gui/view_dispatcher.h>
|
|
|
|
#include <gui/gui.h>
|
2021-10-06 18:41:22 +03:00
|
|
|
|
|
|
|
#include <gui/modules/popup.h>
|
2021-09-24 19:28:02 +03:00
|
|
|
#include "views/power_off.h"
|
2022-08-22 20:54:01 +03:00
|
|
|
#include "views/power_unplug_usb.h"
|
2021-09-24 19:28:02 +03:00
|
|
|
|
2022-01-05 19:10:18 +03:00
|
|
|
#include <notification/notification_messages.h>
|
2021-09-24 19:28:02 +03:00
|
|
|
|
2022-01-03 01:52:45 +03:00
|
|
|
#define POWER_BATTERY_HEALTHY_LEVEL 70
|
|
|
|
|
2021-09-24 19:28:02 +03:00
|
|
|
typedef enum {
|
|
|
|
PowerStateNotCharging,
|
|
|
|
PowerStateCharging,
|
|
|
|
PowerStateCharged,
|
|
|
|
} PowerState;
|
|
|
|
|
|
|
|
struct Power {
|
|
|
|
ViewDispatcher* view_dispatcher;
|
|
|
|
PowerOff* power_off;
|
2022-08-22 20:54:01 +03:00
|
|
|
PowerUnplugUsb* power_unplug_usb;
|
2021-09-24 19:28:02 +03:00
|
|
|
|
|
|
|
ViewPort* battery_view_port;
|
|
|
|
Gui* gui;
|
|
|
|
NotificationApp* notification;
|
2021-11-01 23:35:54 +03:00
|
|
|
FuriPubSub* event_pubsub;
|
2021-09-24 19:28:02 +03:00
|
|
|
PowerEvent event;
|
|
|
|
|
|
|
|
PowerState state;
|
|
|
|
PowerInfo info;
|
|
|
|
|
|
|
|
bool battery_low;
|
2022-01-03 01:52:45 +03:00
|
|
|
bool show_low_bat_level_message;
|
2021-09-24 19:28:02 +03:00
|
|
|
uint8_t battery_level;
|
|
|
|
uint8_t power_off_timeout;
|
2022-01-03 01:52:45 +03:00
|
|
|
|
2022-07-20 13:56:33 +03:00
|
|
|
FuriMutex* api_mtx;
|
2021-09-24 19:28:02 +03:00
|
|
|
};
|
|
|
|
|
2021-10-06 18:41:22 +03:00
|
|
|
typedef enum {
|
|
|
|
PowerViewOff,
|
2022-08-22 20:54:01 +03:00
|
|
|
PowerViewUnplugUsb,
|
2021-10-06 18:41:22 +03:00
|
|
|
} PowerView;
|