Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/dev' into hedger/toochai…
Browse files Browse the repository at this point in the history
…n_29

# Conflicts:
#	scripts/toolchain/fbtenv.sh
  • Loading branch information
hedger committed Feb 18, 2024
2 parents 01d937c + 4e1089e commit b38d2e8
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 45 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/reindex.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
name: 'Reindex'
name: 'Post-release hooks'

on:
release:
types: [prereleased,released]
types: [prereleased, released]

jobs:
reindex:
name: 'Reindex updates'
name: 'Post-release hooks'
runs-on: [self-hosted, FlipperZeroShell]
steps:
- name: Trigger reindex
- name: 'Checkout code'
uses: actions/checkout@v4

- name: 'Trigger reindex'
run: |
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
"${{ secrets.INDEXER_URL }}"/firmware/reindex
"${{ secrets.INDEXER_URL }}"/firmware/reindex;
- name: 'Send release notification'
if: ${{ github.event.action == 'released' }}
run: |
echo '${{ secrets.FIREBASE_TOKEN }}' > firebase-token.json;
python3 -m pip install firebase-admin==6.4.0;
python3 scripts/send_firebase_notification.py \
"--version=${{ github.event.release.name }}" \
"--token=firebase-token.json";
- name: 'Remove firebase token'
if: always()
run: |
rm -rf firebase-token.json;
Original file line number Diff line number Diff line change
Expand Up @@ -826,4 +826,28 @@ name: Mute
type: raw
frequency: 38000
duty_cycle: 0.33
data: 9011 4388 557 1617 532 1617 532 489 533 489 558 464 558 440 582 440 582 1593 556 466 556 466 556 1594 556 467 555 1595 555 1595 529 1620 554 1596 554 467 554 468 555 1595 579 443 581 1569 581 441 581 441 580 442 581 1569 581 1569 581 441 581 1569 580 441 581 1569 581 1569 581 1570 579 42152 8957 2159 556
data: 9011 4388 557 1617 532 1617 532 489 533 489 558 464 558 440 582 440 582 1593 556 466 556 466 556 1594 556 467 555 1595 555 1595 529 1620 554 1596 554 467 554 468 555 1595 579 443 581 1569 581 441 581 441 580 442 581 1569 581 1569 581 441 581 1569 580 441 581 1569 581 1569 581 1570 579 42152 8957 2159 556
# PLUS U5/V3-200R Standby
name: Power
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 9033 4255 562 543 564 1701 562 1674 563 567 565 541 564 567 565 567 537 1700 564 1700 537 568 564 1699 564 541 565 1699 565 540 565 567 565 570 535 567 565 567 565 1673 564 567 565 1673 564 567 565 540 618 514 565 1700 563 1674 564 567 564 1674 563 569 563 1672 565 1700 589 1648 564
# PLUS U5/V3-200R Mute
name: Mute
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 9034 4255 564 567 564 1671 566 1699 564 540 565 567 565 540 564 566 566 1699 563 1672 567 565 566 1673 565 567 565 1672 565 566 566 539 565 567 565 1698 539 566 566 1698 564 541 565 565 567 1672 565 566 566 1672 565 567 565 1699 538 566 566 1698 564 1673 566 566 565 1672 566 566 566
# PLUS U5/V3-200R 1/Volume up
name: Vol_up
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 9035 4254 565 566 565 1672 566 1699 564 539 567 566 566 540 564 567 565 1698 539 1698 566 566 564 1673 565 566 565 1672 565 566 566 539 566 566 566 567 563 541 565 566 566 538 566 566 566 1671 566 566 566 1697 565 1675 563 1699 563 1674 565 1699 538 1700 564 565 565 1674 564 567 565
# PLUS U5/V3-200R 3/Volume down
name: Vol_dn
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 9010 4253 564 566 566 1671 566 1699 565 565 539 568 564 566 565 539 566 1699 565 1672 565 566 566 1672 564 567 565 1672 565 567 565 567 564 541 564 1698 566 539 565 567 565 567 562 542 565 1699 564 539 567 1699 565 540 564 1698 566 1672 565 1698 566 1672 565 567 565 1671 565 566 566
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 42 additions & 38 deletions applications/system/hid_app/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "views.h"
#include <notification/notification_messages.h>
#include <dolphin/dolphin.h>
#include "hid_icons.h"

#define TAG "HidApp"

Expand All @@ -19,7 +20,22 @@ enum HidDebugSubmenuIndex {
HidSubmenuIndexRemovePairing,
};

static void bt_hid_remove_pairing(Bt* bt) {
bool hid_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
Hid* app = context;
return scene_manager_handle_custom_event(app->scene_manager, event);
}

bool hid_back_event_callback(void* context) {
furi_assert(context);
Hid* app = context;
FURI_LOG_D("HID", "Back event");
scene_manager_next_scene(app->scene_manager, HidSceneExitConfirm);
return true;
}

