mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
subghz + bt
This commit is contained in:
@@ -15,11 +15,7 @@
|
||||
<details>
|
||||
<summary><B>TO DO</b></summary><br/>
|
||||
|
||||
- SubGHz: [Add settings to subghz read functionality to allow setting RSSI threshold (raw only) (By PolymerPrints)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/184)
|
||||
- [Decode RAW recordings #1667 (By qistoph)](https://github.com/flipperdevices/flipperzero-firmware/pull/1667)
|
||||
- [SubGhz: fix display information in the file if the frequenc… #1724 (By Skorpionm)](https://github.com/flipperdevices/flipperzero-firmware/pull/1724)
|
||||
- Settings: Rename from SD `dolphin/name.txt` [(Thanks to E_Surge)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/259)
|
||||
- [Keynote BT plugin: long press on OK to switch between Space and Retur… #1729 (By coded-with-claws)](https://github.com/flipperdevices/flipperzero-firmware/pull/1729)
|
||||
- Lost To Faps: Settings: Favorite Game by holding UP on Desktop [Thanks to gotnull](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/57)
|
||||
- Lost To Faps: Settings: Hold Down for Games Menu [(Thanks to ESurge)](https://github.com/ESurge/flipperzero-firmware-wPlugins)
|
||||
|
||||
@@ -159,7 +155,6 @@ $ ./fbt plugin_dist FIRMWARE_APP_SET=ext_apps
|
||||
- [Fix Mifare Classic 4K reading of the last 8 sectors #1712 (By Astrrra)](https://github.com/flipperdevices/flipperzero-firmware/pull/1712)
|
||||
- [Keynote BT plugin: long press on OK to switch between Space and Retur… #1729 (By coded-with-claws)](https://github.com/flipperdevices/flipperzero-firmware/pull/1729)
|
||||
- [RFID: fix read info screen #1723 (By nminaylov)](https://github.com/flipperdevices/flipperzero-firmware/pull/1723)
|
||||
- [SubGhz: fix display information in the file if the frequenc… #1724 (By Skorpionm)](https://github.com/flipperdevices/flipperzero-firmware/pull/1724)
|
||||
- [Show error popup when NFC chip is not init/disconnected #1722 (By Astrrra)](https://github.com/flipperdevices/flipperzero-firmware/pull/1722)
|
||||
- [dummy mode #1739 (By nminaylov)](https://github.com/flipperdevices/flipperzero-firmware/pull/1739)
|
||||
- [picopass se identify #1701 (By bettse/pcunning)](https://github.com/flipperdevices/flipperzero-firmware/pull/1701)
|
||||
|
||||
@@ -47,7 +47,6 @@ typedef enum {
|
||||
SubGhzLoadKeyStateUnknown,
|
||||
SubGhzLoadKeyStateOK,
|
||||
SubGhzLoadKeyStateParseErr,
|
||||
SubGhzLoadKeyStateOnlyRx,
|
||||
} SubGhzLoadKeyState;
|
||||
|
||||
/** SubGhzLock */
|
||||
|
||||
@@ -278,11 +278,6 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!furi_hal_subghz_is_tx_allowed(temp_data32)) {
|
||||
FURI_LOG_E(TAG, "This frequency can only be used for RX");
|
||||
load_key_state = SubGhzLoadKeyStateOnlyRx;
|
||||
break;
|
||||
}
|
||||
subghz->txrx->preset->frequency = temp_data32;
|
||||
|
||||
if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) {
|
||||
@@ -354,12 +349,6 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
}
|
||||
return false;
|
||||
|
||||
case SubGhzLoadKeyStateOnlyRx:
|
||||
if(show_dialog) {
|
||||
subghz_dialog_message_show_only_rx(subghz);
|
||||
}
|
||||
return false;
|
||||
|
||||
case SubGhzLoadKeyStateOK:
|
||||
return true;
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
#include <furi_hal_usb_hid.h>
|
||||
#include <gui/elements.h>
|
||||
|
||||
const char* bt_hid_hold_exit = "Hold : exit";
|
||||
const char* bt_hid_hold_space = "Hold : space";
|
||||
const char* bt_hid_hold_enter = "Hold : enter";
|
||||
const char* bt_hid_space_btn = "Space";
|
||||
const char* bt_hid_enter_btn = "Enter";
|
||||
|
||||
struct BtHidKeynote {
|
||||
View* view;
|
||||
};
|
||||
@@ -16,6 +22,7 @@ typedef struct {
|
||||
bool ok_pressed;
|
||||
bool back_pressed;
|
||||
bool connected;
|
||||
bool switch_space_return;
|
||||
} BtHidKeynoteModel;
|
||||
|
||||
static void bt_hid_keynote_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
|
||||
@@ -44,9 +51,18 @@ static void bt_hid_keynote_draw_callback(Canvas* canvas, void* context) {
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keynote");
|
||||
|
||||
canvas_draw_icon(canvas, 68, 2, &I_Pin_back_arrow_10x8);
|
||||
// Hold instructions
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
elements_multiline_text_aligned(canvas, 127, 3, AlignRight, AlignTop, "Hold to exit");
|
||||
elements_multiline_text_aligned(canvas, 68, 3, AlignLeft, AlignTop, bt_hid_hold_exit);
|
||||
canvas_draw_icon(canvas, 87, 2, &I_Pin_back_arrow_10x8);
|
||||
const char* bt_hid_hold_btn;
|
||||
if(!model->switch_space_return) {
|
||||
bt_hid_hold_btn = bt_hid_hold_enter;
|
||||
} else {
|
||||
bt_hid_hold_btn = bt_hid_hold_space;
|
||||
}
|
||||
elements_multiline_text_aligned(canvas, 68, 12, AlignLeft, AlignTop, bt_hid_hold_btn);
|
||||
canvas_draw_icon(canvas, 87, 11, &I_Ok_btn_9x9);
|
||||
|
||||
// Up
|
||||
canvas_draw_icon(canvas, 21, 24, &I_Button_18x18);
|
||||
@@ -91,7 +107,13 @@ static void bt_hid_keynote_draw_callback(Canvas* canvas, void* context) {
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9);
|
||||
elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Space");
|
||||
const char* bt_hid_btn;
|
||||
if(!model->switch_space_return) {
|
||||
bt_hid_btn = bt_hid_space_btn;
|
||||
} else {
|
||||
bt_hid_btn = bt_hid_enter_btn;
|
||||
}
|
||||
elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, bt_hid_btn);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
|
||||
// Back
|
||||
@@ -122,7 +144,6 @@ static void bt_hid_keynote_process(BtHidKeynote* bt_hid_keynote, InputEvent* eve
|
||||
furi_hal_bt_hid_kb_press(HID_KEYBOARD_RIGHT_ARROW);
|
||||
} else if(event->key == InputKeyOk) {
|
||||
model->ok_pressed = true;
|
||||
furi_hal_bt_hid_kb_press(HID_KEYBOARD_SPACEBAR);
|
||||
} else if(event->key == InputKeyBack) {
|
||||
model->back_pressed = true;
|
||||
}
|
||||
@@ -141,7 +162,6 @@ static void bt_hid_keynote_process(BtHidKeynote* bt_hid_keynote, InputEvent* eve
|
||||
furi_hal_bt_hid_kb_release(HID_KEYBOARD_RIGHT_ARROW);
|
||||
} else if(event->key == InputKeyOk) {
|
||||
model->ok_pressed = false;
|
||||
furi_hal_bt_hid_kb_release(HID_KEYBOARD_SPACEBAR);
|
||||
} else if(event->key == InputKeyBack) {
|
||||
model->back_pressed = false;
|
||||
}
|
||||
@@ -152,6 +172,15 @@ static void bt_hid_keynote_process(BtHidKeynote* bt_hid_keynote, InputEvent* eve
|
||||
furi_hal_bt_hid_consumer_key_press(HID_CONSUMER_AC_BACK);
|
||||
furi_hal_bt_hid_consumer_key_release(HID_CONSUMER_AC_BACK);
|
||||
}
|
||||
if(event->key == InputKeyOk) {
|
||||
if(!model->switch_space_return) {
|
||||
furi_hal_bt_hid_kb_press(HID_KEYBOARD_SPACEBAR);
|
||||
furi_hal_bt_hid_kb_release(HID_KEYBOARD_SPACEBAR);
|
||||
} else {
|
||||
furi_hal_bt_hid_kb_press(HID_KEYBOARD_RETURN);
|
||||
furi_hal_bt_hid_kb_release(HID_KEYBOARD_RETURN);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@@ -164,6 +193,12 @@ static bool bt_hid_keynote_input_callback(InputEvent* event, void* context) {
|
||||
|
||||
if(event->type == InputTypeLong && event->key == InputKeyBack) {
|
||||
furi_hal_bt_hid_kb_release_all();
|
||||
} else if(event->type == InputTypeLong && event->key == InputKeyOk) {
|
||||
with_view_model(
|
||||
bt_hid_keynote->view, (BtHidKeynoteModel * model) {
|
||||
model->switch_space_return = !model->switch_space_return;
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
bt_hid_keynote_process(bt_hid_keynote, event);
|
||||
consumed = true;
|
||||
|
||||
Reference in New Issue
Block a user