mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 09:48:35 -07:00
Merge branch 'dev' of https://github.com/Flipper-XFW/Xtreme-Firmware into new-app-system
This commit is contained in:
@@ -20,7 +20,7 @@ void power_settings_scene_power_off_on_enter(void* context) {
|
||||
dialog, " I will be\nwaiting for\n you here", 78, 16, AlignLeft, AlignTop);
|
||||
}
|
||||
dialog_ex_set_icon(dialog, 21, 13, &I_Cry_dolph_55x52);
|
||||
dialog_ex_set_left_button_text(dialog, "Back");
|
||||
dialog_ex_set_left_button_text(dialog, "Battery");
|
||||
dialog_ex_set_right_button_text(dialog, "OFF");
|
||||
dialog_ex_set_result_callback(dialog, power_settings_scene_power_off_dialog_callback);
|
||||
dialog_ex_set_context(dialog, app);
|
||||
@@ -34,10 +34,7 @@ bool power_settings_scene_power_off_on_event(void* context, SceneManagerEvent ev
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == DialogExResultLeft) {
|
||||
if(!scene_manager_previous_scene(app->scene_manager)) {
|
||||
scene_manager_stop(app->scene_manager);
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
}
|
||||
scene_manager_next_scene(app->scene_manager, PowerSettingsAppSceneBatteryInfo);
|
||||
} else if(event.event == DialogExResultRight) {
|
||||
power_off(app->power);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,10 @@ static bool battery_info_input_callback(InputEvent* event, void* context) {
|
||||
|
||||
BatteryInfo* battery_info = context;
|
||||
|
||||
if(event->type == InputTypeShort) {
|
||||
bool about_battery;
|
||||
with_view_model(
|
||||
battery_info->view, BatteryInfoModel * model, { about_battery = model->alt; }, false);
|
||||
if(about_battery && event->type == InputTypeShort) {
|
||||
if(event->key == InputKeyLeft) {
|
||||
event->key = InputKeyBack;
|
||||
} else if(event->key == InputKeyRight) {
|
||||
|
||||
@@ -22,6 +22,7 @@ typedef struct {
|
||||
bool left_mouse_held;
|
||||
bool right_mouse_pressed;
|
||||
bool connected;
|
||||
uint8_t acceleration;
|
||||
HidTransport transport;
|
||||
} HidMouseModel;
|
||||
|
||||
@@ -119,6 +120,11 @@ static void hid_mouse_process(HidMouse* hid_mouse, InputEvent* event) {
|
||||
hid_mouse->view,
|
||||
HidMouseModel * model,
|
||||
{
|
||||
model->acceleration = (event->type == InputTypePress) ? 1 :
|
||||
(event->type == InputTypeRelease) ? 0 :
|
||||
(model->acceleration >= 20) ? 20 :
|
||||
model->acceleration + 1;
|
||||
|
||||
if(event->key == InputKeyBack) {
|
||||
if(event->type == InputTypeShort) {
|
||||
hid_hal_mouse_press(hid_mouse->hid, HID_MOUSE_BTN_RIGHT);
|
||||
@@ -150,7 +156,8 @@ static void hid_mouse_process(HidMouse* hid_mouse, InputEvent* event) {
|
||||
model->right_pressed = true;
|
||||
hid_hal_mouse_move(hid_mouse->hid, MOUSE_MOVE_SHORT, 0);
|
||||
} else if(event->type == InputTypeRepeat) {
|
||||
hid_hal_mouse_move(hid_mouse->hid, MOUSE_MOVE_LONG, 0);
|
||||
for(uint8_t i = model->acceleration; i > 1; i -= 2)
|
||||
hid_hal_mouse_move(hid_mouse->hid, MOUSE_MOVE_LONG, 0);
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
model->right_pressed = false;
|
||||
}
|
||||
@@ -159,7 +166,8 @@ static void hid_mouse_process(HidMouse* hid_mouse, InputEvent* event) {
|
||||
model->left_pressed = true;
|
||||
hid_hal_mouse_move(hid_mouse->hid, -MOUSE_MOVE_SHORT, 0);
|
||||
} else if(event->type == InputTypeRepeat) {
|
||||
hid_hal_mouse_move(hid_mouse->hid, -MOUSE_MOVE_LONG, 0);
|
||||
for(uint8_t i = model->acceleration; i > 1; i -= 2)
|
||||
hid_hal_mouse_move(hid_mouse->hid, -MOUSE_MOVE_LONG, 0);
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
model->left_pressed = false;
|
||||
}
|
||||
@@ -168,7 +176,9 @@ static void hid_mouse_process(HidMouse* hid_mouse, InputEvent* event) {
|
||||
model->down_pressed = true;
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, MOUSE_MOVE_SHORT);
|
||||
} else if(event->type == InputTypeRepeat) {
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, MOUSE_MOVE_LONG);
|
||||
for(uint8_t i = model->acceleration; i > 1; i -= 2)
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, MOUSE_MOVE_LONG);
|
||||
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
model->down_pressed = false;
|
||||
}
|
||||
@@ -177,7 +187,8 @@ static void hid_mouse_process(HidMouse* hid_mouse, InputEvent* event) {
|
||||
model->up_pressed = true;
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, -MOUSE_MOVE_SHORT);
|
||||
} else if(event->type == InputTypeRepeat) {
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, -MOUSE_MOVE_LONG);
|
||||
for(uint8_t i = model->acceleration; i > 1; i -= 2)
|
||||
hid_hal_mouse_move(hid_mouse->hid, 0, -MOUSE_MOVE_LONG);
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
model->up_pressed = false;
|
||||
}
|
||||
|
||||
@@ -201,21 +201,30 @@ bool subrem_view_remote_input(InputEvent* event, void* context) {
|
||||
furi_assert(context);
|
||||
SubRemViewRemote* subrem_view_remote = context;
|
||||
|
||||
if(event->key == InputKeyBack && event->type == InputTypeLong) {
|
||||
subrem_view_remote->callback(SubRemCustomEventViewRemoteBack, subrem_view_remote->context);
|
||||
return true;
|
||||
} else if(event->key == InputKeyBack && event->type == InputTypeShort) {
|
||||
if(event->key == InputKeyBack && event->type == InputTypePress) {
|
||||
bool is_stopping = false;
|
||||
with_view_model(
|
||||
subrem_view_remote->view,
|
||||
SubRemViewRemoteModel * model,
|
||||
{ model->pressed_btn = 0; },
|
||||
{
|
||||
if(model->state == SubRemViewRemoteStateSending) {
|
||||
is_stopping = true;
|
||||
model->pressed_btn = 0;
|
||||
}
|
||||
},
|
||||
true);
|
||||
subrem_view_remote->callback(
|
||||
SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context);
|
||||
return true;
|
||||
} else if(event->key == InputKeyBack) {
|
||||
|
||||
//Cant send exit the app inside that with_model,locks the model and the app will hang and not unload!
|
||||
if(is_stopping)
|
||||
subrem_view_remote->callback(
|
||||
SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context);
|
||||
else
|
||||
subrem_view_remote->callback(
|
||||
SubRemCustomEventViewRemoteBack, subrem_view_remote->context);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// BACK button processing end
|
||||
|
||||
if(event->key == InputKeyUp && event->type == InputTypePress) {
|
||||
|
||||
Reference in New Issue
Block a user