Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
MX 2023-04-29 21:41:43 +03:00
commit d1456929ec
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
14 changed files with 86 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -21,6 +21,7 @@ typedef struct {
bool down_pressed;
bool ok_pressed;
bool connected;
bool back_pressed;
HidTransport transport;
} HidMediaModel;
@ -55,61 +56,72 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
canvas_set_font(canvas, FontSecondary);
// Keypad circles
canvas_draw_icon(canvas, 76, 8, &I_Circles_47x47);
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 93, 9, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 96, 12, &I_Volup_8x6);
canvas_draw_icon(canvas, 79, 9, &I_Volup_8x6);
canvas_set_color(canvas, ColorBlack);
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 93, 41, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 96, 45, &I_Voldwn_6x6);
canvas_draw_icon(canvas, 80, 41, &I_Voldwn_6x6);
canvas_set_color(canvas, ColorBlack);
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 77, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 82, 31, CanvasDirectionRightToLeft);
hid_media_draw_arrow(canvas, 86, 31, CanvasDirectionRightToLeft);
hid_media_draw_arrow(canvas, 65, 28, CanvasDirectionRightToLeft);
hid_media_draw_arrow(canvas, 70, 28, CanvasDirectionRightToLeft);
canvas_set_color(canvas, ColorBlack);
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 109, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 112, 31, CanvasDirectionLeftToRight);
hid_media_draw_arrow(canvas, 116, 31, CanvasDirectionLeftToRight);
hid_media_draw_arrow(canvas, 96, 28, CanvasDirectionLeftToRight);
hid_media_draw_arrow(canvas, 101, 28, CanvasDirectionLeftToRight);
canvas_set_color(canvas, ColorBlack);
// Ok
if(model->ok_pressed) {
canvas_draw_icon(canvas, 93, 25, &I_Pressed_Button_13x13);
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 96, 31, CanvasDirectionLeftToRight);
canvas_draw_line(canvas, 100, 29, 100, 33);
canvas_draw_line(canvas, 102, 29, 102, 33);
hid_media_draw_arrow(canvas, 80, 28, CanvasDirectionLeftToRight);
canvas_draw_line(canvas, 84, 26, 84, 30);
canvas_draw_line(canvas, 86, 26, 86, 30);
canvas_set_color(canvas, ColorBlack);
// Exit
if(model->back_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 111, 38, &I_Pin_back_arrow_10x10);
canvas_set_color(canvas, ColorBlack);
canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Hold to exit");
@ -135,6 +147,8 @@ static void hid_media_process_press(HidMedia* hid_media, InputEvent* event) {
} else if(event->key == InputKeyOk) {
model->ok_pressed = true;
hid_hal_consumer_key_press(hid_media->hid, HID_CONSUMER_PLAY_PAUSE);
} else if(event->key == InputKeyBack) {
model->back_pressed = true;
}
},
true);
@ -160,6 +174,8 @@ static void hid_media_process_release(HidMedia* hid_media, InputEvent* event) {
} else if(event->key == InputKeyOk) {
model->ok_pressed = false;
hid_hal_consumer_key_release(hid_media->hid, HID_CONSUMER_PLAY_PAUSE);
} else if(event->key == InputKeyBack) {
model->back_pressed = false;
}
},
true);
@ -176,12 +192,7 @@ static bool hid_media_input_callback(InputEvent* event, void* context) {
} else if(event->type == InputTypeRelease) {
hid_media_process_release(hid_media, event);
consumed = true;
} else if(event->type == InputTypeShort) {
if(event->key == InputKeyBack) {
hid_hal_consumer_key_release_all(hid_media->hid);
}
}
return consumed;
}

View file

@ -49,66 +49,66 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
}
// Keypad circles
canvas_draw_icon(canvas, 64, 8, &I_Circles_47x47);
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 81, 9, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 84, 10, &I_Pin_arrow_up_7x9);
canvas_draw_icon(canvas, 80, 8, &I_Pin_arrow_up_7x9);
canvas_set_color(canvas, ColorBlack);
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 81, 41, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 84, 43, &I_Pin_arrow_down_7x9);
canvas_draw_icon(canvas, 80, 40, &I_Pin_arrow_down_7x9);
canvas_set_color(canvas, ColorBlack);
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 65, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 67, 28, &I_Pin_arrow_left_9x7);
canvas_draw_icon(canvas, 63, 25, &I_Pin_arrow_left_9x7);
canvas_set_color(canvas, ColorBlack);
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 97, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 99, 28, &I_Pin_arrow_right_9x7);
canvas_draw_icon(canvas, 95, 25, &I_Pin_arrow_right_9x7);
canvas_set_color(canvas, ColorBlack);
// Ok
if(model->left_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 81, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 83, 27, &I_Left_mouse_icon_9x9);
canvas_draw_icon(canvas, 79, 24, &I_Left_mouse_icon_9x9);
canvas_set_color(canvas, ColorBlack);
// Back
if(model->right_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 108, 48, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 110, 50, &I_Right_mouse_icon_9x9);
canvas_draw_icon(canvas, 112, 38, &I_Right_mouse_icon_9x9);
canvas_set_color(canvas, ColorBlack);
}