void bt_hid_remove_pairing(Hid* app) {
Bt* bt = app->bt;
bt_disconnect(bt);

// Wait 2nd core to update nvm storage
Expand Down Expand Up @@ -62,7 +78,7 @@ static void hid_submenu_callback(void* context, uint32_t index) {
app->view_id = HidViewMouseJiggler;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseJiggler);
} else if(index == HidSubmenuIndexRemovePairing) {
bt_hid_remove_pairing(app->bt);
scene_manager_next_scene(app->scene_manager, HidSceneUnpair);
}
}

Expand All @@ -86,23 +102,6 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
hid_tiktok_set_connected_status(hid->hid_tiktok, connected);
}

static void hid_dialog_callback(DialogExResult result, void* context) {
furi_assert(context);
Hid* app = context;
if(result == DialogExResultLeft) {
view_dispatcher_stop(app->view_dispatcher);
} else if(result == DialogExResultRight) {
view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id); // Show last view
} else if(result == DialogExResultCenter) {
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu);
}
}

static uint32_t hid_exit_confirm_view(void* context) {
UNUSED(context);
return HidViewExitConfirm;
}

static uint32_t hid_exit(void* context) {
UNUSED(context);
return VIEW_NONE;
Expand All @@ -124,6 +123,12 @@ Hid* hid_alloc() {
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
view_dispatcher_set_navigation_event_callback(app->view_dispatcher, hid_back_event_callback);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);

// Scene Manager
app->scene_manager = scene_manager_alloc(&hid_scene_handlers, app);

// Device Type Submenu view
app->device_type_submenu = submenu_alloc();
submenu_add_item(
Expand Down Expand Up @@ -172,67 +177,55 @@ Hid* hid_alloc() {
view_dispatcher_add_view(
app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->device_type_submenu));
app->view_id = HidViewSubmenu;
view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id);
return app;
}

