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-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;
|
2021-10-06 18:41:22 +03:00
|
|
|
Popup* popup;
|
2021-09-24 19:28:02 +03:00
|
|
|
PowerOff* power_off;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
osMutexId_t api_mtx;
|
2021-09-24 19:28:02 +03:00
|
|
|
};
|
|
|
|
|
2021-10-06 18:41:22 +03:00
|
|
|
typedef enum {
|
|
|
|
PowerViewPopup,
|
|
|
|
PowerViewOff,
|
|
|
|
} PowerView;
|