Skip to content

Commit 712ca8e

Browse files
committed
Mise à jour applications externes
1 parent b29f58b commit 712ca8e

File tree

90 files changed

+1478
-776
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1478
-776
lines changed

applications/external/airmouse/air_mouse.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum AirMouseSubmenuIndex {
1010
AirMouseSubmenuIndexBtMouse,
1111
AirMouseSubmenuIndexUsbMouse,
1212
AirMouseSubmenuIndexCalibration,
13+
AirMouseSubmenuIndexRemovePairing,
1314
};
1415

1516
void air_mouse_submenu_callback(void* context, uint32_t index) {
@@ -24,6 +25,8 @@ void air_mouse_submenu_callback(void* context, uint32_t index) {
2425
} else if(index == AirMouseSubmenuIndexCalibration) {
2526
app->view_id = AirMouseViewCalibration;
2627
view_dispatcher_switch_to_view(app->view_dispatcher, AirMouseViewCalibration);
28+
} else if(index == AirMouseSubmenuIndexRemovePairing) {
29+
bt_mouse_remove_pairing();
2730
}
2831
}
2932

@@ -78,6 +81,12 @@ AirMouse* air_mouse_app_alloc() {
7881
AirMouseSubmenuIndexCalibration,
7982
air_mouse_submenu_callback,
8083
app);
84+
submenu_add_item(
85+
app->submenu,
86+
"Effacer paires bluetooth",
87+
AirMouseSubmenuIndexRemovePairing,
88+
air_mouse_submenu_callback,
89+
app);
8190
view_set_previous_callback(submenu_get_view(app->submenu), air_mouse_exit);
8291
view_dispatcher_add_view(
8392
app->view_dispatcher, AirMouseViewSubmenu, submenu_get_view(app->submenu));

applications/external/airmouse/application.fam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ App(
66
stack_size=10 * 1024,
77
fap_category="GPIO",
88
fap_icon="mouse_10px.png",
9-
fap_version="0.9",
10-
sources=["*.c", "*.cc"],
9+
fap_version="1.1",
1110
fap_libs=["ble_profile"],
11+
sources=["*.c", "*.cc"],
1212
)

applications/external/airmouse/tracking/sensors/mean_filter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define CARDBOARD_SDK_SENSORS_MEAN_FILTER_H_
1818

1919
#include <deque>
20+
#include <cstddef>
2021

2122
#include "../util/vector.h"
2223

applications/external/airmouse/tracking/sensors/median_filter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define CARDBOARD_SDK_SENSORS_MEDIAN_FILTER_H_
1818

1919
#include <deque>
20+
#include <cstddef>
2021

2122
#include "../util/vector.h"
2223

applications/external/airmouse/views/bt_mouse.c

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33

44
#include <furi.h>
55
#include <furi_hal_bt.h>
6-
#include <extra_profiles/hid_profile.h>
76
#include <furi_hal_usb_hid.h>
7+
#include <profiles/serial_profile.h>
8+
#include <extra_profiles/hid_profile.h>
89
#include <bt/bt_service/bt.h>
910
#include <gui/elements.h>
1011
#include <notification/notification.h>
1112
#include <notification/notification_messages.h>
13+
#include <storage/storage.h>
1214

