mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 09:08:36 -07:00
Merge remote-tracking branch 'ofw/dev' into yeet-lfs
This commit is contained in:
@@ -17,13 +17,15 @@ void power_cli_off(Cli* cli, FuriString* args) {
|
||||
void power_cli_reboot(Cli* cli, FuriString* args) {
|
||||
UNUSED(cli);
|
||||
UNUSED(args);
|
||||
power_reboot(PowerBootModeNormal);
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
power_reboot(power, PowerBootModeNormal);
|
||||
}
|
||||
|
||||
void power_cli_reboot2dfu(Cli* cli, FuriString* args) {
|
||||
UNUSED(cli);
|
||||
UNUSED(args);
|
||||
power_reboot(PowerBootModeDfu);
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
power_reboot(power, PowerBootModeDfu);
|
||||
}
|
||||
|
||||
void power_cli_5v(Cli* cli, FuriString* args) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <core/pubsub.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <core/pubsub.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -67,7 +68,7 @@ void power_off(Power* power);
|
||||
*
|
||||
* @param mode PowerBootMode
|
||||
*/
|
||||
void power_reboot(PowerBootMode mode);
|
||||
void power_reboot(Power* power, PowerBootMode mode);
|
||||
|
||||
/** Get power info
|
||||
*
|
||||
|
||||
@@ -2,21 +2,17 @@
|
||||
|
||||
#include "power.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_holder.h>
|
||||
|
||||
#include <toolbox/api_lock.h>
|
||||
#include <assets_icons.h>
|
||||
#include <loader/loader.h>
|
||||
|
||||
#include <gui/modules/popup.h>
|
||||
#include "views/power_off.h"
|
||||
#include <power/power_settings.h>
|
||||
#include "views/power_unplug_usb.h"
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
|
||||
#define POWER_BATTERY_HEALTHY_LEVEL 70
|
||||
|
||||
typedef enum {
|
||||
PowerStateNotCharging,
|
||||
PowerStateCharging,
|
||||
@@ -24,26 +20,24 @@ typedef enum {
|
||||
} PowerState;
|
||||
|
||||
struct Power {
|
||||
ViewDispatcher* view_dispatcher;
|
||||
PowerOff* power_off;
|
||||
PowerUnplugUsb* power_unplug_usb;
|
||||
ViewHolder* view_holder;
|
||||
FuriPubSub* event_pubsub;
|
||||
FuriEventLoop* event_loop;
|
||||
FuriMessageQueue* message_queue;
|
||||
|
||||
ViewPort* battery_view_port;
|
||||
Gui* gui;
|
||||
NotificationApp* notification;
|
||||
FuriPubSub* event_pubsub;
|
||||
PowerEvent event;
|
||||
PowerOff* view_power_off;
|
||||
PowerUnplugUsb* view_power_unplug_usb;
|
||||
|
||||
PowerEvent event;
|
||||
PowerState state;
|
||||
PowerInfo info;
|
||||
|
||||
bool battery_low;
|
||||
bool show_low_bat_level_message;
|
||||
bool show_battery_low_warning;
|
||||
uint8_t battery_level;
|
||||
uint8_t power_off_timeout;
|
||||
|
||||
FuriMutex* api_mtx;
|
||||
|
||||
FuriPubSub* settings_events;
|
||||
FuriPubSub* input_events_pubsub;
|
||||
FuriPubSubSubscription* input_events_subscription;
|
||||
@@ -60,3 +54,21 @@ typedef enum {
|
||||
PowerViewOff,
|
||||
PowerViewUnplugUsb,
|
||||
} PowerView;
|
||||
|
||||
typedef enum {
|
||||
PowerMessageTypeShutdown,
|
||||
PowerMessageTypeReboot,
|
||||
PowerMessageTypeGetInfo,
|
||||
PowerMessageTypeIsBatteryHealthy,
|
||||
PowerMessageTypeShowBatteryLowWarning,
|
||||
} PowerMessageType;
|
||||
|
||||
typedef struct {
|
||||
PowerMessageType type;
|
||||
union {
|
||||
PowerBootMode boot_mode;
|
||||
PowerInfo* power_info;
|
||||
bool* bool_param;
|
||||
};
|
||||
FuriApiLock lock;
|
||||
} PowerMessage;
|
||||
|
||||
Reference in New Issue
Block a user