Hid* hid_app_alloc_view(void* context) {
furi_assert(context);
Hid* app = context;

// Dialog view
app->dialog = dialog_ex_alloc();
dialog_ex_set_result_callback(app->dialog, hid_dialog_callback);
dialog_ex_set_context(app->dialog, app);
dialog_ex_set_left_button_text(app->dialog, "Exit");
dialog_ex_set_right_button_text(app->dialog, "Stay");
dialog_ex_set_center_button_text(app->dialog, "Menu");
dialog_ex_set_header(app->dialog, "Close Current App?", 16, 12, AlignLeft, AlignTop);
view_dispatcher_add_view(
app->view_dispatcher, HidViewExitConfirm, dialog_ex_get_view(app->dialog));
view_dispatcher_add_view(app->view_dispatcher, HidViewDialog, dialog_ex_get_view(app->dialog));

// Popup view
app->popup = popup_alloc();
view_dispatcher_add_view(app->view_dispatcher, HidViewPopup, popup_get_view(app->popup));

// Keynote view
app->hid_keynote = hid_keynote_alloc(app);
view_set_previous_callback(hid_keynote_get_view(app->hid_keynote), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewKeynote, hid_keynote_get_view(app->hid_keynote));

// Keyboard view
app->hid_keyboard = hid_keyboard_alloc(app);
view_set_previous_callback(hid_keyboard_get_view(app->hid_keyboard), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewKeyboard, hid_keyboard_get_view(app->hid_keyboard));

// Media view
app->hid_media = hid_media_alloc(app);
view_set_previous_callback(hid_media_get_view(app->hid_media), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewMedia, hid_media_get_view(app->hid_media));

// TikTok view
app->hid_tiktok = hid_tiktok_alloc(app);
view_set_previous_callback(hid_tiktok_get_view(app->hid_tiktok), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, BtHidViewTikTok, hid_tiktok_get_view(app->hid_tiktok));

// Mouse view
app->hid_mouse = hid_mouse_alloc(app);
view_set_previous_callback(hid_mouse_get_view(app->hid_mouse), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewMouse, hid_mouse_get_view(app->hid_mouse));

// Mouse clicker view
app->hid_mouse_clicker = hid_mouse_clicker_alloc(app);
view_set_previous_callback(
hid_mouse_clicker_get_view(app->hid_mouse_clicker), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher,
HidViewMouseClicker,
hid_mouse_clicker_get_view(app->hid_mouse_clicker));

// 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,
Expand All @@ -251,8 +244,10 @@ void hid_free(Hid* app) {
// Free views
view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
submenu_free(app->device_type_submenu);
view_dispatcher_remove_view(app->view_dispatcher, HidViewExitConfirm);
view_dispatcher_remove_view(app->view_dispatcher, HidViewDialog);
dialog_ex_free(app->dialog);
view_dispatcher_remove_view(app->view_dispatcher, HidViewPopup);
popup_free(app->popup);
view_dispatcher_remove_view(app->view_dispatcher, HidViewKeynote);
hid_keynote_free(app->hid_keynote);
view_dispatcher_remove_view(app->view_dispatcher, HidViewKeyboard);
Expand All @@ -267,6 +262,7 @@ void hid_free(Hid* app) {
hid_mouse_jiggler_free(app->hid_mouse_jiggler);
view_dispatcher_remove_view(app->view_dispatcher, BtHidViewTikTok);
hid_tiktok_free(app->hid_tiktok);
scene_manager_free(app->scene_manager);
view_dispatcher_free(app->view_dispatcher);

// Close records
Expand All @@ -285,6 +281,8 @@ int32_t hid_usb_app(void* p) {
UNUSED(p);
Hid* app = hid_alloc();
app = hid_app_alloc_view(app);
FURI_LOG_D("HID", "Starting as USB app");

FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
furi_hal_usb_unlock();
furi_check(furi_hal_usb_set_config(&usb_hid, NULL) == true);
Expand All @@ -293,6 +291,8 @@ int32_t hid_usb_app(void* p) {

dolphin_deed(DolphinDeedPluginStart);

scene_manager_next_scene(app->scene_manager, HidSceneMain);

view_dispatcher_run(app->view_dispatcher);

furi_hal_usb_set_config(usb_mode_prev, NULL);
Expand All @@ -307,6 +307,8 @@ int32_t hid_ble_app(void* p) {
Hid* app = hid_alloc();
app = hid_app_alloc_view(app);

FURI_LOG_D("HID", "Starting as BLE app");

bt_disconnect(app->bt);

// Wait 2nd core to update nvm storage
Expand All @@ -333,6 +335,8 @@ int32_t hid_ble_app(void* p) {

dolphin_deed(DolphinDeedPluginStart);

scene_manager_next_scene(app->scene_manager, HidSceneMain);

view_dispatcher_run(app->view_dispatcher);

bt_set_status_changed_callback(app->bt, NULL, NULL);
Expand Down
6 changes: 6 additions & 0 deletions applications/system/hid_app/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <gui/gui.h>
#include <gui/view.h>
#include <gui/view_dispatcher.h>
#include <gui/scene_manager.h>
#include <notification/notification.h>
#include <storage/storage.h>

Expand All @@ -25,6 +26,8 @@
#include "views/hid_mouse_jiggler.h"
#include "views/hid_tiktok.h"

#include "scenes/hid_scene.h"

#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys"

typedef enum {
Expand All @@ -40,8 +43,10 @@ struct Hid {
Gui* gui;
NotificationApp* notifications;
ViewDispatcher* view_dispatcher;
SceneManager* scene_manager;
Submenu* device_type_submenu;
DialogEx* dialog;
Popup* popup;
HidKeynote* hid_keynote;
HidKeyboard* hid_keyboard;
HidMedia* hid_media;
Expand All @@ -53,6 +58,7 @@ struct Hid {
HidTransport transport;
uint32_t view_id;
};
void bt_hid_remove_pairing(Hid* app);

void hid_hal_keyboard_press(Hid* instance, uint16_t event);
void hid_hal_keyboard_release(Hid* instance, uint16_t event);
Expand Down
30 changes: 30 additions & 0 deletions applications/system/hid_app/scenes/hid_scene.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "hid_scene.h"

// Generate scene on_enter handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
void (*const hid_on_enter_handlers[])(void*) = {
#include "hid_scene_config.h"
};
#undef ADD_SCENE

// Generate scene on_event handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
bool (*const hid_on_event_handlers[])(void* context, SceneManagerEvent event) = {
#include "hid_scene_config.h"
};
#undef ADD_SCENE

// Generate scene on_exit handlers array
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
void (*const hid_on_exit_handlers[])(void* context) = {
#include "hid_scene_config.h"
};
#undef ADD_SCENE

// Initialize scene handlers configuration structure
const SceneManagerHandlers hid_scene_handlers = {
.on_enter_handlers = hid_on_enter_handlers,
.on_event_handlers = hid_on_event_handlers,
.on_exit_handlers = hid_on_exit_handlers,
.scene_num = HidSceneNum,
};
29 changes: 29 additions & 0 deletions applications/system/hid_app/scenes/hid_scene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include <gui/scene_manager.h>

// Generate scene id and total number
#define ADD_SCENE(prefix, name, id) HidScene##id,
typedef enum {
#include "hid_scene_config.h"
HidSceneNum,
} HidScene;
#undef ADD_SCENE

extern const SceneManagerHandlers hid_scene_handlers;

// Generate scene on_enter handlers declaration
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
#include "hid_scene_config.h"
#undef ADD_SCENE

// Generate scene on_event handlers declaration
#define ADD_SCENE(prefix, name, id) \
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
#include "hid_scene_config.h"
#undef ADD_SCENE

// Generate scene on_exit handlers declaration
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
#include "hid_scene_config.h"
#undef ADD_SCENE
3 changes: 3 additions & 0 deletions applications/system/hid_app/scenes/hid_scene_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ADD_SCENE(hid, main, Main)
ADD_SCENE(hid, unpair, Unpair)
ADD_SCENE(hid, exit_confirm, ExitConfirm)
Loading

0 comments on commit b38d2e8

Please sign in to comment.