1315
typedef struct ButtonEvent {
1416
int8_t button;
@@ -18,10 +20,10 @@ typedef struct ButtonEvent {
1820
#define BTN_EVT_QUEUE_SIZE 32
1921

2022
struct BtMouse {
23+
FuriHalBleProfileBase* hid;
2124
View* view;
2225
ViewDispatcher* view_dispatcher;
2326
Bt* bt;
24-
FuriHalBleProfileBase* ble_hid_profile;
2527
NotificationApp* notifications;
2628
FuriMutex* mutex;
2729
FuriThread* thread;
@@ -41,12 +43,19 @@ struct BtMouse {
4143
ButtonEvent queue[BTN_EVT_QUEUE_SIZE];
4244
};
4345

46+
static const BleProfileHidParams ble_hid_params = {
47+
.device_name_prefix = "AirMouse",
48+
.mac_xor = 0x0001,
49+
};
50+
4451
#define BT_MOUSE_FLAG_INPUT_EVENT (1UL << 0)
4552
#define BT_MOUSE_FLAG_KILL_THREAD (1UL << 1)
4653
#define BT_MOUSE_FLAG_ALL (BT_MOUSE_FLAG_INPUT_EVENT | BT_MOUSE_FLAG_KILL_THREAD)
4754

4855
#define MOUSE_SCROLL 2
4956

57+
#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys"
58+
5059
static void bt_mouse_notify_event(BtMouse* bt_mouse) {
5160
FuriThreadId thread_id = furi_thread_get_id(bt_mouse->thread);
5261
furi_assert(thread_id);
@@ -119,7 +128,7 @@ static bool bt_mouse_input_callback(InputEvent* event, void* context) {
119128
bool consumed = false;
120129

121130
if(event->type == InputTypeLong && event->key == InputKeyBack) {
122-
ble_profile_hid_mouse_release_all(bt_mouse->ble_hid_profile);
131+
ble_profile_hid_mouse_release_all(bt_mouse->hid);
123132
} else {
124133
bt_mouse_process(bt_mouse, event);
125134
consumed = true;
@@ -204,18 +213,18 @@ static int32_t bt_mouse_thread_callback(void* context) {
204213

205214
if(bt_mouse->connected && send_buttons) {
206215
if(event.state) {
207-
ble_profile_hid_mouse_press(bt_mouse->ble_hid_profile, event.button);
216+
ble_profile_hid_mouse_press(bt_mouse->hid, event.button);
208217
} else {
209-
ble_profile_hid_mouse_release(bt_mouse->ble_hid_profile, event.button);
218+
ble_profile_hid_mouse_release(bt_mouse->hid, event.button);
210219
}
211220
}
212221

213222
if(bt_mouse->connected && (dx != 0 || dy != 0)) {
214-
ble_profile_hid_mouse_move(bt_mouse->ble_hid_profile, dx, dy);
223+
ble_profile_hid_mouse_move(bt_mouse->hid, dx, dy);
215224
}
216225

217226
if(bt_mouse->connected && wheel != 0) {
218-
ble_profile_hid_mouse_scroll(bt_mouse->ble_hid_profile, wheel);
227+
ble_profile_hid_mouse_scroll(bt_mouse->hid, wheel);
219228
}
220229
}
221230
}
@@ -251,15 +260,37 @@ void bt_mouse_enter_callback(void* context) {
251260
BtMouse* bt_mouse = context;
252261

253262
bt_mouse->bt = furi_record_open(RECORD_BT);
263+
bt_disconnect(bt_mouse->bt);
264+
265+
furi_delay_ms(200);
266+
bt_keys_storage_set_storage_path(bt_mouse->bt, APP_DATA_PATH(HID_BT_KEYS_STORAGE_NAME));
267+
254268
bt_mouse->notifications = furi_record_open(RECORD_NOTIFICATION);
255269
bt_set_status_changed_callback(
256270
bt_mouse->bt, bt_mouse_connection_status_changed_callback, bt_mouse);
257-
bt_mouse->ble_hid_profile = bt_profile_start(bt_mouse->bt, ble_profile_hid, NULL);
258-
furi_check(bt_mouse->ble_hid_profile);
271+
bt_mouse->hid = bt_profile_start(bt_mouse->bt, ble_profile_hid, (void*)&ble_hid_params);
272+
furi_assert(bt_mouse->hid);
259273
furi_hal_bt_start_advertising();
260274
bt_mouse_thread_start(bt_mouse);
261275
}
262276

277+
void bt_mouse_remove_pairing(void) {
278+
Bt* bt = furi_record_open(RECORD_BT);
279+
bt_disconnect(bt);
280+
281+
furi_delay_ms(200);
282+
furi_hal_bt_stop_advertising();
283+
284+
bt_keys_storage_set_storage_path(bt, APP_DATA_PATH(HID_BT_KEYS_STORAGE_NAME));
285+
bt_forget_bonded_devices(bt);
286+
287+
furi_delay_ms(200);
288+
bt_keys_storage_set_default_path(bt);
289+
290+
furi_check(bt_profile_restore_default(bt));
291+
furi_record_close(RECORD_BT);
292+
}
293+
263294
bool bt_mouse_custom_callback(uint32_t event, void* context) {
264295
UNUSED(event);
265296
furi_assert(context);
@@ -281,7 +312,13 @@ void bt_mouse_exit_callback(void* context) {
281312
notification_internal_message(bt_mouse->notifications, &sequence_reset_blue);
282313

283314
bt_set_status_changed_callback(bt_mouse->bt, NULL, NULL);
284-
furi_check(bt_profile_restore_default(bt_mouse->bt));
315+
bt_disconnect(bt_mouse->bt);
316+
317+
furi_delay_ms(200);
318+
bt_keys_storage_set_default_path(bt_mouse->bt);
319+
320+
furi_hal_bt_stop_advertising();
321+
bt_profile_restore_default(bt_mouse->bt);
285322

286323
furi_record_close(RECORD_NOTIFICATION);
287324
bt_mouse->notifications = NULL;

applications/external/airmouse/views/bt_mouse.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ void bt_mouse_free(BtMouse* bt_mouse);
1212
View* bt_mouse_get_view(BtMouse* bt_mouse);
1313

1414
void bt_mouse_set_connected_status(BtMouse* bt_mouse, bool connected);
15+
16+
void bt_mouse_remove_pairing(void);

applications/external/atomicdiceroller/flipper_atomicdiceroller.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ int32_t flipper_atomicdiceroller_app() {
165165
EventApp event;
166166
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(EventApp));
167167

168-
furi_hal_gpio_init(&gpio_ext_pa7, GpioModeInterruptFall, GpioPullUp, GpioSpeedVeryHigh);
169-
170168
mutexStruct mutexVal;
171169
mutexVal.cps = 0;
172170
mutexVal.dice = 0;
@@ -190,6 +188,7 @@ int32_t flipper_atomicdiceroller_app() {
190188

191189
furi_hal_gpio_add_int_callback(&gpio_ext_pa7, gpiocallback, event_queue);
192190
furi_hal_gpio_enable_int_callback(&gpio_ext_pa7);
191+
furi_hal_gpio_init(&gpio_ext_pa7, GpioModeInterruptFall, GpioPullUp, GpioSpeedVeryHigh);
193192

194193
Gui* gui = furi_record_open(RECORD_GUI);
195194
gui_add_view_port(gui, view_port, GuiLayerFullscreen);

applications/external/barcode_gen/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ Note: Barcode save locations have been moved from `/barcodes` to `/apps_data/bar
3434
## Building
3535
1) Clone the [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware) repository or a firmware of your choice
3636
2) Clone this repository and put it in the `applications_user` folder
37-
3) Build this app by using the command `./fbt fap_Barcode_App`
38-
4) Copy the `.fap` from `build\f7-firmware-D\.extapps\Barcode_App.fap` to `apps\Misc` using the qFlipper app
39-
5) While still in the qFlipper app, navigate to the root folder of the SD card and create the folder `apps_data`, if not already there
40-
6) Navigate into `apps_data` and create another folder called `barcode_data`
41-
7) Navigate into `barcode_data`
42-
8) Drag & drop the encoding txts (`code39_encodings.txt`, `code128_encodings.txt` & `codabar_encodings.txt`) from the `encoding_tables` folder in this repository into the `barcode_data` folder
37+
3) Build this app by using the command `./fbt fap_barcode_App`
38+
4) Copy the `.fap` from `build\f7-firmware-D\.extapps\Barcode_App.fap` to `apps\Tools` using the qFlipper app
4339

4440
## Usage
4541

applications/external/barcode_gen/application.fam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ App(
88
fap_category="Outils",
99
fap_icon="images/barcode_10.png",
1010
fap_icon_assets="images",
11-
fap_file_assets="encoding_tables",
11+
fap_file_assets="barcode_encoding_files",
1212
fap_author="@Kingal1337",
1313
fap_weburl="https://github.com/Kingal1337/flipper-barcode-generator",
14-
fap_version="1.1",
14+
fap_version="1.2",
1515
fap_description="L'application vous permet d'afficher divers codes-barres sur l'écran du flipper",
1616
)

applications/external/barcode_gen/barcode_app.c

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ void submenu_callback(void* context, uint32_t index) {
243243
edit_barcode_item(app);
244244
} else if(index == CreateBarcodeItem) {
245245
create_barcode_item(app);
246+
} else if(index == AboutWidgetItem) {
247+
view_dispatcher_switch_to_view(app->view_dispatcher, AboutWidgetView);
248+
} else if(index == ErrorCodesWidgetItem) {
249+
view_dispatcher_switch_to_view(app->view_dispatcher, ErrorCodesWidgetView);
246250
}
247251
}
248252

@@ -270,6 +274,12 @@ void free_app(BarcodeApp* app) {
270274
view_dispatcher_remove_view(app->view_dispatcher, TextInputView);
271275
text_input_free(app->text_input);
272276

277+
view_dispatcher_remove_view(app->view_dispatcher, AboutWidgetView);
278+
widget_free(app->about_widget);
279+
280+
view_dispatcher_remove_view(app->view_dispatcher, ErrorCodesWidgetView);
281+
widget_free(app->error_codes_widget);
282+
273283
view_dispatcher_remove_view(app->view_dispatcher, MessageErrorView);
274284
message_view_free(app->message_view);
275285

@@ -350,6 +360,71 @@ int32_t barcode_main(void* p) {
350360
view_dispatcher_add_view(
351361
app->view_dispatcher, CreateBarcodeView, create_get_view(app->create_view));
352362

363+
/*****************************
364+
* Creating Error Codes View
365+
******************************/
366+
app->error_codes_widget = widget_alloc();
367+
widget_add_text_scroll_element(
368+
app->error_codes_widget,
369+
0,
370+
0,
371+
128,
372+
64,
373+
"\e#Error Codes\n"
374+
"\e#Wrong # Of Characters\n"
375+
"The barcode data has too \nmany or too few characters\n"
376+
"UPC-A: 11-12 characters\n"
377+
"EAN-8: 7-8 characters\n"
378+
"EAN-13: 12-13 characters\n"
379+
"Code128C - even # of \ncharacters\n"
380+
"\n"
381+
"\e#Invalid Characters\n"
382+
"The barcode data has invalid \ncharacters.\n"
383+
"Ex: UPC-A, EAN-8, EAN-13 barcodes can only have \nnumbers while Code128 can \nhave almost any character\n"
384+
"\n"
385+
"\e#Unsupported Type\n"
386+
"The barcode type is not \nsupported by this application\n"
387+
"\n"
388+
"\e#File Opening Error\n"
389+
"The barcode file could not be opened. One reason could be \nthat the file no longer exists\n"
390+
"\n"
391+
"\e#Invalid File Data\n"
392+
"The barcode file could not find the keys \"Type\" or \"Data\". \nThis usually occurs when you edit the file manually and \naccidently change the keys\n"
393+
"\n"
394+
"\e#Missing Encoding Table\n"
395+
"The encoding table files are \nmissing. This only occurs \nwhen you need to handle the \nencoding files manually. If you \ndownload the files from the \napp store this should not \noccur\n"
396+
"\n"
397+
"\e#Encoding Table Error\n"
398+
"This occurs when the \nprogram cannot find a \ncharacter in the encoding \ntable, meaning that either the\ncharacter isn't supported \nor the character is missing \nfrom the encoding table\n"
399+
"");
400+
view_set_previous_callback(widget_get_view(app->error_codes_widget), main_menu_callback);
401+
view_dispatcher_add_view(
402+
app->view_dispatcher, ErrorCodesWidgetView, widget_get_view(app->error_codes_widget));
403+
submenu_add_item(
404+
app->main_menu, "Error Codes Info", ErrorCodesWidgetItem, submenu_callback, app);
405+
406+
/*****************************
407+
* Creating About View
408+
******************************/
409+
app->about_widget = widget_alloc();
410+
widget_add_text_scroll_element(
411+
app->about_widget,
412+
0,
413+
0,
414+
128,
415+
64,
416+
"Un générateur de codes-barres\n"
417+
"capable de générer UPC-A,\n"
418+
"EAN-8, EAN-13, Code-39,\n"
419+
"Codabar, et Code-128\n"
420+
"Pour plus d'informations ou\n"
421+
"problèmes, allez à\n"
422+
"https://github.com/Kingal1337/flipper-barcode-generator");
423+
view_set_previous_callback(widget_get_view(app->about_widget), main_menu_callback);
424+
view_dispatcher_add_view(
425+
app->view_dispatcher, AboutWidgetView, widget_get_view(app->about_widget));
426+
submenu_add_item(app->main_menu, "About", AboutWidgetItem, submenu_callback, app);
427+
353428
/*****************************
354429
* Creating Barcode View
355430
******************************/

0 commit comments

Comments
 (0)