mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-15 20:01:54 -07:00
Merge branch 'dev' into shutdown_idle
This commit is contained in:
@@ -9,10 +9,10 @@ enum HidDebugSubmenuIndex {
|
||||
HidSubmenuIndexKeynote,
|
||||
HidSubmenuIndexKeyboard,
|
||||
HidSubmenuIndexMedia,
|
||||
BtHidSubmenuIndexTikTok,
|
||||
HidSubmenuIndexTikTok,
|
||||
HidSubmenuIndexMouse,
|
||||
HidSubmenuIndexMouseJiggler,
|
||||
};
|
||||
typedef enum { ConnTypeSubmenuIndexBluetooth, ConnTypeSubmenuIndexUsb } ConnTypeDebugSubmenuIndex;
|
||||
|
||||
static void hid_submenu_callback(void* context, uint32_t index) {
|
||||
furi_assert(context);
|
||||
@@ -29,9 +29,12 @@ static void hid_submenu_callback(void* context, uint32_t index) {
|
||||
} else if(index == HidSubmenuIndexMouse) {
|
||||
app->view_id = HidViewMouse;
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouse);
|
||||
} else if(index == BtHidSubmenuIndexTikTok) {
|
||||
} else if(index == HidSubmenuIndexTikTok) {
|
||||
app->view_id = BtHidViewTikTok;
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewTikTok);
|
||||
} else if(index == HidSubmenuIndexMouseJiggler) {
|
||||
app->view_id = HidViewMouseJiggler;
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseJiggler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +51,7 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
|
||||
hid_keyboard_set_connected_status(hid->hid_keyboard, connected);
|
||||
hid_media_set_connected_status(hid->hid_media, connected);
|
||||
hid_mouse_set_connected_status(hid->hid_mouse, connected);
|
||||
hid_mouse_jiggler_set_connected_status(hid->hid_mouse_jiggler, connected);
|
||||
hid_tiktok_set_connected_status(hid->hid_tiktok, connected);
|
||||
}
|
||||
|
||||
@@ -104,10 +108,16 @@ Hid* hid_alloc(HidTransport transport) {
|
||||
submenu_add_item(
|
||||
app->device_type_submenu,
|
||||
"TikTok Controller",
|
||||
BtHidSubmenuIndexTikTok,
|
||||
HidSubmenuIndexTikTok,
|
||||
hid_submenu_callback,
|
||||
app);
|
||||
}
|
||||
submenu_add_item(
|
||||
app->device_type_submenu,
|
||||
"Mouse Jiggler",
|
||||
HidSubmenuIndexMouseJiggler,
|
||||
hid_submenu_callback,
|
||||
app);
|
||||
view_set_previous_callback(submenu_get_view(app->device_type_submenu), hid_exit);
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->device_type_submenu));
|
||||
@@ -160,6 +170,15 @@ Hid* hid_app_alloc_view(void* context) {
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, HidViewMouse, hid_mouse_get_view(app->hid_mouse));
|
||||
|
||||
// Mouse jiggler view
|
||||
app->hid_mouse_jiggler = hid_mouse_jiggler_alloc(app);
|
||||
view_set_previous_callback(
|
||||
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler), hid_exit_confirm_view);
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher,
|
||||
HidViewMouseJiggler,
|
||||
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler));
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -182,6 +201,8 @@ void hid_free(Hid* app) {
|
||||
hid_media_free(app->hid_media);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouse);
|
||||
hid_mouse_free(app->hid_mouse);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouseJiggler);
|
||||
hid_mouse_jiggler_free(app->hid_mouse_jiggler);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BtHidViewTikTok);
|
||||
hid_tiktok_free(app->hid_tiktok);
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "views/hid_keyboard.h"
|
||||
#include "views/hid_media.h"
|
||||
#include "views/hid_mouse.h"
|
||||
#include "views/hid_mouse_jiggler.h"
|
||||
#include "views/hid_tiktok.h"
|
||||
|
||||
typedef enum {
|
||||
@@ -39,6 +40,7 @@ struct Hid {
|
||||
HidKeyboard* hid_keyboard;
|
||||
HidMedia* hid_media;
|
||||
HidMouse* hid_mouse;
|
||||
HidMouseJiggler* hid_mouse_jiggler;
|
||||
HidTikTok* hid_tiktok;
|
||||
|
||||
HidTransport transport;
|
||||
|
||||
@@ -4,6 +4,7 @@ typedef enum {
|
||||
HidViewKeyboard,
|
||||
HidViewMedia,
|
||||
HidViewMouse,
|
||||
HidViewMouseJiggler,
|
||||
BtHidViewTikTok,
|
||||
HidViewExitConfirm,
|
||||
} HidView;
|
||||
@@ -0,0 +1,149 @@
|
||||
#include "hid_mouse_jiggler.h"
|
||||
#include <gui/elements.h>
|
||||
#include "../hid.h"
|
||||
|
||||
#include "hid_icons.h"
|
||||
|
||||
#define TAG "HidMouseJiggler"
|
||||
|
||||
struct HidMouseJiggler {
|
||||
View* view;
|
||||
Hid* hid;
|
||||
FuriTimer* timer;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool connected;
|
||||
bool running;
|
||||
uint8_t counter;
|
||||
} HidMouseJigglerModel;
|
||||
|
||||
static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
|
||||
furi_assert(context);
|
||||
HidMouseJigglerModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Jiggler");
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text(canvas, AlignLeft, 35, "Press Start\nto jiggle");
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
|
||||
// Ok
|
||||
canvas_draw_icon(canvas, 63, 25, &I_Space_65x18);
|
||||
if(model->running) {
|
||||
elements_slightly_rounded_box(canvas, 66, 27, 60, 13);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9);
|
||||
if(model->running) {
|
||||
elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Stop");
|
||||
} else {
|
||||
elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Start");
|
||||
}
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
|
||||
// Back
|
||||
canvas_draw_icon(canvas, 74, 49, &I_Pin_back_arrow_10x8);
|
||||
elements_multiline_text_aligned(canvas, 91, 57, AlignLeft, AlignBottom, "Quit");
|
||||
}
|
||||
|
||||
static void hid_mouse_jiggler_timer_callback(void* context) {
|
||||
furi_assert(context);
|
||||
HidMouseJiggler* hid_mouse_jiggler = context;
|
||||
with_view_model(
|
||||
hid_mouse_jiggler->view,
|
||||
HidMouseJigglerModel * model,
|
||||
{
|
||||
if(model->running) {
|
||||
model->counter++;
|
||||
hid_hal_mouse_move(
|
||||
hid_mouse_jiggler->hid,
|
||||
(model->counter % 2 == 0) ? MOUSE_MOVE_SHORT : -MOUSE_MOVE_SHORT,
|
||||
0);
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
static void hid_mouse_jiggler_enter_callback(void* context) {
|
||||
furi_assert(context);
|
||||
HidMouseJiggler* hid_mouse_jiggler = context;
|
||||
|
||||
furi_timer_start(hid_mouse_jiggler->timer, 500);
|
||||
}
|
||||
|
||||
static void hid_mouse_jiggler_exit_callback(void* context) {
|
||||
furi_assert(context);
|
||||
HidMouseJiggler* hid_mouse_jiggler = context;
|
||||
furi_timer_stop(hid_mouse_jiggler->timer);
|
||||
}
|
||||
|
||||
static bool hid_mouse_jiggler_input_callback(InputEvent* event, void* context) {
|
||||
furi_assert(context);
|
||||
HidMouseJiggler* hid_mouse_jiggler = context;
|
||||
|
||||
bool consumed = false;
|
||||
|
||||
if(event->key == InputKeyOk) {
|
||||
with_view_model(
|
||||
hid_mouse_jiggler->view,
|
||||
HidMouseJigglerModel * model,
|
||||
{ model->running = !model->running; },
|
||||
true);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
HidMouseJiggler* hid_mouse_jiggler_alloc(Hid* hid) {
|
||||
HidMouseJiggler* hid_mouse_jiggler = malloc(sizeof(HidMouseJiggler));
|
||||
|
||||
hid_mouse_jiggler->view = view_alloc();
|
||||
view_set_context(hid_mouse_jiggler->view, hid_mouse_jiggler);
|
||||
view_allocate_model(
|
||||
hid_mouse_jiggler->view, ViewModelTypeLocking, sizeof(HidMouseJigglerModel));
|
||||
view_set_draw_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_draw_callback);
|
||||
view_set_input_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_input_callback);
|
||||
view_set_enter_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_enter_callback);
|
||||
view_set_exit_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_exit_callback);
|
||||
|
||||
hid_mouse_jiggler->hid = hid;
|
||||
|
||||
hid_mouse_jiggler->timer = furi_timer_alloc(
|
||||
hid_mouse_jiggler_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler);
|
||||
|
||||
return hid_mouse_jiggler;
|
||||
}
|
||||
|
||||
void hid_mouse_jiggler_free(HidMouseJiggler* hid_mouse_jiggler) {
|
||||
furi_assert(hid_mouse_jiggler);
|
||||
|
||||
furi_timer_stop(hid_mouse_jiggler->timer);
|
||||
furi_timer_free(hid_mouse_jiggler->timer);
|
||||
|
||||
view_free(hid_mouse_jiggler->view);
|
||||
|
||||
free(hid_mouse_jiggler);
|
||||
}
|
||||
|
||||
View* hid_mouse_jiggler_get_view(HidMouseJiggler* hid_mouse_jiggler) {
|
||||
furi_assert(hid_mouse_jiggler);
|
||||
return hid_mouse_jiggler->view;
|
||||
}
|
||||
|
||||
void hid_mouse_jiggler_set_connected_status(HidMouseJiggler* hid_mouse_jiggler, bool connected) {
|
||||
furi_assert(hid_mouse_jiggler);
|
||||
with_view_model(
|
||||
hid_mouse_jiggler->view,
|
||||
HidMouseJigglerModel * model,
|
||||
{ model->connected = connected; },
|
||||
true);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/view.h>
|
||||
|
||||
#define MOUSE_MOVE_SHORT 5
|
||||
#define MOUSE_MOVE_LONG 20
|
||||
|
||||
typedef struct Hid Hid;
|
||||
typedef struct HidMouseJiggler HidMouseJiggler;
|
||||
|
||||
HidMouseJiggler* hid_mouse_jiggler_alloc(Hid* bt_hid);
|
||||
|
||||
void hid_mouse_jiggler_free(HidMouseJiggler* hid_mouse_jiggler);
|
||||
|
||||
View* hid_mouse_jiggler_get_view(HidMouseJiggler* hid_mouse_jiggler);
|
||||
|
||||
void hid_mouse_jiggler_set_connected_status(HidMouseJiggler* hid_mouse_jiggler, bool connected);
|
||||
@@ -82,8 +82,14 @@ void ws_view_receiver_info_draw(Canvas* canvas, WSReceiverInfoModel* model) {
|
||||
if(model->generic->temp != WS_NO_TEMPERATURE) {
|
||||
canvas_draw_icon(canvas, 6, 43, &I_Therm_7x16);
|
||||
snprintf(buffer, sizeof(buffer), "%3.1f C", (double)model->generic->temp);
|
||||
canvas_draw_str_aligned(canvas, 47, 47, AlignRight, AlignTop, buffer);
|
||||
canvas_draw_circle(canvas, 38, 46, 1);
|
||||
uint8_t temp_x1 = 47;
|
||||
uint8_t temp_x2 = 38;
|
||||
if(model->generic->temp < -9.0) {
|
||||
temp_x1 = 49;
|
||||
temp_x2 = 40;
|
||||
}
|
||||
canvas_draw_str_aligned(canvas, temp_x1, 47, AlignRight, AlignTop, buffer);
|
||||
canvas_draw_circle(canvas, temp_x2, 46, 1);
|
||||
}
|
||||
|
||||
if(model->generic->humidity != WS_NO_HUMIDITY) {
|
||||
|
||||
@@ -52,6 +52,7 @@ struct AnimationManager {
|
||||
FuriString* freezed_animation_name;
|
||||
int32_t freezed_animation_time_left;
|
||||
ViewStack* view_stack;
|
||||
bool dummy_mode;
|
||||
};
|
||||
|
||||
static StorageAnimation*
|
||||
@@ -93,6 +94,12 @@ void animation_manager_set_interact_callback(
|
||||
animation_manager->interact_callback = callback;
|
||||
}
|
||||
|
||||
void animation_manager_set_dummy_mode_state(AnimationManager* animation_manager, bool enabled) {
|
||||
furi_assert(animation_manager);
|
||||
animation_manager->dummy_mode = enabled;
|
||||
animation_manager_start_new_idle(animation_manager);
|
||||
}
|
||||
|
||||
static void animation_manager_check_blocking_callback(const void* message, void* context) {
|
||||
const StorageEvent* storage_event = message;
|
||||
|
||||
@@ -363,7 +370,9 @@ static bool animation_manager_is_valid_idle_animation(
|
||||
|
||||
static StorageAnimation*
|
||||
animation_manager_select_idle_animation(AnimationManager* animation_manager) {
|
||||
UNUSED(animation_manager);
|
||||
if(animation_manager->dummy_mode) {
|
||||
return animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
|
||||
}
|
||||
StorageAnimationList_t animation_list;
|
||||
StorageAnimationList_init(animation_list);
|
||||
animation_storage_fill_animation_list(&animation_list);
|
||||
|
||||
@@ -157,3 +157,11 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
|
||||
* @animation_manager instance
|
||||
*/
|
||||
void animation_manager_load_and_continue_animation(AnimationManager* animation_manager);
|
||||
|
||||
/**
|
||||
* Enable or disable dummy mode backgrounds of animation manager.
|
||||
*
|
||||
* @animation_manager instance
|
||||
* @enabled bool
|
||||
*/
|
||||
void animation_manager_set_dummy_mode_state(AnimationManager* animation_manager, bool enabled);
|
||||
|
||||
@@ -144,6 +144,7 @@ void desktop_unlock(Desktop* desktop) {
|
||||
void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) {
|
||||
view_port_enabled_set(desktop->dummy_mode_icon_viewport, enabled);
|
||||
desktop_main_set_dummy_mode_state(desktop->main_view, enabled);
|
||||
animation_manager_set_dummy_mode_state(desktop->animation_manager, enabled);
|
||||
desktop->settings.dummy_mode = enabled;
|
||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||
}
|
||||
@@ -330,6 +331,8 @@ int32_t desktop_srv(void* p) {
|
||||
|
||||
view_port_enabled_set(desktop->dummy_mode_icon_viewport, desktop->settings.dummy_mode);
|
||||
desktop_main_set_dummy_mode_state(desktop->main_view, desktop->settings.dummy_mode);
|
||||
animation_manager_set_dummy_mode_state(
|
||||
desktop->animation_manager, desktop->settings.dummy_mode);
|
||||
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ FEE470A4CB58
|
||||
1F1A0A111B5B
|
||||
1F1FFE000000
|
||||
2031D1E57A3B
|
||||
# HID Key B
|
||||
204752454154
|
||||
21A600056CB0
|
||||
22729A9BD40F
|
||||
@@ -292,6 +293,7 @@ FEE470A4CB58
|
||||
45635EF66EF3
|
||||
476242304C53
|
||||
484558414354
|
||||
# HID Key A
|
||||
484944204953
|
||||
484A57696F4A
|
||||
48734389EDC3
|
||||
@@ -1226,6 +1228,7 @@ C41514DEFC07
|
||||
ABFEDC124578
|
||||
046154274C11
|
||||
5429D67E1F57
|
||||
# SMARTair Key B
|
||||
E7316853E731
|
||||
CD7FFFF81C4A
|
||||
F253C30568C4
|
||||
@@ -1308,4 +1311,4 @@ CE99FBC8BD26
|
||||
|
||||
# PIK Comfort Moscow keys (ISBC Mifare Plus SE 1K)
|
||||
009FB42D98ED
|
||||
002E626E2820
|
||||
002E626E2820
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
## From https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/iclass_default_keys.dic
|
||||
|
||||
# AA1
|
||||
AEA684A6DAB23278
|
||||
# key1/Kc from PicoPass 2k documentation
|
||||
7665544332211000
|
||||
# SAGEM
|
||||
0123456789ABCDEF
|
||||
# from loclass demo file.
|
||||
5b7c62c491c11b39
|
||||
# Kd from PicoPass 2k documentation
|
||||
F0E1D2C3B4A59687
|
||||
# PicoPass Default Exchange Key
|
||||
5CBCF1DA45D5FB4F
|
||||
# From HID multiclassSE reader
|
||||
31ad7ebd2f282168
|
||||
# From pastebin: https://pastebin.com/uHqpjiuU
|
||||
6EFD46EFCBB3C875
|
||||
E033CA419AEE43F9
|
||||
|
||||
# iCopy-x DRM keys
|
||||
# iCL tags
|
||||
2020666666668888
|
||||
# iCS tags reversed from the SOs
|
||||
6666202066668888
|
||||
|
||||
# default picopass KD / Page 0 / Book 1
|
||||
FDCB5A52EA8F3090
|
||||
237FF9079863DF44
|
||||
5ADC25FB27181D32
|
||||
83B881F2936B2E49
|
||||
43644E61EE866BA5
|
||||
897034143D016080
|
||||
82D17B44C0122963
|
||||
4895CA7DE65E2025
|
||||
DADAD4C57BE271B7
|
||||
E41E9EDEF5719ABF
|
||||
293D275EC3AF9C7F
|
||||
C3C169251B8A70FB
|
||||
F41DAF58B20C8B91
|
||||
28877A609EC0DD2B
|
||||
66584C91EE80D5E5
|
||||
C1B74D7478053AE2
|
||||
|
||||
# default iCLASS RFIDeas
|
||||
6B65797374726B72
|
||||
Reference in New Issue
Block a user