View file

@ -41,64 +41,68 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
canvas_set_font(canvas, FontSecondary);
// Keypad circles
canvas_draw_icon(canvas, 66, 8, &I_Circles_47x47);
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
// Pause
if(model->back_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 106, 46, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 108, 48, &I_Pause_icon_9x9);
canvas_draw_icon(canvas, 113, 37, &I_Pause_icon_9x9);
canvas_set_color(canvas, ColorBlack);
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 83, 9, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 86, 11, &I_Arr_up_7x9);
canvas_draw_icon(canvas, 80, 8, &I_Arr_up_7x9);
canvas_set_color(canvas, ColorBlack);
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 83, 41, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 86, 44, &I_Arr_dwn_7x9);
canvas_draw_icon(canvas, 80, 40, &I_Arr_dwn_7x9);
canvas_set_color(canvas, ColorBlack);
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 67, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 71, 29, &I_Voldwn_6x6);
canvas_draw_icon(canvas, 64, 25, &I_Voldwn_6x6);
canvas_set_color(canvas, ColorBlack);
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 99, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 101, 29, &I_Volup_8x6);
canvas_draw_icon(canvas, 95, 25, &I_Volup_8x6);
canvas_set_color(canvas, ColorBlack);
// Ok
if(model->ok_pressed) {
canvas_draw_icon(canvas, 81, 23, &I_Like_pressed_17x17);
} else {
canvas_draw_icon(canvas, 84, 27, &I_Like_def_11x9);
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 78, 25, &I_Like_def_11x9);
canvas_set_color(canvas, ColorBlack);
// Exit
canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
@ -186,18 +190,18 @@ static bool hid_tiktok_input_callback(InputEvent* event, void* context) {
hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_LEFT);
consumed = true;
} else if(event->key == InputKeyDown) {
// Swipe to new video
// Swipe to previous video
hid_hal_mouse_scroll(hid_tiktok->hid, 19);
consumed = true;
} else if(event->key == InputKeyUp) {
// Swipe to previous video
// Swipe to new video
hid_hal_mouse_scroll(hid_tiktok->hid, -19);
consumed = true;
} else if(event->key == InputKeyBack) {
// Pause
hid_hal_mouse_press(hid_tiktok->hid, HID_MOUSE_BTN_RIGHT);
furi_delay_ms(25);
hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_RIGHT);
hid_hal_mouse_press(hid_tiktok->hid, HID_MOUSE_BTN_LEFT);
furi_delay_ms(50);
hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_LEFT);
consumed = true;
}
} else if(event->type == InputTypeLong) {

View file

@ -41,70 +41,75 @@ static void hid_ytshorts_draw_callback(Canvas* canvas, void* context) {
canvas_set_font(canvas, FontSecondary);
// Keypad circles
canvas_draw_icon(canvas, 66, 8, &I_Circles_47x47);
canvas_draw_icon(canvas, 58, 3, &I_OutCircles);
// Pause
if(model->back_mouse_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 106, 46, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 108, 48, &I_Pause_icon_9x9);
canvas_draw_icon(canvas, 113, 37, &I_Pause_icon_9x9);
canvas_set_color(canvas, ColorBlack);
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 83, 9, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 6, &I_S_UP);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 86, 11, &I_Arr_up_7x9);
canvas_draw_icon(canvas, 80, 8, &I_Arr_up_7x9);
canvas_set_color(canvas, ColorBlack);
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 83, 41, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 86, 44, &I_Arr_dwn_7x9);
canvas_draw_icon(canvas, 80, 40, &I_Arr_dwn_7x9);
canvas_set_color(canvas, ColorBlack);
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 67, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 71, 29, &I_Voldwn_6x6);
canvas_draw_icon(canvas, 64, 25, &I_Voldwn_6x6);
canvas_set_color(canvas, ColorBlack);
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 99, 25, &I_Pressed_Button_13x13);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 101, 29, &I_Volup_8x6);
canvas_draw_icon(canvas, 95, 25, &I_Volup_8x6);
canvas_set_color(canvas, ColorBlack);
// Ok
if(model->ok_pressed) {
canvas_draw_icon(canvas, 81, 23, &I_Like_pressed_17x17);
} else {
canvas_draw_icon(canvas, 84, 27, &I_Like_def_11x9);
canvas_set_bitmap_mode(canvas, 1);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 78, 25, &I_Like_def_11x9);
canvas_set_color(canvas, ColorBlack);
// Exit
canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Hold to exit");
}
static void hid_ytshorts_reset_cursor(HidYTShorts* hid_ytshorts) {
// Set cursor to the phone's left up corner
// Delays to guarantee one packet per connection interval