mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-10-04 11:07:02 +02:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
ID 1234:abcd Generic:USB Keyboard
|
||||
REM Declare ourselves as a generic usb keyboard
|
||||
|
||||
REM This will install qFlipper on Linux/Gnome, using the latest AppImage package
|
||||
|
||||
REM Open a terminal
|
||||
ALT F2
|
||||
DELAY 1000
|
||||
STRINGLN gnome-terminal --maximize
|
||||
DELAY 1000
|
||||
|
||||
REM Ensure we have a folder to run executables from
|
||||
STRINGLN mkdir -p $HOME/.local/bin
|
||||
|
||||
REM Download the latest AppImage
|
||||
STRINGLN curl -fsSL "https://update.flipperzero.one/qFlipper/release/linux-amd64/AppImage" -o "$HOME/.local/bin/qFlipper"
|
||||
DELAY 1000
|
||||
|
||||
REM Make it executable
|
||||
STRINGLN chmod +x $HOME/.local/bin/qFlipper
|
||||
|
||||
REM Extract the appimage in /tmp to install icon and .desktop file
|
||||
STRINGLN cd /tmp
|
||||
STRINGLN $HOME/.local/bin/qFlipper --appimage-extract > /dev/null
|
||||
STRINGLN sed "s@Exec=qFlipper@Exec=$HOME/.local/bin/qFlipper@" squashfs-root/usr/share/applications/qFlipper.desktop > $HOME/.local/share/applications/qFlipper.desktop
|
||||
STRINGLN mkdir -p $HOME/.local/share/icons/hicolor/512x512/apps
|
||||
STRINGLN cp squashfs-root/usr/share/icons/hicolor/512x512/apps/qFlipper.png $HOME/.local/share/icons/hicolor/512x512/apps/qFlipper.png
|
||||
STRINGLN rm -rf squashfs-root
|
||||
STRINGLN cd
|
||||
|
||||
REM Depending on the Linux distribution and display manager
|
||||
REM there might be several ways to update desktop entries
|
||||
REM try all
|
||||
STRINGLN xdg-desktop-menu forceupdate || true
|
||||
STRINGLN update-desktop-database ~/.local/share/applications || true
|
||||
|
||||
STRINGLN echo "
|
||||
ENTER
|
||||
REPEAT 60
|
||||
STRINGLN ==========================================================================================
|
||||
STRINGLN qFlipper has been installed to $HOME/.local/bin/
|
||||
STRINGLN It should appear in your Applications menu.
|
||||
STRINGLN If it does not, you might want to log out and log in again.
|
||||
ENTER
|
||||
STRINGLN If you prefer to run qFlipper from your terminal, either use the absolute path
|
||||
STRINGLN or make sure $HOME/.local/bin/ is included in your PATH environment variable.
|
||||
ENTER
|
||||
STRINGLN Additional configurations might be required by your Linux distribution such as
|
||||
STRINGLN group membership, udev rules or else.
|
||||
STRINGLN ==========================================================================================
|
||||
STRINGLN "
|
@@ -0,0 +1,16 @@
|
||||
ID 05ac:021e Apple:Keyboard
|
||||
REM Keep these 3 lines IF (and only if) it's the first time you are performing a badKB attack against a specific macOS target.
|
||||
REM In fact, it helps Flipper Zero bypass the macOS keyboard setup assistant. Otherwise the attack will not start.
|
||||
REM Author: 47LeCoste
|
||||
REM Version 1.0 (Flipper Ducky)
|
||||
REM Target: macOS
|
||||
DELAY 3000
|
||||
F4
|
||||
DELAY 2500
|
||||
STRING Terminal
|
||||
DELAY 2500
|
||||
ENTER
|
||||
DELAY 1500
|
||||
STRING (cd /tmp && curl -L -o qFlipper.dmg https://update.flipperzero.one/qFlipper/release/macos-amd64/dmg && hdiutil attach qFlipper.dmg && app_volume=$(ls /Volumes | grep -i "qFlipper") && (test -e /Applications/qFlipper.app && rm -rf /Applications/qFlipper.app ); cp -R "/Volumes/$app_volume/qFlipper.app" /Applications/ && hdiutil detach "/Volumes/$app_volume" && rm qFlipper.dmg && open /Applications/qFlipper.app)
|
||||
DELAY 1000
|
||||
ENTER
|
@@ -0,0 +1,42 @@
|
||||
REM Written by @dexv
|
||||
DELAY 2000
|
||||
GUI r
|
||||
DELAY 500
|
||||
STRING powershell
|
||||
ENTER
|
||||
DELAY 1000
|
||||
STRING $url = "https://update.flipperzero.one/qFlipper/release/windows-amd64/portable"
|
||||
ENTER
|
||||
STRING $output = "$env:USERPROFILE\Documents\qFlipper.zip"
|
||||
ENTER
|
||||
STRING $destination = "$env:USERPROFILE\Documents\qFlipper"
|
||||
ENTER
|
||||
STRING $shortcutPath = "$env:USERPROFILE\Desktop\qFlipper.lnk"
|
||||
ENTER
|
||||
STRING $scriptPath = "$env:USERPROFILE\Documents\qFlipperInstall.ps1"
|
||||
ENTER
|
||||
STRING $driverPath = "$destination\STM32 Driver"
|
||||
ENTER
|
||||
STRING $installBat = "$driverPath\install.bat"
|
||||
ENTER
|
||||
STRING (New-Object System.Net.WebClient).DownloadFile($url, $output)
|
||||
ENTER
|
||||
STRING Expand-Archive -Path $output -DestinationPath $destination -Force
|
||||
ENTER
|
||||
STRING Set-Location -Path $destination
|
||||
ENTER
|
||||
STRING Start-Process -FilePath ".\qFlipper.exe"
|
||||
ENTER
|
||||
STRING Start-Process -Wait -FilePath "cmd.exe" -ArgumentList "/c $installBat"
|
||||
ENTER
|
||||
STRING $shell = New-Object -ComObject WScript.Shell
|
||||
ENTER
|
||||
STRING $shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
ENTER
|
||||
STRING $shortcut.TargetPath = "$destination\qFlipper.exe"
|
||||
ENTER
|
||||
STRING $shortcut.Save()
|
||||
ENTER
|
||||
DELAY 500
|
||||
STRING "powershell -ExecutionPolicy Bypass -File $scriptPath"
|
||||
ENTER
|
@@ -0,0 +1,87 @@
|
||||
ID 1234:abcd Generic:USB Keyboard
|
||||
REM Declare ourselves as a generic usb keyboard
|
||||
REM You can override this to use something else
|
||||
REM Check the `lsusb` command to know your own devices IDs
|
||||
|
||||
REM This is BadUSB demo script for Linux/Gnome
|
||||
|
||||
REM Open terminal window
|
||||
DELAY 1000
|
||||
ALT F2
|
||||
DELAY 500
|
||||
STRING gnome-terminal --maximize
|
||||
DELAY 500
|
||||
ENTER
|
||||
DELAY 750
|
||||
|
||||
REM Clear the screen in case some banner was displayed
|
||||
STRING clear
|
||||
ENTER
|
||||
|
||||
REM Bigger shell script example
|
||||
STRING cat > /dev/null << EOF
|
||||
ENTER
|
||||
|
||||
STRING Hello World!
|
||||
ENTER
|
||||
|
||||
DEFAULT_DELAY 50
|
||||
|
||||
STRING =
|
||||
REPEAT 59
|
||||
ENTER
|
||||
ENTER
|
||||
|
||||
STRING _.-------.._ -,
|
||||
ENTER
|
||||
HOME
|
||||
STRING .-"'''"--..,,_/ /'-, -, \
|
||||
ENTER
|
||||
HOME
|
||||
STRING .:" /:/ /'\ \ ,_..., '. | |
|
||||
ENTER
|
||||
HOME
|
||||
STRING / ,----/:/ /'\ _\~'_-"' _;
|
||||
ENTER
|
||||
HOME
|
||||
STRING ' / /'"""'\ \ \.~'_-' ,-"'/
|
||||
ENTER
|
||||
HOME
|
||||
STRING | | | 0 | | .-' ,/' /
|
||||
ENTER
|
||||
HOME
|
||||
STRING | ,..\ \ ,.-"' ,/' /
|
||||
ENTER
|
||||
HOME
|
||||
STRING ; : '/'""\' ,/--==,/-----,
|
||||
ENTER
|
||||
HOME
|
||||
STRING | '-...| -.___-Z:_______J...---;
|
||||
ENTER
|
||||
HOME
|
||||
STRING : ' _-'
|
||||
ENTER
|
||||
HOME
|
||||
STRING _L_ _ ___ ___ ___ ___ ____--"'
|
||||
ENTER
|
||||
HOME
|
||||
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
|
||||
ENTER
|
||||
HOME
|
||||
STRING | _| | |__ | | | _/| _/| _| | /
|
||||
ENTER
|
||||
HOME
|
||||
STRING |_| |____||___||_| |_| |___||_|_\
|
||||
ENTER
|
||||
HOME
|
||||
ENTER
|
||||
|
||||
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
|
||||
ENTER
|
||||
STRING More information about script syntax can be found here:
|
||||
ENTER
|
||||
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
|
||||
ENTER
|
||||
|
||||
STRING EOF
|
||||
ENTER
|
@@ -2,7 +2,7 @@ ID 1234:5678 Apple:Keyboard
|
||||
REM You can change these values to VID/PID of original Apple keyboard
|
||||
REM to bypass Keyboard Setup Assistant
|
||||
|
||||
REM This is BadKB demo script for macOS
|
||||
REM This is BadUSB demo script for macOS
|
||||
|
||||
REM Open terminal window
|
||||
DELAY 1000
|
||||
@@ -75,7 +75,7 @@ ENTER
|
||||
HOME
|
||||
ENTER
|
||||
|
||||
STRING Flipper Zero BadKB feature is compatible with USB Rubber Ducky script format
|
||||
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
|
||||
ENTER
|
||||
STRING More information about script syntax can be found here:
|
||||
ENTER
|
||||
|
@@ -1,4 +1,4 @@
|
||||
REM This is BadKB demo script for windows
|
||||
REM This is BadUSB demo script for windows
|
||||
|
||||
REM Open windows notepad
|
||||
DELAY 1000
|
||||
@@ -76,7 +76,7 @@ ENTER
|
||||
HOME
|
||||
ENTER
|
||||
|
||||
STRING Flipper Zero BadKB feature is compatible with USB Rubber Ducky script format
|
||||
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
|
||||
ENTER
|
||||
STRING More information about script syntax can be found here:
|
||||
ENTER
|
||||
|
@@ -48,6 +48,26 @@ void dolphin_deed(DolphinDeed deed) {
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
}
|
||||
|
||||
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings) {
|
||||
furi_check(dolphin);
|
||||
furi_check(settings);
|
||||
|
||||
DolphinEvent event;
|
||||
event.type = DolphinEventTypeSettingsGet;
|
||||
event.settings = settings;
|
||||
dolphin_event_send_wait(dolphin, &event);
|
||||
}
|
||||
|
||||
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings) {
|
||||
furi_check(dolphin);
|
||||
furi_check(settings);
|
||||
|
||||
DolphinEvent event;
|
||||
event.type = DolphinEventTypeSettingsSet;
|
||||
event.settings = settings;
|
||||
dolphin_event_send_wait(dolphin, &event);
|
||||
}
|
||||
|
||||
DolphinStats dolphin_stats(Dolphin* dolphin) {
|
||||
furi_check(dolphin);
|
||||
|
||||
@@ -230,7 +250,9 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
|
||||
|
||||
} else if(event.type == DolphinEventTypeStats) {
|
||||
event.stats->icounter = dolphin->state->data.icounter;
|
||||
event.stats->butthurt = dolphin->state->data.butthurt;
|
||||
event.stats->butthurt = (dolphin->state->data.flags & DolphinFlagHappyMode) ?
|
||||
0 :
|
||||
dolphin->state->data.butthurt;
|
||||
event.stats->timestamp = dolphin->state->data.timestamp;
|
||||
event.stats->level = dolphin_get_level(dolphin->state->data.icounter);
|
||||
event.stats->level_up_is_pending =
|
||||
@@ -248,6 +270,15 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
|
||||
dolphin_state_load(dolphin->state);
|
||||
dolphin_reset_butthurt_timer(dolphin);
|
||||
|
||||
} else if(event.type == DolphinEventTypeSettingsGet) {
|
||||
event.settings->happy_mode = dolphin->state->data.flags & DolphinFlagHappyMode;
|
||||
|
||||
} else if(event.type == DolphinEventTypeSettingsSet) {
|
||||
dolphin->state->data.flags &= ~DolphinFlagHappyMode;
|
||||
if(event.settings->happy_mode) dolphin->state->data.flags |= DolphinFlagHappyMode;
|
||||
dolphin->state->dirty = true;
|
||||
dolphin_state_save(dolphin->state);
|
||||
|
||||
} else {
|
||||
furi_crash();
|
||||
}
|
||||
|
@@ -21,6 +21,10 @@ typedef struct {
|
||||
bool level_up_is_pending;
|
||||
} DolphinStats;
|
||||
|
||||
typedef struct {
|
||||
bool happy_mode;
|
||||
} DolphinSettings;
|
||||
|
||||
typedef enum {
|
||||
DolphinPubsubEventUpdate,
|
||||
} DolphinPubsubEvent;
|
||||
@@ -31,6 +35,10 @@ typedef enum {
|
||||
*/
|
||||
void dolphin_deed(DolphinDeed deed);
|
||||
|
||||
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings);
|
||||
|
||||
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings);
|
||||
|
||||
/** Retrieve dolphin stats
|
||||
* Thread safe, blocking
|
||||
*/
|
||||
|
@@ -13,6 +13,8 @@ typedef enum {
|
||||
DolphinEventTypeFlush,
|
||||
DolphinEventTypeLevel,
|
||||
DolphinEventTypeReloadState,
|
||||
DolphinEventTypeSettingsGet,
|
||||
DolphinEventTypeSettingsSet,
|
||||
} DolphinEventType;
|
||||
|
||||
typedef struct {
|
||||
@@ -21,6 +23,7 @@ typedef struct {
|
||||
union {
|
||||
DolphinDeed deed;
|
||||
DolphinStats* stats;
|
||||
DolphinSettings* settings;
|
||||
};
|
||||
} DolphinEvent;
|
||||
|
||||
|
@@ -6,16 +6,16 @@
|
||||
|
||||
#include "dolphin_deed.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const uint32_t DOLPHIN_LEVELS[];
|
||||
extern const size_t DOLPHIN_LEVEL_COUNT;
|
||||
|
||||
#define BUTTHURT_MAX 14
|
||||
#define BUTTHURT_MIN 0
|
||||
|
||||
typedef enum {
|
||||
DolphinFlagHappyMode = 1,
|
||||
} DolphinFlags;
|
||||
|
||||
typedef struct DolphinState DolphinState;
|
||||
typedef struct {
|
||||
uint8_t icounter_daily_limit[DolphinAppMAX];
|
||||
@@ -57,7 +57,3 @@ bool dolphin_state_is_levelup(uint32_t icounter);
|
||||
void dolphin_state_increase_level(DolphinState* dolphin_state);
|
||||
|
||||
uint8_t dolphin_get_level(uint32_t icounter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include <furi.h>
|
||||
#include <gui/modules/popup.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <gui/scene_manager.h>
|
||||
|
||||
#include <desktop/desktop.h>
|
||||
@@ -68,11 +69,11 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
|
||||
|
||||
app->popup = popup_alloc();
|
||||
app->submenu = submenu_alloc();
|
||||
app->dialog_ex = dialog_ex_alloc();
|
||||
app->variable_item_list = variable_item_list_alloc();
|
||||
app->pin_input_view = desktop_view_pin_input_alloc();
|
||||
app->pin_setup_howto_view = desktop_settings_view_pin_setup_howto_alloc();
|
||||
app->pin_setup_howto2_view = desktop_settings_view_pin_setup_howto2_alloc();
|
||||
app->dialog_ex = dialog_ex_alloc();
|
||||
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, DesktopSettingsAppViewMenu, submenu_get_view(app->submenu));
|
||||
@@ -82,8 +83,6 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
|
||||
variable_item_list_get_view(app->variable_item_list));
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, DesktopSettingsAppViewIdPopup, popup_get_view(app->popup));
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, DesktopSettingsAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher,
|
||||
DesktopSettingsAppViewIdPinInput,
|
||||
@@ -96,6 +95,8 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
|
||||
app->view_dispatcher,
|
||||
DesktopSettingsAppViewIdPinSetupHowto2,
|
||||
desktop_settings_view_pin_setup_howto2_get_view(app->pin_setup_howto2_view));
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, DesktopSettingsAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -105,17 +106,17 @@ void desktop_settings_app_free(DesktopSettingsApp* app) {
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewMenu);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewVarItemList);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPopup);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinInput);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto2);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
|
||||
variable_item_list_free(app->variable_item_list);
|
||||
dialog_ex_free(app->dialog_ex);
|
||||
submenu_free(app->submenu);
|
||||
popup_free(app->popup);
|
||||
desktop_view_pin_input_free(app->pin_input_view);
|
||||
desktop_settings_view_pin_setup_howto_free(app->pin_setup_howto_view);
|
||||
desktop_settings_view_pin_setup_howto2_free(app->pin_setup_howto2_view);
|
||||
dialog_ex_free(app->dialog_ex);
|
||||
// View dispatcher
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
scene_manager_free(app->scene_manager);
|
||||
|
@@ -5,8 +5,8 @@
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <assets_icons.h>
|
||||
#include <storage/storage.h>
|
||||
@@ -22,10 +22,10 @@ typedef enum {
|
||||
DesktopSettingsAppViewMenu,
|
||||
DesktopSettingsAppViewVarItemList,
|
||||
DesktopSettingsAppViewIdPopup,
|
||||
DesktopSettingsAppViewDialogEx,
|
||||
DesktopSettingsAppViewIdPinInput,
|
||||
DesktopSettingsAppViewIdPinSetupHowto,
|
||||
DesktopSettingsAppViewIdPinSetupHowto2,
|
||||
DesktopSettingsAppViewDialogEx,
|
||||
} DesktopSettingsAppView;
|
||||
|
||||
typedef enum {
|
||||
@@ -50,10 +50,10 @@ typedef struct {
|
||||
VariableItemList* variable_item_list;
|
||||
Submenu* submenu;
|
||||
Popup* popup;
|
||||
DialogEx* dialog_ex;
|
||||
DesktopViewPinInput* pin_input_view;
|
||||
DesktopSettingsViewPinSetupHowto* pin_setup_howto_view;
|
||||
DesktopSettingsViewPinSetupHowto2* pin_setup_howto2_view;
|
||||
DialogEx* dialog_ex;
|
||||
|
||||
DesktopPinCode pincode_buffer;
|
||||
bool pincode_buffer_filled;
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
// reserve 100 for button presses, submenu selections, etc.
|
||||
DesktopSettingsCustomEventExit = 100,
|
||||
DesktopSettingsCustomEventDone,
|
||||
|
||||
DesktopSettingsCustomEvent1stPinEntered,
|
||||
DesktopSettingsCustomEventPinsEqual,
|
||||
DesktopSettingsCustomEventPinsDifferent,
|
||||
|
||||
DesktopSettingsCustomEventSetPin,
|
||||
DesktopSettingsCustomEventChangePin,
|
||||
DesktopSettingsCustomEventDisablePin,
|
||||
} DesktopSettingsCustomEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -13,3 +13,5 @@ ADD_SCENE(desktop_settings, pin_setup, PinSetup)
|
||||
ADD_SCENE(desktop_settings, pin_setup_howto, PinSetupHowto)
|
||||
ADD_SCENE(desktop_settings, pin_setup_howto2, PinSetupHowto2)
|
||||
ADD_SCENE(desktop_settings, pin_setup_done, PinSetupDone)
|
||||
|
||||
ADD_SCENE(desktop_settings, happy_mode, HappyMode)
|
||||
|
@@ -0,0 +1,64 @@
|
||||
#include <furi.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void desktop_settings_scene_happy_mode_done_callback(DialogExResult result, void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
DolphinSettings settings;
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
dolphin_get_settings(dolphin, &settings);
|
||||
settings.happy_mode = (result == DialogExResultRight);
|
||||
dolphin_set_settings(dolphin, &settings);
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_happy_mode_on_enter(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinSettings settings;
|
||||
dolphin_get_settings(dolphin, &settings);
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
dialog_ex_set_header(app->dialog_ex, "Happy Mode", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_ex_set_text(
|
||||
app->dialog_ex,
|
||||
"I will never get angry at you\nfor not spending time with me\nas long as this mode is enabled",
|
||||
64,
|
||||
30,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
dialog_ex_set_left_button_text(app->dialog_ex, settings.happy_mode ? "Disable" : "Go back");
|
||||
dialog_ex_set_right_button_text(
|
||||
app->dialog_ex, settings.happy_mode ? "Keep enabled" : "Enable");
|
||||
dialog_ex_set_result_callback(app->dialog_ex, desktop_settings_scene_happy_mode_done_callback);
|
||||
dialog_ex_set_context(app->dialog_ex, app);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
|
||||
}
|
||||
|
||||
bool desktop_settings_scene_happy_mode_on_event(void* context, SceneManagerEvent event) {
|
||||
DesktopSettingsApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case DesktopSettingsCustomEventExit:
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
consumed = true;
|
||||
break;
|
||||
default:
|
||||
furi_crash();
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void desktop_settings_scene_happy_mode_on_exit(void* context) {
|
||||
UNUSED(context);
|
||||
}
|
@@ -3,15 +3,12 @@
|
||||
#include <gui/scene_manager.h>
|
||||
#include <desktop/helpers/pin_code.h>
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include <desktop/views/desktop_view_pin_input.h>
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "desktop_settings_scene_i.h"
|
||||
|
||||
#define SCENE_EVENT_EXIT (0U)
|
||||
#define SCENE_EVENT_PINS_EQUAL (1U)
|
||||
#define SCENE_EVENT_PINS_DIFFERENT (2U)
|
||||
|
||||
static void pin_auth_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||
furi_assert(pin_code);
|
||||
furi_assert(context);
|
||||
@@ -20,15 +17,17 @@ static void pin_auth_done_callback(const DesktopPinCode* pin_code, void* context
|
||||
app->pincode_buffer = *pin_code;
|
||||
|
||||
if(desktop_pin_code_check(pin_code)) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_EQUAL);
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, DesktopSettingsCustomEventPinsEqual);
|
||||
} else {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_DIFFERENT);
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, DesktopSettingsCustomEventPinsDifferent);
|
||||
}
|
||||
}
|
||||
|
||||
static void pin_auth_back_callback(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_auth_on_enter(void* context) {
|
||||
@@ -54,13 +53,13 @@ bool desktop_settings_scene_pin_auth_on_event(void* context, SceneManagerEvent e
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_PINS_DIFFERENT:
|
||||
case DesktopSettingsCustomEventPinsDifferent:
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, DesktopSettingsAppScenePinError, SCENE_STATE_PIN_ERROR_WRONG);
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_PINS_EQUAL: {
|
||||
case DesktopSettingsCustomEventPinsEqual: {
|
||||
uint32_t state =
|
||||
scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||
if(state == SCENE_STATE_PIN_AUTH_CHANGE_PIN) {
|
||||
@@ -73,7 +72,7 @@ bool desktop_settings_scene_pin_auth_on_event(void* context, SceneManagerEvent e
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
case SCENE_EVENT_EXIT:
|
||||
case DesktopSettingsCustomEventExit:
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||
consumed = true;
|
||||
|
@@ -3,15 +3,14 @@
|
||||
#include <gui/modules/popup.h>
|
||||
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include "desktop_settings_scene.h"
|
||||
|
||||
#define SCENE_EVENT_EXIT (0U)
|
||||
|
||||
static void pin_disable_back_callback(void* context) {
|
||||
furi_assert(context);
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_disable_on_enter(void* context) {
|
||||
@@ -35,7 +34,7 @@ bool desktop_settings_scene_pin_disable_on_event(void* context, SceneManagerEven
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_EXIT:
|
||||
case DesktopSettingsCustomEventExit:
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||
consumed = true;
|
||||
|
@@ -8,20 +8,19 @@
|
||||
#include "desktop_settings_scene_i.h"
|
||||
#include <desktop/helpers/pin_code.h>
|
||||
#include "../desktop_settings_app.h"
|
||||
|
||||
#define SCENE_EVENT_EXIT (0U)
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void pin_error_back_callback(void* context) {
|
||||
furi_assert(context);
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
static void pin_error_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||
UNUSED(pin_code);
|
||||
furi_assert(context);
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_error_on_enter(void* context) {
|
||||
@@ -55,7 +54,7 @@ bool desktop_settings_scene_pin_error_on_event(void* context, SceneManagerEvent
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_EXIT:
|
||||
case DesktopSettingsCustomEventExit:
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
consumed = true;
|
||||
break;
|
||||
|
@@ -4,10 +4,7 @@
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "desktop_settings_scene_i.h"
|
||||
|
||||
#define SCENE_EVENT_SET_PIN 0
|
||||
#define SCENE_EVENT_CHANGE_PIN 1
|
||||
#define SCENE_EVENT_DISABLE_PIN 2
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void desktop_settings_scene_pin_menu_submenu_callback(void* context, uint32_t index) {
|
||||
DesktopSettingsApp* app = context;
|
||||
@@ -23,7 +20,7 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Set PIN",
|
||||
SCENE_EVENT_SET_PIN,
|
||||
DesktopSettingsCustomEventSetPin,
|
||||
desktop_settings_scene_pin_menu_submenu_callback,
|
||||
app);
|
||||
|
||||
@@ -31,14 +28,14 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Change PIN",
|
||||
SCENE_EVENT_CHANGE_PIN,
|
||||
DesktopSettingsCustomEventChangePin,
|
||||
desktop_settings_scene_pin_menu_submenu_callback,
|
||||
app);
|
||||
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Remove PIN",
|
||||
SCENE_EVENT_DISABLE_PIN,
|
||||
DesktopSettingsCustomEventDisablePin,
|
||||
desktop_settings_scene_pin_menu_submenu_callback,
|
||||
app);
|
||||
}
|
||||
@@ -54,11 +51,11 @@ bool desktop_settings_scene_pin_menu_on_event(void* context, SceneManagerEvent e
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_SET_PIN:
|
||||
case DesktopSettingsCustomEventSetPin:
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_CHANGE_PIN:
|
||||
case DesktopSettingsCustomEventChangePin:
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager,
|
||||
DesktopSettingsAppScenePinAuth,
|
||||
@@ -66,7 +63,7 @@ bool desktop_settings_scene_pin_menu_on_event(void* context, SceneManagerEvent e
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_DISABLE_PIN:
|
||||
case DesktopSettingsCustomEventDisablePin:
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, DesktopSettingsAppScenePinAuth, SCENE_STATE_PIN_AUTH_DISABLE);
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinAuth);
|
||||
|
@@ -8,11 +8,7 @@
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "desktop_settings_scene_i.h"
|
||||
#include <desktop/helpers/pin_code.h>
|
||||
|
||||
#define SCENE_EVENT_EXIT (0U)
|
||||
#define SCENE_EVENT_1ST_PIN_ENTERED (1U)
|
||||
#define SCENE_EVENT_PINS_EQUAL (2U)
|
||||
#define SCENE_EVENT_PINS_DIFFERENT (3U)
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||
furi_assert(pin_code);
|
||||
@@ -22,20 +18,23 @@ static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* contex
|
||||
if(!app->pincode_buffer_filled) {
|
||||
app->pincode_buffer = *pin_code;
|
||||
app->pincode_buffer_filled = true;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_1ST_PIN_ENTERED);
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, DesktopSettingsCustomEvent1stPinEntered);
|
||||
} else {
|
||||
app->pincode_buffer_filled = false;
|
||||
if(desktop_pin_code_is_equal(&app->pincode_buffer, pin_code)) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_EQUAL);
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, DesktopSettingsCustomEventPinsEqual);
|
||||
} else {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_PINS_DIFFERENT);
|
||||
view_dispatcher_send_custom_event(
|
||||
app->view_dispatcher, DesktopSettingsCustomEventPinsDifferent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void pin_setup_back_callback(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_EXIT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_setup_on_enter(void* context) {
|
||||
@@ -60,7 +59,7 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_1ST_PIN_ENTERED:
|
||||
case DesktopSettingsCustomEvent1stPinEntered:
|
||||
desktop_view_pin_input_set_label_button(app->pin_input_view, "OK");
|
||||
desktop_view_pin_input_set_label_primary(app->pin_input_view, 0, 0, NULL);
|
||||
desktop_view_pin_input_set_label_secondary(
|
||||
@@ -69,7 +68,7 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||
desktop_view_pin_input_unlock_input(app->pin_input_view);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_PINS_DIFFERENT:
|
||||
case DesktopSettingsCustomEventPinsDifferent:
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager,
|
||||
DesktopSettingsAppScenePinError,
|
||||
@@ -77,11 +76,11 @@ bool desktop_settings_scene_pin_setup_on_event(void* context, SceneManagerEvent
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinError);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_PINS_EQUAL:
|
||||
case DesktopSettingsCustomEventPinsEqual:
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupHowto2);
|
||||
consumed = true;
|
||||
break;
|
||||
case SCENE_EVENT_EXIT: {
|
||||
case DesktopSettingsCustomEventExit: {
|
||||
uint32_t scene_found;
|
||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||
|
@@ -5,18 +5,17 @@
|
||||
#include <gui/view_dispatcher.h>
|
||||
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include <desktop/views/desktop_view_pin_input.h>
|
||||
#include "desktop_settings_scene.h"
|
||||
|
||||
#define SCENE_EVENT_DONE (0U)
|
||||
|
||||
static void pin_setup_done_callback(const DesktopPinCode* pin_code, void* context) {
|
||||
furi_assert(pin_code);
|
||||
furi_assert(context);
|
||||
DesktopSettingsApp* app = context;
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EVENT_DONE);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventDone);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_setup_done_on_enter(void* context) {
|
||||
@@ -48,7 +47,7 @@ bool desktop_settings_scene_pin_setup_done_on_event(void* context, SceneManagerE
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EVENT_DONE: {
|
||||
case DesktopSettingsCustomEventDone: {
|
||||
bool scene_found = false;
|
||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||
|
@@ -5,12 +5,11 @@
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../views/desktop_settings_view_pin_setup_howto.h"
|
||||
|
||||
#define SCENE_EXIT_EVENT (0U)
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void desktop_settings_scene_pin_lock_done_callback(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EXIT_EVENT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_setup_howto_on_enter(void* context) {
|
||||
@@ -27,7 +26,7 @@ bool desktop_settings_scene_pin_setup_howto_on_event(void* context, SceneManager
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_EXIT_EVENT:
|
||||
case DesktopSettingsCustomEventExit:
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetup);
|
||||
consumed = true;
|
||||
break;
|
||||
|
@@ -4,18 +4,16 @@
|
||||
#include "desktop_settings_scene.h"
|
||||
#include "../desktop_settings_app.h"
|
||||
#include "../views/desktop_settings_view_pin_setup_howto2.h"
|
||||
|
||||
#define SCENE_EXIT_EVENT (0U)
|
||||
#define SCENE_DONE_EVENT (1U)
|
||||
#include "../desktop_settings_custom_event.h"
|
||||
|
||||
static void desktop_settings_scene_pin_setup_howto2_done_callback(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_DONE_EVENT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventDone);
|
||||
}
|
||||
|
||||
static void desktop_settings_scene_pin_setup_howto2_exit_callback(void* context) {
|
||||
DesktopSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SCENE_EXIT_EVENT);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, DesktopSettingsCustomEventExit);
|
||||
}
|
||||
|
||||
void desktop_settings_scene_pin_setup_howto2_on_enter(void* context) {
|
||||
@@ -35,12 +33,12 @@ bool desktop_settings_scene_pin_setup_howto2_on_event(void* context, SceneManage
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case SCENE_DONE_EVENT: {
|
||||
case DesktopSettingsCustomEventDone: {
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppScenePinSetupDone);
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
case SCENE_EXIT_EVENT: {
|
||||
case DesktopSettingsCustomEventExit: {
|
||||
bool scene_found = false;
|
||||
scene_found = scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, DesktopSettingsAppScenePinMenu);
|
||||
|
@@ -11,6 +11,7 @@ typedef enum {
|
||||
DesktopSettingsAutoLockDelay,
|
||||
DesktopSettingsAutoLockPin,
|
||||
DesktopSettingsClockDisplay,
|
||||
DesktopSettingsHappyMode,
|
||||
} DesktopSettingsEntry;
|
||||
|
||||
#define AUTO_LOCK_DELAY_COUNT 9
|
||||
@@ -104,7 +105,7 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_list,
|
||||
"Show Clock",
|
||||
CLOCK_ENABLE_COUNT,
|
||||
desktop_settings_scene_start_clock_enable_changed, //
|
||||
desktop_settings_scene_start_clock_enable_changed,
|
||||
app);
|
||||
|
||||
value_index =
|
||||
@@ -112,6 +113,8 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, clock_enable_text[value_index]);
|
||||
|
||||
variable_item_list_add(variable_item_list, "Happy Mode", 1, NULL, NULL);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
|
||||
|
||||
@@ -142,6 +145,10 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
case DesktopSettingsHappyMode:
|
||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneHappyMode);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "../power_settings_app.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void power_settings_scene_power_off_dialog_callback(DialogExResult result, void* context) {
|
||||
furi_assert(context);
|
||||
@@ -9,11 +10,23 @@ void power_settings_scene_power_off_dialog_callback(DialogExResult result, void*
|
||||
void power_settings_scene_power_off_on_enter(void* context) {
|
||||
PowerSettingsApp* app = context;
|
||||
DialogEx* dialog = app->dialog;
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinSettings settings;
|
||||
dolphin_get_settings(dolphin, &settings);
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
dialog_ex_set_header(dialog, "Turn Off Device?", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_ex_set_text(
|
||||
dialog, " I will be\nwaiting for\n you here...", 78, 14, AlignLeft, AlignTop);
|
||||
dialog_ex_set_icon(dialog, 14, 10, &I_dolph_cry_49x54);
|
||||
dialog_ex_set_header(
|
||||
dialog,
|
||||
"Turn Off Device?",
|
||||
64,
|
||||
settings.happy_mode ? 32 : 0,
|
||||
AlignCenter,
|
||||
settings.happy_mode ? AlignCenter : AlignTop);
|
||||
if(!settings.happy_mode) {
|
||||
dialog_ex_set_text(
|
||||
dialog, " I will be\nwaiting for\n you here...", 78, 14, AlignLeft, AlignTop);
|
||||
dialog_ex_set_icon(dialog, 14, 10, &I_dolph_cry_49x54);
|
||||
}
|
||||
dialog_ex_set_left_button_text(dialog, "Battery");
|
||||
dialog_ex_set_right_button_text(dialog, "Power Off");
|
||||
dialog_ex_set_result_callback(dialog, power_settings_scene_power_off_dialog_callback);
|
||||
|
@@ -128,8 +128,9 @@ static bool protocol_gproxii_can_be_decoded(ProtocolGProxII* protocol) {
|
||||
if(bit_lib_get_bits(protocol->data, 0, 6) != 0b111110) return false;
|
||||
|
||||
// Check always 0 parity on every 5th bit after preamble
|
||||
if(!bit_lib_test_parity(protocol->data, 6, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5))
|
||||
if(!bit_lib_test_parity(protocol->data, 6, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start GProx II decode
|
||||
bit_lib_copy_bits(protocol->decoded_data, 0, GPROXII_ENCODED_BIT_SIZE, protocol->data, 6);
|
||||
|
@@ -869,6 +869,8 @@ Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
|
||||
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
||||
Function,+,dolphin_flush,void,Dolphin*
|
||||
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
||||
Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
||||
Function,+,dolphin_upgrade_level,void,Dolphin*
|
||||
Function,-,dprintf,int,"int, const char*, ..."
|
||||
|
|
@@ -40,6 +40,7 @@ void furi_hal_init(void) {
|
||||
furi_hal_interrupt_init();
|
||||
furi_hal_flash_init();
|
||||
furi_hal_resources_init();
|
||||
furi_hal_region_init();
|
||||
furi_hal_spi_config_init();
|
||||
furi_hal_spi_dma_init();
|
||||
furi_hal_speaker_init();
|
||||
|
@@ -976,6 +976,8 @@ Function,+,dolphin_deed_get_app_limit,uint8_t,DolphinApp
|
||||
Function,+,dolphin_deed_get_weight,uint8_t,DolphinDeed
|
||||
Function,+,dolphin_flush,void,Dolphin*
|
||||
Function,+,dolphin_get_pubsub,FuriPubSub*,Dolphin*
|
||||
Function,+,dolphin_get_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_set_settings,void,"Dolphin*, DolphinSettings*"
|
||||
Function,+,dolphin_reload_state,void,Dolphin*
|
||||
Function,+,dolphin_stats,DolphinStats,Dolphin*
|
||||
Function,+,dolphin_upgrade_level,void,Dolphin*
|
||||
|
|
Reference in New Issue
Block a user