mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-15 20:01:54 -07:00
Merge branch 'dev' into subghz-fixes
This commit is contained in:
+11
-8
@@ -1,12 +1,15 @@
|
||||
## New changes
|
||||
* Plugins: Fix furi_hal_bus issues in AVR Programmer and Signal Generator (fixes issue #525)
|
||||
* Plugins: USB / BLE Remote - Updated UI in keynote vertical and numpad (by @gid9798 | PR #524)
|
||||
* Plugins: Update TOTP [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator)
|
||||
* Plugins: Fixed ESP32 WiFi Marauder crashes when reopening app
|
||||
* Infrared: Updated universal remote asstes (by @amec0e | PR #522)
|
||||
* OFW PR 2783: SLIX2 emulation support / practical use for Dymo printers (by @g3gg0)
|
||||
* OFW PR 2782: NFC: Fix key invalidation logic (by @AloneLiberty)
|
||||
* OFW: Debug: sync apps on attach, makes it possible to debug already started app that has crashed
|
||||
* OFW PR: Update OFW PR 2782
|
||||
* OFW: Add Mitsubishi MSZ-AP25VGK universal ac remote
|
||||
* OFW: Fix roll-over in file browser and archive
|
||||
* OFW: Fix fr-FR-mac keylayout
|
||||
* OFW: NFC/RFID detector app
|
||||
* OFW: Fast FAP Loader
|
||||
* OFW: LF-RFID debug: make it work
|
||||
* OFW: Fix M*LIB usage
|
||||
* OFW: fix: make `dialog_file_browser_set_basic_options` initialize all fields
|
||||
* OFW: Scroll acceleration
|
||||
* OFW: Loader refaptoring: second encounter
|
||||
|
||||
----
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ Almost everything in flipper firmware is built around this concept.
|
||||
# C coding style
|
||||
|
||||
- Tab is 4 spaces
|
||||
- Use `fbt format` to reformat source code and check style guide before commit
|
||||
- Use `./fbt format` to reformat source code and check style guide before commit
|
||||
|
||||
## Naming
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ Applications for main Flipper menu.
|
||||
|
||||
- `archive` - Archive and file manager
|
||||
- `bad_usb` - Bad USB application
|
||||
- `fap_loader` - External applications loader
|
||||
- `gpio` - GPIO application: includes USART bridge and GPIO control
|
||||
- `ibutton` - iButton application, onewire keys and more
|
||||
- `infrared` - Infrared application, controls your IR devices
|
||||
|
||||
@@ -12,5 +12,6 @@ App(
|
||||
"display_test",
|
||||
"text_box_test",
|
||||
"file_browser_test",
|
||||
"speaker_debug",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
App(
|
||||
appid="crash_test",
|
||||
name="Crash Test",
|
||||
apptype=FlipperAppType.DEBUG,
|
||||
entry_point="crash_test_app",
|
||||
cdefines=["APP_CRASH_TEST"],
|
||||
requires=["gui"],
|
||||
stack_size=1 * 1024,
|
||||
fap_category="Debug",
|
||||
)
|
||||
@@ -0,0 +1,128 @@
|
||||
#include <furi_hal.h>
|
||||
#include <furi.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
|
||||
#define TAG "CrashTest"
|
||||
|
||||
typedef struct {
|
||||
Gui* gui;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
Submenu* submenu;
|
||||
} CrashTest;
|
||||
|
||||
typedef enum {
|
||||
CrashTestViewSubmenu,
|
||||
} CrashTestView;
|
||||
|
||||
typedef enum {
|
||||
CrashTestSubmenuCheck,
|
||||
CrashTestSubmenuCheckMessage,
|
||||
CrashTestSubmenuAssert,
|
||||
CrashTestSubmenuAssertMessage,
|
||||
CrashTestSubmenuCrash,
|
||||
CrashTestSubmenuHalt,
|
||||
} CrashTestSubmenu;
|
||||
|
||||
static void crash_test_submenu_callback(void* context, uint32_t index) {
|
||||
CrashTest* instance = (CrashTest*)context;
|
||||
UNUSED(instance);
|
||||
|
||||
switch(index) {
|
||||
case CrashTestSubmenuCheck:
|
||||
furi_check(false);
|
||||
break;
|
||||
case CrashTestSubmenuCheckMessage:
|
||||
furi_check(false, "Crash test: furi_check with message");
|
||||
break;
|
||||
case CrashTestSubmenuAssert:
|
||||
furi_assert(false);
|
||||
break;
|
||||
case CrashTestSubmenuAssertMessage:
|
||||
furi_assert(false, "Crash test: furi_assert with message");
|
||||
break;
|
||||
case CrashTestSubmenuCrash:
|
||||
furi_crash("Crash test: furi_crash");
|
||||
break;
|
||||
case CrashTestSubmenuHalt:
|
||||
furi_halt("Crash test: furi_halt");
|
||||
break;
|
||||
default:
|
||||
furi_crash("Programming error");
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t crash_test_exit_callback(void* context) {
|
||||
UNUSED(context);
|
||||
return VIEW_NONE;
|
||||
}
|
||||
|
||||
CrashTest* crash_test_alloc() {
|
||||
CrashTest* instance = malloc(sizeof(CrashTest));
|
||||
|
||||
View* view = NULL;
|
||||
|
||||
instance->gui = furi_record_open(RECORD_GUI);
|
||||
instance->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_enable_queue(instance->view_dispatcher);
|
||||
view_dispatcher_attach_to_gui(
|
||||
instance->view_dispatcher, instance->gui, ViewDispatcherTypeFullscreen);
|
||||
|
||||
// Menu
|
||||
instance->submenu = submenu_alloc();
|
||||
view = submenu_get_view(instance->submenu);
|
||||
view_set_previous_callback(view, crash_test_exit_callback);
|
||||
view_dispatcher_add_view(instance->view_dispatcher, CrashTestViewSubmenu, view);
|
||||
submenu_add_item(
|
||||
instance->submenu, "Check", CrashTestSubmenuCheck, crash_test_submenu_callback, instance);
|
||||
submenu_add_item(
|
||||
instance->submenu,
|
||||
"Check with message",
|
||||
CrashTestSubmenuCheckMessage,
|
||||
crash_test_submenu_callback,
|
||||
instance);
|
||||
submenu_add_item(
|
||||
instance->submenu, "Assert", CrashTestSubmenuAssert, crash_test_submenu_callback, instance);
|
||||
submenu_add_item(
|
||||
instance->submenu,
|
||||
"Assert with message",
|
||||
CrashTestSubmenuAssertMessage,
|
||||
crash_test_submenu_callback,
|
||||
instance);
|
||||
submenu_add_item(
|
||||
instance->submenu, "Crash", CrashTestSubmenuCrash, crash_test_submenu_callback, instance);
|
||||
submenu_add_item(
|
||||
instance->submenu, "Halt", CrashTestSubmenuHalt, crash_test_submenu_callback, instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void crash_test_free(CrashTest* instance) {
|
||||
view_dispatcher_remove_view(instance->view_dispatcher, CrashTestViewSubmenu);
|
||||
submenu_free(instance->submenu);
|
||||
|
||||
view_dispatcher_free(instance->view_dispatcher);
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
free(instance);
|
||||
}
|
||||
|
||||
int32_t crash_test_run(CrashTest* instance) {
|
||||
view_dispatcher_switch_to_view(instance->view_dispatcher, CrashTestViewSubmenu);
|
||||
view_dispatcher_run(instance->view_dispatcher);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t crash_test_app(void* p) {
|
||||
UNUSED(p);
|
||||
|
||||
CrashTest* instance = crash_test_alloc();
|
||||
|
||||
int32_t ret = crash_test_run(instance);
|
||||
|
||||
crash_test_free(instance);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -6,6 +6,11 @@ static void comparator_trigger_callback(bool level, void* comp_ctx) {
|
||||
furi_hal_gpio_write(&gpio_ext_pa7, !level);
|
||||
}
|
||||
|
||||
void lfrfid_debug_view_tune_callback(void* context) {
|
||||
LfRfidDebug* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, 0xBA);
|
||||
}
|
||||
|
||||
void lfrfid_debug_scene_tune_on_enter(void* context) {
|
||||
LfRfidDebug* app = context;
|
||||
|
||||
@@ -16,6 +21,8 @@ void lfrfid_debug_scene_tune_on_enter(void* context) {
|
||||
|
||||
furi_hal_rfid_tim_read_start(125000, 0.5);
|
||||
|
||||
lfrfid_debug_view_tune_set_callback(app->tune_view, lfrfid_debug_view_tune_callback, app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidDebugViewTune);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ typedef struct {
|
||||
uint32_t ARR;
|
||||
uint32_t CCR;
|
||||
int pos;
|
||||
void (*update_callback)(void* context);
|
||||
void* update_context;
|
||||
} LfRfidTuneViewModel;
|
||||
|
||||
static void lfrfid_debug_view_tune_draw_callback(Canvas* canvas, void* _model) {
|
||||
@@ -151,6 +153,18 @@ static bool lfrfid_debug_view_tune_input_callback(InputEvent* event, void* conte
|
||||
consumed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(event->key == InputKeyLeft || event->key == InputKeyRight) {
|
||||
with_view_model(
|
||||
tune_view->view,
|
||||
LfRfidTuneViewModel * model,
|
||||
{
|
||||
if(model->update_callback) {
|
||||
model->update_callback(model->update_context);
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
@@ -161,19 +175,7 @@ LfRfidTuneView* lfrfid_debug_view_tune_alloc() {
|
||||
tune_view->view = view_alloc();
|
||||
view_set_context(tune_view->view, tune_view);
|
||||
view_allocate_model(tune_view->view, ViewModelTypeLocking, sizeof(LfRfidTuneViewModel));
|
||||
|
||||
with_view_model(
|
||||
tune_view->view,
|
||||
LfRfidTuneViewModel * model,
|
||||
{
|
||||
model->dirty = true;
|
||||
model->fine = false;
|
||||
model->ARR = 511;
|
||||
model->CCR = 255;
|
||||
model->pos = 0;
|
||||
},
|
||||
true);
|
||||
|
||||
lfrfid_debug_view_tune_clean(tune_view);
|
||||
view_set_draw_callback(tune_view->view, lfrfid_debug_view_tune_draw_callback);
|
||||
view_set_input_callback(tune_view->view, lfrfid_debug_view_tune_input_callback);
|
||||
|
||||
@@ -199,6 +201,8 @@ void lfrfid_debug_view_tune_clean(LfRfidTuneView* tune_view) {
|
||||
model->ARR = 511;
|
||||
model->CCR = 255;
|
||||
model->pos = 0;
|
||||
model->update_callback = NULL;
|
||||
model->update_context = NULL;
|
||||
},
|
||||
true);
|
||||
}
|
||||
@@ -232,3 +236,17 @@ uint32_t lfrfid_debug_view_tune_get_ccr(LfRfidTuneView* tune_view) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void lfrfid_debug_view_tune_set_callback(
|
||||
LfRfidTuneView* tune_view,
|
||||
void (*callback)(void* context),
|
||||
void* context) {
|
||||
with_view_model(
|
||||
tune_view->view,
|
||||
LfRfidTuneViewModel * model,
|
||||
{
|
||||
model->update_callback = callback;
|
||||
model->update_context = context;
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -16,3 +16,8 @@ bool lfrfid_debug_view_tune_is_dirty(LfRfidTuneView* tune_view);
|
||||
uint32_t lfrfid_debug_view_tune_get_arr(LfRfidTuneView* tune_view);
|
||||
|
||||
uint32_t lfrfid_debug_view_tune_get_ccr(LfRfidTuneView* tune_view);
|
||||
|
||||
void lfrfid_debug_view_tune_set_callback(
|
||||
LfRfidTuneView* tune_view,
|
||||
void (*callback)(void* context),
|
||||
void* context);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
App(
|
||||
appid="speaker_debug",
|
||||
name="Speaker Debug",
|
||||
apptype=FlipperAppType.DEBUG,
|
||||
entry_point="speaker_debug_app",
|
||||
requires=["gui", "notification"],
|
||||
stack_size=2 * 1024,
|
||||
order=10,
|
||||
fap_category="Debug",
|
||||
fap_libs=["music_worker"],
|
||||
)
|
||||
@@ -0,0 +1,120 @@
|
||||
#include <furi.h>
|
||||
#include <notification/notification.h>
|
||||
#include <music_worker/music_worker.h>
|
||||
#include <cli/cli.h>
|
||||
#include <toolbox/args.h>
|
||||
|
||||
#define TAG "SpeakerDebug"
|
||||
#define CLI_COMMAND "speaker_debug"
|
||||
|
||||
typedef enum {
|
||||
SpeakerDebugAppMessageTypeStop,
|
||||
} SpeakerDebugAppMessageType;
|
||||
|
||||
typedef struct {
|
||||
SpeakerDebugAppMessageType type;
|
||||
} SpeakerDebugAppMessage;
|
||||
|
||||
typedef struct {
|
||||
MusicWorker* music_worker;
|
||||
FuriMessageQueue* message_queue;
|
||||
Cli* cli;
|
||||
} SpeakerDebugApp;
|
||||
|
||||
static SpeakerDebugApp* speaker_app_alloc() {
|
||||
SpeakerDebugApp* app = (SpeakerDebugApp*)malloc(sizeof(SpeakerDebugApp));
|
||||
app->music_worker = music_worker_alloc();
|
||||
app->message_queue = furi_message_queue_alloc(8, sizeof(SpeakerDebugAppMessage));
|
||||
app->cli = furi_record_open(RECORD_CLI);
|
||||
return app;
|
||||
}
|
||||
|
||||
static void speaker_app_free(SpeakerDebugApp* app) {
|
||||
music_worker_free(app->music_worker);
|
||||
furi_message_queue_free(app->message_queue);
|
||||
furi_record_close(RECORD_CLI);
|
||||
free(app);
|
||||
}
|
||||
|
||||
static void speaker_app_cli(Cli* cli, FuriString* args, void* context) {
|
||||
UNUSED(cli);
|
||||
|
||||
SpeakerDebugApp* app = (SpeakerDebugApp*)context;
|
||||
SpeakerDebugAppMessage message;
|
||||
FuriString* cmd = furi_string_alloc();
|
||||
|
||||
if(!args_read_string_and_trim(args, cmd)) {
|
||||
furi_string_free(cmd);
|
||||
printf("Usage:\r\n");
|
||||
printf("\t" CLI_COMMAND " stop\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(furi_string_cmp(cmd, "stop") == 0) {
|
||||
message.type = SpeakerDebugAppMessageTypeStop;
|
||||
FuriStatus status = furi_message_queue_put(app->message_queue, &message, 100);
|
||||
if(status != FuriStatusOk) {
|
||||
printf("Failed to send message\r\n");
|
||||
} else {
|
||||
printf("Stopping\r\n");
|
||||
}
|
||||
} else {
|
||||
printf("Usage:\r\n");
|
||||
printf("\t" CLI_COMMAND " stop\r\n");
|
||||
}
|
||||
|
||||
furi_string_free(cmd);
|
||||
}
|
||||
|
||||
static bool speaker_app_music_play(SpeakerDebugApp* app, const char* rtttl) {
|
||||
if(music_worker_is_playing(app->music_worker)) {
|
||||
music_worker_stop(app->music_worker);
|
||||
}
|
||||
|
||||
if(!music_worker_load_rtttl_from_string(app->music_worker, rtttl)) {
|
||||
FURI_LOG_E(TAG, "Failed to load RTTTL");
|
||||
return false;
|
||||
}
|
||||
|
||||
music_worker_set_volume(app->music_worker, 1.0f);
|
||||
music_worker_start(app->music_worker);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void speaker_app_music_stop(SpeakerDebugApp* app) {
|
||||
if(music_worker_is_playing(app->music_worker)) {
|
||||
music_worker_stop(app->music_worker);
|
||||
}
|
||||
}
|
||||
|
||||
static void speaker_app_run(SpeakerDebugApp* app, const char* arg) {
|
||||
if(!arg || !speaker_app_music_play(app, arg)) {
|
||||
FURI_LOG_E(TAG, "Provided RTTTL is invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
cli_add_command(app->cli, CLI_COMMAND, CliCommandFlagParallelSafe, speaker_app_cli, app);
|
||||
|
||||
SpeakerDebugAppMessage message;
|
||||
FuriStatus status;
|
||||
while(true) {
|
||||
status = furi_message_queue_get(app->message_queue, &message, FuriWaitForever);
|
||||
|
||||
if(status == FuriStatusOk) {
|
||||
if(message.type == SpeakerDebugAppMessageTypeStop) {
|
||||
speaker_app_music_stop(app);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cli_delete_command(app->cli, CLI_COMMAND);
|
||||
}
|
||||
|
||||
int32_t speaker_debug_app(void* arg) {
|
||||
SpeakerDebugApp* app = speaker_app_alloc();
|
||||
speaker_app_run(app, arg);
|
||||
speaker_app_free(app);
|
||||
return 0;
|
||||
}
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#define LINES_ON_SCREEN 6
|
||||
#define COLUMNS_ON_SCREEN 21
|
||||
#define TAG "UartEcho"
|
||||
#define DEFAULT_BAUD_RATE 230400
|
||||
|
||||
typedef struct UartDumpModel UartDumpModel;
|
||||
|
||||
@@ -179,7 +181,7 @@ static int32_t uart_echo_worker(void* context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UartEchoApp* uart_echo_app_alloc() {
|
||||
static UartEchoApp* uart_echo_app_alloc(uint32_t baudrate) {
|
||||
UartEchoApp* app = malloc(sizeof(UartEchoApp));
|
||||
|
||||
app->rx_stream = furi_stream_buffer_alloc(2048, 1);
|
||||
@@ -220,7 +222,7 @@ static UartEchoApp* uart_echo_app_alloc() {
|
||||
|
||||
// Enable uart listener
|
||||
furi_hal_console_disable();
|
||||
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
|
||||
furi_hal_uart_set_br(FuriHalUartIdUSART1, baudrate);
|
||||
furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, uart_echo_on_irq_cb, app);
|
||||
|
||||
return app;
|
||||
@@ -263,8 +265,18 @@ static void uart_echo_app_free(UartEchoApp* app) {
|
||||
}
|
||||
|
||||
int32_t uart_echo_app(void* p) {
|
||||
UNUSED(p);
|
||||
UartEchoApp* app = uart_echo_app_alloc();
|
||||
uint32_t baudrate = DEFAULT_BAUD_RATE;
|
||||
if(p) {
|
||||
const char* baudrate_str = p;
|
||||
if(sscanf(baudrate_str, "%lu", &baudrate) != 1) {
|
||||
FURI_LOG_E(TAG, "Invalid baudrate: %s", baudrate_str);
|
||||
baudrate = DEFAULT_BAUD_RATE;
|
||||
}
|
||||
}
|
||||
|
||||
FURI_LOG_I(TAG, "Using baudrate: %lu", baudrate);
|
||||
|
||||
UartEchoApp* app = uart_echo_app_alloc(baudrate);
|
||||
view_dispatcher_run(app->view_dispatcher);
|
||||
uart_echo_app_free(app);
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <dialogs/dialogs.h>
|
||||
|
||||
#include "../minunit.h"
|
||||
|
||||
MU_TEST(test_dialog_file_browser_set_basic_options_should_init_all_fields) {
|
||||
mu_assert(
|
||||
sizeof(DialogsFileBrowserOptions) == 28,
|
||||
"Changes to `DialogsFileBrowserOptions` should also be reflected in `dialog_file_browser_set_basic_options`");
|
||||
|
||||
DialogsFileBrowserOptions options;
|
||||
dialog_file_browser_set_basic_options(&options, ".fap", NULL);
|
||||
// note: this assertions can safely be changed, their primary purpose is to remind the maintainer
|
||||
// to update `dialog_file_browser_set_basic_options` by including all structure fields in it
|
||||
mu_assert_string_eq(".fap", options.extension);
|
||||
mu_assert_null(options.base_path);
|
||||
mu_assert(options.skip_assets, "`skip_assets` should default to `true");
|
||||
mu_assert(options.hide_dot_files, "`hide_dot_files` should default to `true");
|
||||
mu_assert_null(options.icon);
|
||||
mu_assert(options.hide_ext, "`hide_ext` should default to `true");
|
||||
mu_assert_null(options.item_loader_callback);
|
||||
mu_assert_null(options.item_loader_context);
|
||||
}
|
||||
|
||||
MU_TEST_SUITE(dialogs_file_browser_options) {
|
||||
MU_RUN_TEST(test_dialog_file_browser_set_basic_options_should_init_all_fields);
|
||||
}
|
||||
|
||||
int run_minunit_test_dialogs_file_browser_options() {
|
||||
MU_RUN_SUITE(dialogs_file_browser_options);
|
||||
|
||||
return MU_EXIT_CODE;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ int run_minunit_test_nfc();
|
||||
int run_minunit_test_bit_lib();
|
||||
int run_minunit_test_float_tools();
|
||||
int run_minunit_test_bt();
|
||||
int run_minunit_test_dialogs_file_browser_options();
|
||||
|
||||
typedef int (*UnitTestEntry)();
|
||||
|
||||
@@ -55,6 +56,8 @@ const UnitTest unit_tests[] = {
|
||||
{.name = "bit_lib", .entry = run_minunit_test_bit_lib},
|
||||
{.name = "float_tools", .entry = run_minunit_test_float_tools},
|
||||
{.name = "bt", .entry = run_minunit_test_bt},
|
||||
{.name = "dialogs_file_browser_options",
|
||||
.entry = run_minunit_test_dialogs_file_browser_options},
|
||||
};
|
||||
|
||||
void minunit_print_progress() {
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=30,
|
||||
fap_icon="arkanoid_10px.png",
|
||||
fap_category="Games",
|
||||
fap_author="@xMasterX & @gotnull",
|
||||
fap_version="1.0",
|
||||
fap_description="Arkanoid Game",
|
||||
)
|
||||
|
||||
@@ -11,4 +11,7 @@ App(
|
||||
order=50,
|
||||
fap_icon="barcode_10px.png",
|
||||
fap_category="Misc",
|
||||
fap_author="@xMasterX & @msvsergey & @McAzzaMan",
|
||||
fap_version="1.0",
|
||||
fap_description="App displays Barcode on flipper screen and allows to edit it",
|
||||
)
|
||||
+4
-1
@@ -8,5 +8,8 @@ App(
|
||||
order=30,
|
||||
fap_icon="blackjack_10px.png",
|
||||
fap_category="Games",
|
||||
fap_icon_assets="assets"
|
||||
fap_icon_assets="assets",
|
||||
fap_author="@teeebor",
|
||||
fap_version="1.0",
|
||||
fap_description="Blackjack Game",
|
||||
)
|
||||
@@ -11,4 +11,7 @@ App(
|
||||
fap_icon="bomb.png",
|
||||
fap_category="Games",
|
||||
fap_icon_assets="assets",
|
||||
fap_author="@leo-need-more-coffee & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Bomberduck(Bomberman) Game",
|
||||
)
|
||||
|
||||
@@ -12,4 +12,7 @@ App(
|
||||
stack_size=8 * 1024,
|
||||
order=20,
|
||||
fap_category="Tools",
|
||||
fap_author="@litui & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="DTMF (Dual-Tone Multi-Frequency) dialer, Bluebox, and Redbox.",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=100,
|
||||
fap_icon="wifi_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@SequoiaSan & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="DSTIKE Deauther module interface, based on ESP8266",
|
||||
)
|
||||
|
||||
@@ -9,4 +9,7 @@ App(
|
||||
fap_icon="flappy_10px.png",
|
||||
fap_category="Games",
|
||||
fap_icon_assets="assets",
|
||||
fap_author="@DroomOne & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Flappy Bird Game",
|
||||
)
|
||||
|
||||
@@ -9,4 +9,7 @@ App(
|
||||
fap_icon="i2ctools.png",
|
||||
fap_category="GPIO",
|
||||
fap_icon_assets="images",
|
||||
fap_author="@NaejEL",
|
||||
fap_version="1.0",
|
||||
fap_description="Set of i2c tools",
|
||||
)
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
fap_icon="game15_10px.png",
|
||||
order=30,
|
||||
fap_category="Games",
|
||||
fap_author="@x27",
|
||||
fap_version="1.0",
|
||||
fap_description="Logic Game",
|
||||
)
|
||||
|
||||
+4
-1
@@ -9,5 +9,8 @@ App(
|
||||
stack_size=1 * 1024,
|
||||
order=90,
|
||||
fap_icon="game_2048.png",
|
||||
fap_category="Games"
|
||||
fap_category="Games",
|
||||
fap_author="@eugene-kirzhanov",
|
||||
fap_version="1.0",
|
||||
fap_description="2048 Game",
|
||||
)
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=35,
|
||||
fap_icon="gps_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@ezod & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Works with GPS modules via UART, using NMEA protocol.",
|
||||
)
|
||||
|
||||
@@ -10,4 +10,7 @@ App(
|
||||
order=20,
|
||||
fap_icon="dist_sensor10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@xMasterX (first implementation by @Sanqui)",
|
||||
fap_version="1.0",
|
||||
fap_description="HC-SR(04) Distance sensor reader",
|
||||
)
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
fap_category="Games",
|
||||
fap_icon="box.png",
|
||||
fap_icon_assets="assets_images",
|
||||
fap_author="@xMasterX (original implementation by @wquinoa & @Vedmein)",
|
||||
fap_version="1.0",
|
||||
fap_description="Heap Defence game from hackathon (aka Stack Attack)",
|
||||
)
|
||||
|
||||
@@ -12,4 +12,7 @@ App(
|
||||
fap_icon="icons/hex_10px.png",
|
||||
fap_category="Misc",
|
||||
fap_icon_assets="icons",
|
||||
fap_author="@QtRoS",
|
||||
fap_version="1.0",
|
||||
fap_description="App allows to view various files as HEX.",
|
||||
)
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@ View* hid_keynote_get_view(HidKeynote* hid_keynote);
|
||||
|
||||
void hid_keynote_set_connected_status(HidKeynote* hid_keynote, bool connected);
|
||||
|
||||
void hid_keynote_set_orientation(HidKeynote* hid_keynote, bool vertical);
|
||||
void hid_keynote_set_orientation(HidKeynote* hid_keynote, bool vertical);
|
||||
|
||||
+2
-2
@@ -140,11 +140,11 @@ static void hid_numpad_draw_callback(Canvas* canvas, void* context) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
elements_multiline_text_aligned(
|
||||
canvas, 7, 60, AlignLeft, AlignBottom, "Waiting for\nConnection...");
|
||||
}
|
||||
elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Numpad");
|
||||
|
||||
elements_multiline_text_aligned(
|
||||
canvas, 7, 60, AlignLeft, AlignBottom, "Waiting for\nConnection...");
|
||||
} else {
|
||||
elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Numpad");
|
||||
}
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
stack_size=2 * 1024,
|
||||
fap_icon="ir_scope.png",
|
||||
fap_category="Tools",
|
||||
fap_author="@kallanreed",
|
||||
fap_version="1.0",
|
||||
fap_description="App allows to see incoming IR signals.",
|
||||
)
|
||||
|
||||
@@ -20,4 +20,7 @@ App(
|
||||
),
|
||||
],
|
||||
fap_icon_assets="icons",
|
||||
fap_author="@oleksiikutuzov",
|
||||
fap_version="1.0",
|
||||
fap_description="Lightmeter app for photography based on BH1750 sensor",
|
||||
)
|
||||
|
||||
@@ -11,4 +11,7 @@ App(
|
||||
fap_icon_assets="images",
|
||||
stack_size=2 * 1024,
|
||||
order=20,
|
||||
fap_author="@panki27 & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Metronome app",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
fap_category="Games",
|
||||
fap_icon="minesweeper_icon.png",
|
||||
order=35,
|
||||
fap_author="@panki27 & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Minesweeper Game",
|
||||
)
|
||||
|
||||
+4
-2
@@ -9,6 +9,8 @@ App(
|
||||
stack_size=1 * 1024,
|
||||
order=20,
|
||||
fap_icon="morse_code_10px.png",
|
||||
fap_category="Media"
|
||||
|
||||
fap_category="Media",
|
||||
fap_author="@wh00hw & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="Simple Morse Code parser",
|
||||
)
|
||||
@@ -11,6 +11,9 @@ App(
|
||||
order=60,
|
||||
fap_icon="mouse_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@mothball187 & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="App works with NRF24 Sniffer app to perform mousejack attacks",
|
||||
fap_icon_assets="images",
|
||||
fap_private_libs=[
|
||||
Lib(
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=19,
|
||||
fap_icon="converter_10px.png",
|
||||
fap_category="Misc",
|
||||
fap_author="@theisolinearchip",
|
||||
fap_version="1.0",
|
||||
fap_description="A multi-unit converter written with an easy and expandable system for adding new units and conversion methods",
|
||||
)
|
||||
|
||||
+1
-9
@@ -7,18 +7,10 @@ App(
|
||||
"gui",
|
||||
"dialogs",
|
||||
],
|
||||
provides=["music_player_start"],
|
||||
stack_size=2 * 1024,
|
||||
order=20,
|
||||
fap_icon="icons/music_10px.png",
|
||||
fap_category="Media",
|
||||
fap_icon_assets="icons",
|
||||
)
|
||||
|
||||
App(
|
||||
appid="music_player_start",
|
||||
apptype=FlipperAppType.STARTUP,
|
||||
entry_point="music_player_on_system_start",
|
||||
requires=["music_player"],
|
||||
order=30,
|
||||
fap_libs=["music_worker"],
|
||||
)
|
||||
|
||||
+13
-14
@@ -1,4 +1,4 @@
|
||||
#include "music_player_worker.h"
|
||||
#include <music_worker/music_worker.h>
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
@@ -35,7 +35,7 @@ typedef struct {
|
||||
ViewPort* view_port;
|
||||
Gui* gui;
|
||||
|
||||
MusicPlayerWorker* worker;
|
||||
MusicWorker* worker;
|
||||
} MusicPlayer;
|
||||
|
||||
static const float MUSIC_PLAYER_VOLUMES[] = {0, .25, .5, .75, 1};
|
||||
@@ -219,7 +219,7 @@ static void input_callback(InputEvent* input_event, void* ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
static void music_player_worker_callback(
|
||||
static void music_worker_callback(
|
||||
uint8_t semitone,
|
||||
uint8_t dots,
|
||||
uint8_t duration,
|
||||
@@ -251,7 +251,7 @@ static void music_player_worker_callback(
|
||||
void music_player_clear(MusicPlayer* instance) {
|
||||
memset(instance->model->duration_history, 0xff, MUSIC_PLAYER_SEMITONE_HISTORY_SIZE);
|
||||
memset(instance->model->semitone_history, 0xff, MUSIC_PLAYER_SEMITONE_HISTORY_SIZE);
|
||||
music_player_worker_clear(instance->worker);
|
||||
music_worker_clear(instance->worker);
|
||||
}
|
||||
|
||||
MusicPlayer* music_player_alloc() {
|
||||
@@ -264,10 +264,9 @@ MusicPlayer* music_player_alloc() {
|
||||
|
||||
instance->input_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
|
||||
|
||||
instance->worker = music_player_worker_alloc();
|
||||
music_player_worker_set_volume(
|
||||
instance->worker, MUSIC_PLAYER_VOLUMES[instance->model->volume]);
|
||||
music_player_worker_set_callback(instance->worker, music_player_worker_callback, instance);
|
||||
instance->worker = music_worker_alloc();
|
||||
music_worker_set_volume(instance->worker, MUSIC_PLAYER_VOLUMES[instance->model->volume]);
|
||||
music_worker_set_callback(instance->worker, music_worker_callback, instance);
|
||||
|
||||
music_player_clear(instance);
|
||||
|
||||
@@ -287,7 +286,7 @@ void music_player_free(MusicPlayer* instance) {
|
||||
furi_record_close(RECORD_GUI);
|
||||
view_port_free(instance->view_port);
|
||||
|
||||
music_player_worker_free(instance->worker);
|
||||
music_worker_free(instance->worker);
|
||||
|
||||
furi_message_queue_free(instance->input_queue);
|
||||
|
||||
@@ -325,12 +324,12 @@ int32_t music_player_app(void* p) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!music_player_worker_load(music_player->worker, furi_string_get_cstr(file_path))) {
|
||||
if(!music_worker_load(music_player->worker, furi_string_get_cstr(file_path))) {
|
||||
FURI_LOG_E(TAG, "Unable to load file");
|
||||
break;
|
||||
}
|
||||
|
||||
music_player_worker_start(music_player->worker);
|
||||
music_worker_start(music_player->worker);
|
||||
|
||||
InputEvent input;
|
||||
while(furi_message_queue_get(music_player->input_queue, &input, FuriWaitForever) ==
|
||||
@@ -344,11 +343,11 @@ int32_t music_player_app(void* p) {
|
||||
} else if(input.key == InputKeyUp) {
|
||||
if(music_player->model->volume < COUNT_OF(MUSIC_PLAYER_VOLUMES) - 1)
|
||||
music_player->model->volume++;
|
||||
music_player_worker_set_volume(
|
||||
music_worker_set_volume(
|
||||
music_player->worker, MUSIC_PLAYER_VOLUMES[music_player->model->volume]);
|
||||
} else if(input.key == InputKeyDown) {
|
||||
if(music_player->model->volume > 0) music_player->model->volume--;
|
||||
music_player_worker_set_volume(
|
||||
music_worker_set_volume(
|
||||
music_player->worker, MUSIC_PLAYER_VOLUMES[music_player->model->volume]);
|
||||
}
|
||||
|
||||
@@ -356,7 +355,7 @@ int32_t music_player_app(void* p) {
|
||||
view_port_update(music_player->view_port);
|
||||
}
|
||||
|
||||
music_player_worker_stop(music_player->worker);
|
||||
music_worker_stop(music_player->worker);
|
||||
if(p && strlen(p)) break; // Exit instead of going to browser if launched with arg
|
||||
music_player_clear(music_player);
|
||||
} while(1);
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#include <furi.h>
|
||||
#include <cli/cli.h>
|
||||
#include <storage/storage.h>
|
||||
#include "music_player_worker.h"
|
||||
|
||||
static void music_player_cli(Cli* cli, FuriString* args, void* context) {
|
||||
UNUSED(context);
|
||||
MusicPlayerWorker* music_player_worker = music_player_worker_alloc();
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
do {
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(args), NULL) == FSE_OK) {
|
||||
if(!music_player_worker_load(music_player_worker, furi_string_get_cstr(args))) {
|
||||
printf("Failed to open file %s\r\n", furi_string_get_cstr(args));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(!music_player_worker_load_rtttl_from_string(
|
||||
music_player_worker, furi_string_get_cstr(args))) {
|
||||
printf("Argument is not a file or RTTTL\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
music_player_worker_set_volume(music_player_worker, 1.0f);
|
||||
music_player_worker_start(music_player_worker);
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
furi_delay_ms(50);
|
||||
}
|
||||
music_player_worker_stop(music_player_worker);
|
||||
} while(0);
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
music_player_worker_free(music_player_worker);
|
||||
}
|
||||
|
||||
void music_player_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
|
||||
cli_add_command(cli, "music_player", CliCommandFlagDefault, music_player_cli, NULL);
|
||||
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(music_player_cli);
|
||||
#endif
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*MusicPlayerWorkerCallback)(
|
||||
uint8_t semitone,
|
||||
uint8_t dots,
|
||||
uint8_t duration,
|
||||
float position,
|
||||
void* context);
|
||||
|
||||
typedef struct MusicPlayerWorker MusicPlayerWorker;
|
||||
|
||||
MusicPlayerWorker* music_player_worker_alloc();
|
||||
|
||||
void music_player_worker_clear(MusicPlayerWorker* instance);
|
||||
|
||||
void music_player_worker_free(MusicPlayerWorker* instance);
|
||||
|
||||
bool music_player_worker_load(MusicPlayerWorker* instance, const char* file_path);
|
||||
|
||||
bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const char* file_path);
|
||||
|
||||
bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const char* file_path);
|
||||
|
||||
bool music_player_worker_load_rtttl_from_string(MusicPlayerWorker* instance, const char* string);
|
||||
|
||||
void music_player_worker_set_callback(
|
||||
MusicPlayerWorker* instance,
|
||||
MusicPlayerWorkerCallback callback,
|
||||
void* context);
|
||||
|
||||
void music_player_worker_set_volume(MusicPlayerWorker* instance, float volume);
|
||||
|
||||
void music_player_worker_start(MusicPlayerWorker* instance);
|
||||
|
||||
void music_player_worker_stop(MusicPlayerWorker* instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
App(
|
||||
appid="nfc_rfid_detector",
|
||||
name="NFC/RFID detector",
|
||||
apptype=FlipperAppType.EXTERNAL,
|
||||
targets=["f7"],
|
||||
entry_point="nfc_rfid_detector_app",
|
||||
requires=["gui"],
|
||||
stack_size=4 * 1024,
|
||||
order=50,
|
||||
fap_icon="nfc_rfid_detector_10px.png",
|
||||
fap_category="Tools",
|
||||
fap_icon_assets="images",
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
//NfcRfidDetectorCustomEvent
|
||||
NfcRfidDetectorCustomEventStartId = 100,
|
||||
|
||||
} NfcRfidDetectorCustomEvent;
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define NFC_RFID_DETECTOR_VERSION_APP "0.1"
|
||||
#define NFC_RFID_DETECTOR_DEVELOPED "SkorP"
|
||||
#define NFC_RFID_DETECTOR_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"
|
||||
|
||||
typedef enum {
|
||||
NfcRfidDetectorViewVariableItemList,
|
||||
NfcRfidDetectorViewSubmenu,
|
||||
NfcRfidDetectorViewFieldPresence,
|
||||
NfcRfidDetectorViewWidget,
|
||||
} NfcRfidDetectorView;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 168 B |
Binary file not shown.
|
After Width: | Height: | Size: 158 B |
Binary file not shown.
|
After Width: | Height: | Size: 124 B |
@@ -0,0 +1,108 @@
|
||||
#include "nfc_rfid_detector_app_i.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
static bool nfc_rfid_detector_app_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
return scene_manager_handle_custom_event(app->scene_manager, event);
|
||||
}
|
||||
|
||||
static bool nfc_rfid_detector_app_back_event_callback(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
return scene_manager_handle_back_event(app->scene_manager);
|
||||
}
|
||||
|
||||
static void nfc_rfid_detector_app_tick_event_callback(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
scene_manager_handle_tick_event(app->scene_manager);
|
||||
}
|
||||
|
||||
NfcRfidDetectorApp* nfc_rfid_detector_app_alloc() {
|
||||
NfcRfidDetectorApp* app = malloc(sizeof(NfcRfidDetectorApp));
|
||||
|
||||
// GUI
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// View Dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
app->scene_manager = scene_manager_alloc(&nfc_rfid_detector_scene_handlers, app);
|
||||
view_dispatcher_enable_queue(app->view_dispatcher);
|
||||
|
||||
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
|
||||
view_dispatcher_set_custom_event_callback(
|
||||
app->view_dispatcher, nfc_rfid_detector_app_custom_event_callback);
|
||||
view_dispatcher_set_navigation_event_callback(
|
||||
app->view_dispatcher, nfc_rfid_detector_app_back_event_callback);
|
||||
view_dispatcher_set_tick_event_callback(
|
||||
app->view_dispatcher, nfc_rfid_detector_app_tick_event_callback, 100);
|
||||
|
||||
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
||||
|
||||
// Open Notification record
|
||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// SubMenu
|
||||
app->submenu = submenu_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, NfcRfidDetectorViewSubmenu, submenu_get_view(app->submenu));
|
||||
|
||||
// Widget
|
||||
app->widget = widget_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, NfcRfidDetectorViewWidget, widget_get_view(app->widget));
|
||||
|
||||
// Field Presence
|
||||
app->nfc_rfid_detector_field_presence = nfc_rfid_detector_view_field_presence_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher,
|
||||
NfcRfidDetectorViewFieldPresence,
|
||||
nfc_rfid_detector_view_field_presence_get_view(app->nfc_rfid_detector_field_presence));
|
||||
|
||||
scene_manager_next_scene(app->scene_manager, NfcRfidDetectorSceneStart);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_app_free(NfcRfidDetectorApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// Submenu
|
||||
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewSubmenu);
|
||||
submenu_free(app->submenu);
|
||||
|
||||
// Widget
|
||||
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewWidget);
|
||||
widget_free(app->widget);
|
||||
|
||||
// Field Presence
|
||||
view_dispatcher_remove_view(app->view_dispatcher, NfcRfidDetectorViewFieldPresence);
|
||||
nfc_rfid_detector_view_field_presence_free(app->nfc_rfid_detector_field_presence);
|
||||
|
||||
// View dispatcher
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
scene_manager_free(app->scene_manager);
|
||||
|
||||
// Notifications
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
app->notifications = NULL;
|
||||
|
||||
// Close records
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
free(app);
|
||||
}
|
||||
|
||||
int32_t nfc_rfid_detector_app(void* p) {
|
||||
UNUSED(p);
|
||||
NfcRfidDetectorApp* nfc_rfid_detector_app = nfc_rfid_detector_app_alloc();
|
||||
|
||||
view_dispatcher_run(nfc_rfid_detector_app->view_dispatcher);
|
||||
|
||||
nfc_rfid_detector_app_free(nfc_rfid_detector_app);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "nfc_rfid_detector_app_i.h"
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#define TAG "NfcRfidDetector"
|
||||
|
||||
void nfc_rfid_detector_app_field_presence_start(NfcRfidDetectorApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// start the field presence rfid detection
|
||||
furi_hal_rfid_field_detect_start();
|
||||
|
||||
// start the field presence nfc detection
|
||||
furi_hal_nfc_exit_sleep();
|
||||
furi_hal_nfc_field_detect_start();
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_app_field_presence_stop(NfcRfidDetectorApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// stop the field presence rfid detection
|
||||
furi_hal_rfid_field_detect_stop();
|
||||
|
||||
// stop the field presence nfc detection
|
||||
furi_hal_nfc_start_sleep();
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_app_field_presence_is_nfc(NfcRfidDetectorApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// check if the field presence is nfc
|
||||
return furi_hal_nfc_field_is_present();
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_app_field_presence_is_rfid(NfcRfidDetectorApp* app, uint32_t* frequency) {
|
||||
furi_assert(app);
|
||||
|
||||
// check if the field presence is rfid
|
||||
return furi_hal_rfid_field_is_present(frequency);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "helpers/nfc_rfid_detector_types.h"
|
||||
#include "helpers/nfc_rfid_detector_event.h"
|
||||
|
||||
#include "scenes/nfc_rfid_detector_scene.h"
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/modules/widget.h>
|
||||
#include <notification/notification_messages.h>
|
||||
#include "views/nfc_rfid_detector_view_field_presence.h"
|
||||
|
||||
typedef struct NfcRfidDetectorApp NfcRfidDetectorApp;
|
||||
|
||||
struct NfcRfidDetectorApp {
|
||||
Gui* gui;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
SceneManager* scene_manager;
|
||||
NotificationApp* notifications;
|
||||
Submenu* submenu;
|
||||
Widget* widget;
|
||||
NfcRfidDetectorFieldPresence* nfc_rfid_detector_field_presence;
|
||||
};
|
||||
|
||||
void nfc_rfid_detector_app_field_presence_start(NfcRfidDetectorApp* app);
|
||||
void nfc_rfid_detector_app_field_presence_stop(NfcRfidDetectorApp* app);
|
||||
bool nfc_rfid_detector_app_field_presence_is_nfc(NfcRfidDetectorApp* app);
|
||||
bool nfc_rfid_detector_app_field_presence_is_rfid(NfcRfidDetectorApp* app, uint32_t* frequency);
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "../nfc_rfid_detector_app_i.h"
|
||||
|
||||
// Generate scene on_enter handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
|
||||
void (*const nfc_rfid_detector_scene_on_enter_handlers[])(void*) = {
|
||||
#include "nfc_rfid_detector_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 nfc_rfid_detector_scene_on_event_handlers[])(void* context, SceneManagerEvent event) =
|
||||
{
|
||||
#include "nfc_rfid_detector_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 nfc_rfid_detector_scene_on_exit_handlers[])(void* context) = {
|
||||
#include "nfc_rfid_detector_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Initialize scene handlers configuration structure
|
||||
const SceneManagerHandlers nfc_rfid_detector_scene_handlers = {
|
||||
.on_enter_handlers = nfc_rfid_detector_scene_on_enter_handlers,
|
||||
.on_event_handlers = nfc_rfid_detector_scene_on_event_handlers,
|
||||
.on_exit_handlers = nfc_rfid_detector_scene_on_exit_handlers,
|
||||
.scene_num = NfcRfidDetectorSceneNum,
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/scene_manager.h>
|
||||
|
||||
// Generate scene id and total number
|
||||
#define ADD_SCENE(prefix, name, id) NfcRfidDetectorScene##id,
|
||||
typedef enum {
|
||||
#include "nfc_rfid_detector_scene_config.h"
|
||||
NfcRfidDetectorSceneNum,
|
||||
} NfcRfidDetectorScene;
|
||||
#undef ADD_SCENE
|
||||
|
||||
extern const SceneManagerHandlers nfc_rfid_detector_scene_handlers;
|
||||
|
||||
// Generate scene on_enter handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
|
||||
#include "nfc_rfid_detector_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 "nfc_rfid_detector_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 "nfc_rfid_detector_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#include "../nfc_rfid_detector_app_i.h"
|
||||
|
||||
void nfc_rfid_detector_scene_about_widget_callback(
|
||||
GuiButtonType result,
|
||||
InputType type,
|
||||
void* context) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
if(type == InputTypeShort) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, result);
|
||||
}
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_about_on_enter(void* context) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
|
||||
FuriString* temp_str;
|
||||
temp_str = furi_string_alloc();
|
||||
furi_string_printf(temp_str, "\e#%s\n", "Information");
|
||||
|
||||
furi_string_cat_printf(temp_str, "Version: %s\n", NFC_RFID_DETECTOR_VERSION_APP);
|
||||
furi_string_cat_printf(temp_str, "Developed by: %s\n", NFC_RFID_DETECTOR_DEVELOPED);
|
||||
furi_string_cat_printf(temp_str, "Github: %s\n\n", NFC_RFID_DETECTOR_GITHUB);
|
||||
|
||||
furi_string_cat_printf(temp_str, "\e#%s\n", "Description");
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"This application allows\nyou to determine what\ntype of electromagnetic\nfield the reader is using.\nFor LF RFID you can also\nsee the carrier frequency\n\n");
|
||||
|
||||
widget_add_text_box_element(
|
||||
app->widget,
|
||||
0,
|
||||
0,
|
||||
128,
|
||||
14,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
"\e#\e! \e!\n",
|
||||
false);
|
||||
widget_add_text_box_element(
|
||||
app->widget,
|
||||
0,
|
||||
2,
|
||||
128,
|
||||
14,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
"\e#\e! NFC/RFID detector \e!\n",
|
||||
false);
|
||||
widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, NfcRfidDetectorViewWidget);
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_scene_about_on_event(void* context, SceneManagerEvent event) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
bool consumed = false;
|
||||
UNUSED(app);
|
||||
UNUSED(event);
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_about_on_exit(void* context) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
|
||||
// Clear views
|
||||
widget_reset(app->widget);
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
ADD_SCENE(nfc_rfid_detector, start, Start)
|
||||
ADD_SCENE(nfc_rfid_detector, about, About)
|
||||
ADD_SCENE(nfc_rfid_detector, field_presence, FieldPresence)
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#include "../nfc_rfid_detector_app_i.h"
|
||||
#include "../views/nfc_rfid_detector_view_field_presence.h"
|
||||
|
||||
void nfc_rfid_detector_scene_field_presence_callback(
|
||||
NfcRfidDetectorCustomEvent event,
|
||||
void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
||||
}
|
||||
|
||||
static const NotificationSequence notification_app_display_on = {
|
||||
|
||||
&message_display_backlight_on,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void nfc_rfid_detector_scene_field_presence_update(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
|
||||
uint32_t frequency = 0;
|
||||
bool nfc_field = nfc_rfid_detector_app_field_presence_is_nfc(app);
|
||||
bool rfid_field = nfc_rfid_detector_app_field_presence_is_rfid(app, &frequency);
|
||||
|
||||
if(nfc_field || rfid_field)
|
||||
notification_message(app->notifications, ¬ification_app_display_on);
|
||||
|
||||
nfc_rfid_detector_view_field_presence_update(
|
||||
app->nfc_rfid_detector_field_presence, nfc_field, rfid_field, frequency);
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_field_presence_on_enter(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
|
||||
// Start detection of field presence
|
||||
nfc_rfid_detector_app_field_presence_start(app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, NfcRfidDetectorViewFieldPresence);
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_scene_field_presence_on_event(void* context, SceneManagerEvent event) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeTick) {
|
||||
nfc_rfid_detector_scene_field_presence_update(app);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_field_presence_on_exit(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
// Stop detection of field presence
|
||||
nfc_rfid_detector_app_field_presence_stop(app);
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#include "../nfc_rfid_detector_app_i.h"
|
||||
|
||||
typedef enum {
|
||||
SubmenuIndexNfcRfidDetectorFieldPresence,
|
||||
SubmenuIndexNfcRfidDetectorAbout,
|
||||
} SubmenuIndex;
|
||||
|
||||
void nfc_rfid_detector_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_start_on_enter(void* context) {
|
||||
UNUSED(context);
|
||||
NfcRfidDetectorApp* app = context;
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Detect field type",
|
||||
SubmenuIndexNfcRfidDetectorFieldPresence,
|
||||
nfc_rfid_detector_scene_start_submenu_callback,
|
||||
app);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"About",
|
||||
SubmenuIndexNfcRfidDetectorAbout,
|
||||
nfc_rfid_detector_scene_start_submenu_callback,
|
||||
app);
|
||||
|
||||
submenu_set_selected_item(
|
||||
submenu, scene_manager_get_scene_state(app->scene_manager, NfcRfidDetectorSceneStart));
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, NfcRfidDetectorViewSubmenu);
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexNfcRfidDetectorAbout) {
|
||||
scene_manager_next_scene(app->scene_manager, NfcRfidDetectorSceneAbout);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexNfcRfidDetectorFieldPresence) {
|
||||
scene_manager_next_scene(app->scene_manager, NfcRfidDetectorSceneFieldPresence);
|
||||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(app->scene_manager, NfcRfidDetectorSceneStart, event.event);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_scene_start_on_exit(void* context) {
|
||||
NfcRfidDetectorApp* app = context;
|
||||
submenu_reset(app->submenu);
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
#include "nfc_rfid_detector_view_field_presence.h"
|
||||
#include "../nfc_rfid_detector_app_i.h"
|
||||
#include <nfc_rfid_detector_icons.h>
|
||||
|
||||
#include <input/input.h>
|
||||
#include <gui/elements.h>
|
||||
|
||||
#define FIELD_FOUND_WEIGHT 5
|
||||
|
||||
typedef enum {
|
||||
NfcRfidDetectorTypeFieldPresenceNfc,
|
||||
NfcRfidDetectorTypeFieldPresenceRfid,
|
||||
} NfcRfidDetectorTypeFieldPresence;
|
||||
|
||||
static const Icon* NfcRfidDetectorFieldPresenceIcons[] = {
|
||||
[NfcRfidDetectorTypeFieldPresenceNfc] = &I_NFC_detect_45x30,
|
||||
[NfcRfidDetectorTypeFieldPresenceRfid] = &I_Rfid_detect_45x30,
|
||||
};
|
||||
|
||||
struct NfcRfidDetectorFieldPresence {
|
||||
View* view;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t nfc_field;
|
||||
uint8_t rfid_field;
|
||||
uint32_t rfid_frequency;
|
||||
} NfcRfidDetectorFieldPresenceModel;
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_update(
|
||||
NfcRfidDetectorFieldPresence* instance,
|
||||
bool nfc_field,
|
||||
bool rfid_field,
|
||||
uint32_t rfid_frequency) {
|
||||
furi_assert(instance);
|
||||
with_view_model(
|
||||
instance->view,
|
||||
NfcRfidDetectorFieldPresenceModel * model,
|
||||
{
|
||||
if(nfc_field) {
|
||||
model->nfc_field = FIELD_FOUND_WEIGHT;
|
||||
} else if(model->nfc_field) {
|
||||
model->nfc_field--;
|
||||
}
|
||||
if(rfid_field) {
|
||||
model->rfid_field = FIELD_FOUND_WEIGHT;
|
||||
model->rfid_frequency = rfid_frequency;
|
||||
} else if(model->rfid_field) {
|
||||
model->rfid_field--;
|
||||
}
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_draw(
|
||||
Canvas* canvas,
|
||||
NfcRfidDetectorFieldPresenceModel* model) {
|
||||
canvas_clear(canvas);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
|
||||
if(!model->nfc_field && !model->rfid_field) {
|
||||
canvas_draw_icon(canvas, 0, 16, &I_Modern_reader_18x34);
|
||||
canvas_draw_icon(canvas, 22, 12, &I_Move_flipper_26x39);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str(canvas, 56, 36, "Touch the reader");
|
||||
} else {
|
||||
if(model->nfc_field) {
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, 21, 10, "NFC");
|
||||
canvas_draw_icon(
|
||||
canvas,
|
||||
9,
|
||||
17,
|
||||
NfcRfidDetectorFieldPresenceIcons[NfcRfidDetectorTypeFieldPresenceNfc]);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str(canvas, 9, 62, "13,56 MHz");
|
||||
}
|
||||
|
||||
if(model->rfid_field) {
|
||||
char str[16];
|
||||
snprintf(str, sizeof(str), "%.02f KHz", (double)model->rfid_frequency / 1000);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, 76, 10, "LF RFID");
|
||||
canvas_draw_icon(
|
||||
canvas,
|
||||
71,
|
||||
17,
|
||||
NfcRfidDetectorFieldPresenceIcons[NfcRfidDetectorTypeFieldPresenceRfid]);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str(canvas, 69, 62, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool nfc_rfid_detector_view_field_presence_input(InputEvent* event, void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorFieldPresence* instance = context;
|
||||
UNUSED(instance);
|
||||
|
||||
if(event->key == InputKeyBack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_enter(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorFieldPresence* instance = context;
|
||||
with_view_model(
|
||||
instance->view,
|
||||
NfcRfidDetectorFieldPresenceModel * model,
|
||||
{
|
||||
model->nfc_field = 0;
|
||||
model->rfid_field = 0;
|
||||
model->rfid_frequency = 0;
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_exit(void* context) {
|
||||
furi_assert(context);
|
||||
NfcRfidDetectorFieldPresence* instance = context;
|
||||
UNUSED(instance);
|
||||
}
|
||||
|
||||
NfcRfidDetectorFieldPresence* nfc_rfid_detector_view_field_presence_alloc() {
|
||||
NfcRfidDetectorFieldPresence* instance = malloc(sizeof(NfcRfidDetectorFieldPresence));
|
||||
|
||||
// View allocation and configuration
|
||||
instance->view = view_alloc();
|
||||
|
||||
view_allocate_model(
|
||||
instance->view, ViewModelTypeLocking, sizeof(NfcRfidDetectorFieldPresenceModel));
|
||||
view_set_context(instance->view, instance);
|
||||
view_set_draw_callback(
|
||||
instance->view, (ViewDrawCallback)nfc_rfid_detector_view_field_presence_draw);
|
||||
view_set_input_callback(instance->view, nfc_rfid_detector_view_field_presence_input);
|
||||
view_set_enter_callback(instance->view, nfc_rfid_detector_view_field_presence_enter);
|
||||
view_set_exit_callback(instance->view, nfc_rfid_detector_view_field_presence_exit);
|
||||
|
||||
with_view_model(
|
||||
instance->view,
|
||||
NfcRfidDetectorFieldPresenceModel * model,
|
||||
{
|
||||
model->nfc_field = 0;
|
||||
model->rfid_field = 0;
|
||||
model->rfid_frequency = 0;
|
||||
},
|
||||
true);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_free(NfcRfidDetectorFieldPresence* instance) {
|
||||
furi_assert(instance);
|
||||
|
||||
view_free(instance->view);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
View* nfc_rfid_detector_view_field_presence_get_view(NfcRfidDetectorFieldPresence* instance) {
|
||||
furi_assert(instance);
|
||||
return instance->view;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/view.h>
|
||||
#include "../helpers/nfc_rfid_detector_types.h"
|
||||
#include "../helpers/nfc_rfid_detector_event.h"
|
||||
|
||||
typedef struct NfcRfidDetectorFieldPresence NfcRfidDetectorFieldPresence;
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_update(
|
||||
NfcRfidDetectorFieldPresence* instance,
|
||||
bool nfc_field,
|
||||
bool rfid_field,
|
||||
uint32_t rfid_frequency);
|
||||
|
||||
NfcRfidDetectorFieldPresence* nfc_rfid_detector_view_field_presence_alloc();
|
||||
|
||||
void nfc_rfid_detector_view_field_presence_free(NfcRfidDetectorFieldPresence* instance);
|
||||
|
||||
View* nfc_rfid_detector_view_field_presence_get_view(NfcRfidDetectorFieldPresence* instance);
|
||||
@@ -8,6 +8,9 @@ App(
|
||||
order=70,
|
||||
fap_icon="nrfsniff_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@mothball187 & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="App captures addresses to use with NRF24 Mouse Jacker app to perform mousejack attacks",
|
||||
fap_private_libs=[
|
||||
Lib(
|
||||
name="nrf24",
|
||||
|
||||
@@ -9,4 +9,7 @@ App(
|
||||
fap_icon="playlist_10px.png",
|
||||
fap_category="Sub-GHz",
|
||||
fap_icon_assets="images",
|
||||
fap_author="@darmiel",
|
||||
fap_version="1.0",
|
||||
fap_description="App works with list of sub-ghz files from .txt file that contains paths to target files.",
|
||||
)
|
||||
|
||||
@@ -9,4 +9,7 @@ App(
|
||||
fap_icon="pocsag_pager_10px.png",
|
||||
fap_category="Sub-GHz",
|
||||
fap_icon_assets="images",
|
||||
fap_author="@xMasterX & @Shmuma",
|
||||
fap_version="1.0",
|
||||
fap_description="App can capture POCSAG 1200 messages on CC1101 supported frequencies.",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=50,
|
||||
fap_icon="appicon.png",
|
||||
fap_category="Sub-GHz",
|
||||
fap_author="@antirez & (fixes by @xMasterX)",
|
||||
fap_version="1.0",
|
||||
fap_description="Digital signal detection, visualization, editing and reply tool",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=80,
|
||||
fap_icon="safe_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@H4ckd4ddy & @xMasterX (ported to latest firmware)",
|
||||
fap_version="1.0",
|
||||
fap_description="App exploiting vulnerability to open any Sentry Safe and Master Lock electronic safe without any pin code via UART pins.",
|
||||
)
|
||||
|
||||
+4
-1
@@ -8,5 +8,8 @@ App(
|
||||
order=30,
|
||||
fap_icon="solitaire_10px.png",
|
||||
fap_category="Games",
|
||||
fap_icon_assets="assets"
|
||||
fap_icon_assets="assets",
|
||||
fap_author="@teeebor",
|
||||
fap_version="1.0",
|
||||
fap_description="Solitaire game",
|
||||
)
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=12,
|
||||
fap_icon="spectrum_10px.png",
|
||||
fap_category="Sub-GHz",
|
||||
fap_author="@xMasterX & @theY4Kman (original by @jolcese)",
|
||||
fap_version="1.0",
|
||||
fap_description="Shows received signals on spectrum, not actual analyzer, more like a demo app",
|
||||
)
|
||||
|
||||
+4
-1
@@ -8,5 +8,8 @@ App(
|
||||
order=10,
|
||||
fap_icon="icons/app.png",
|
||||
fap_category="GPIO",
|
||||
fap_icon_assets="icons"
|
||||
fap_icon_assets="icons",
|
||||
fap_author="@g3gg0 & (fixes by @xMasterX)",
|
||||
fap_version="1.0",
|
||||
fap_description="ARM SWD (Single Wire Debug) Probe",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=20,
|
||||
fap_icon="tetris_10px.png",
|
||||
fap_category="Games",
|
||||
fap_author="@xMasterX & @jeffplang",
|
||||
fap_version="1.0",
|
||||
fap_description="Tetris Game",
|
||||
)
|
||||
|
||||
@@ -12,4 +12,7 @@ App(
|
||||
fap_icon="icons/text_10px.png",
|
||||
fap_category="Misc",
|
||||
fap_icon_assets="icons",
|
||||
fap_author="@kowalski7cc & @kyhwana",
|
||||
fap_version="1.0",
|
||||
fap_description="Text viewer application",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=40,
|
||||
fap_icon="tictactoe_10px.png",
|
||||
fap_category="Games",
|
||||
fap_author="@xMasterX & @gotnull",
|
||||
fap_version="1.0",
|
||||
fap_description="Tic Tac Toe game, for 2 players, play on one device",
|
||||
)
|
||||
|
||||
@@ -9,4 +9,7 @@ App(
|
||||
fap_icon="uart_terminal.png",
|
||||
fap_category="GPIO",
|
||||
fap_icon_assets="assets",
|
||||
fap_author="@cool4uma & (some fixes by @xMasterX)",
|
||||
fap_version="1.0",
|
||||
fap_description="App to control various devices via UART interface.",
|
||||
)
|
||||
|
||||
+10
-5
@@ -79,7 +79,7 @@ static const SensorType* sensorTypes[] = {&DHT11, &DHT12_SW, &DHT20, &DHT
|
||||
&Dallas, &AM2320_SW, &AM2320_I2C, &HTU21x, &AHT10,
|
||||
&SHT30, &GXHT30, &LM75, &HDC1080, &BMP180,
|
||||
&BMP280, &BME280, &BME680, &MAX31855, &MAX6675,
|
||||
&SCD30};
|
||||
&SCD30, &SCD40};
|
||||
|
||||
const SensorType* unitemp_sensors_getTypeFromInt(uint8_t index) {
|
||||
if(index > SENSOR_TYPES_COUNT) return NULL;
|
||||
@@ -624,11 +624,16 @@ UnitempStatus unitemp_sensor_updateData(Sensor* sensor) {
|
||||
UNITEMP_DEBUG("Sensor %s update status %d", sensor->name, sensor->status);
|
||||
}
|
||||
|
||||
if(app->settings.temp_unit == UT_TEMP_FAHRENHEIT && sensor->status == UT_SENSORSTATUS_OK) {
|
||||
uintemp_celsiumToFarengate(sensor);
|
||||
}
|
||||
|
||||
if(sensor->status == UT_SENSORSTATUS_OK) {
|
||||
if(app->settings.heat_index &&
|
||||
((sensor->type->datatype & (UT_TEMPERATURE | UT_HUMIDITY)) ==
|
||||
(UT_TEMPERATURE | UT_HUMIDITY))) {
|
||||
unitemp_calculate_heat_index(sensor);
|
||||
}
|
||||
if(app->settings.temp_unit == UT_TEMP_FAHRENHEIT) {
|
||||
uintemp_celsiumToFarengate(sensor);
|
||||
}
|
||||
|
||||
sensor->temp += sensor->temp_offset / 10.f;
|
||||
if(app->settings.pressure_unit == UT_PRESSURE_MM_HG) {
|
||||
unitemp_pascalToMmHg(sensor);
|
||||
|
||||
+2
@@ -119,6 +119,7 @@ typedef struct Sensor {
|
||||
char* name;
|
||||
//Температура
|
||||
float temp;
|
||||
float heat_index;
|
||||
//Относительная влажность
|
||||
float hum;
|
||||
//Атмосферное давление
|
||||
@@ -334,4 +335,5 @@ const GPIO*
|
||||
#include "./sensors/MAX31855.h"
|
||||
#include "./sensors/MAX6675.h"
|
||||
#include "./sensors/SCD30.h"
|
||||
#include "./sensors/SCD40.h"
|
||||
#endif
|
||||
|
||||
+3
-2
@@ -9,8 +9,9 @@ App(
|
||||
stack_size=2 * 1024,
|
||||
order=100,
|
||||
fap_description = "Universal temperature sensors reader",
|
||||
fap_author = "Quenon",
|
||||
fap_weburl = "https://github.com/quen0n/Unitemp-Flipper-Zero-Plugin",
|
||||
fap_version="1.4",
|
||||
fap_author = "@quen0n & (fixes by @xMasterX)",
|
||||
fap_weburl = "https://github.com/quen0n/unitemp-flipperzero",
|
||||
fap_category="GPIO",
|
||||
fap_icon="icon.png",
|
||||
fap_icon_assets="assets",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Created by Avilov Vasily on 10.06.2023.
|
||||
//
|
||||
|
||||
#ifndef FLIPPERZERO_FIRMWARE_ENDIANNESS_H
|
||||
#define FLIPPERZERO_FIRMWARE_ENDIANNESS_H
|
||||
|
||||
inline static void store16(uint8_t* b, uint16_t i) {
|
||||
memcpy(b, &i, 2);
|
||||
}
|
||||
|
||||
inline static void store32(uint8_t* b, uint32_t i) {
|
||||
memcpy(b, &i, 4);
|
||||
}
|
||||
|
||||
inline static uint16_t load16(uint8_t* b) {
|
||||
uint16_t x;
|
||||
memcpy(&x, b, 2);
|
||||
return x;
|
||||
}
|
||||
|
||||
inline static uint32_t load32(uint8_t* b) {
|
||||
uint32_t x;
|
||||
memcpy(&x, b, 4);
|
||||
return x;
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define htobe16(x) (x)
|
||||
#define htobe32(x) (x)
|
||||
#define htole16(x) __builtin_bswap16(x)
|
||||
#define htole32(x) __builtin_bswap32(x)
|
||||
#define be16toh(x) (x)
|
||||
#define be32toh(x) (x)
|
||||
#define le16toh(x) __builtin_bswap16(x)
|
||||
#define le32toh(x) __builtin_bswap32(x)
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define htobe16(x) __builtin_bswap16(x)
|
||||
#define htobe32(x) __builtin_bswap32(x)
|
||||
#define htole16(x) (x)
|
||||
#define htole32(x) (x)
|
||||
#define be16toh(x) __builtin_bswap16(x)
|
||||
#define be32toh(x) __builtin_bswap32(x)
|
||||
#define le16toh(x) (x)
|
||||
#define le32toh(x) (x)
|
||||
#else
|
||||
#error "What kind of system is this?"
|
||||
#endif
|
||||
|
||||
#define load16_le(b) (le16toh(load16(b)))
|
||||
#define load32_le(b) (le32toh(load32(b)))
|
||||
#define store16_le(b, i) (store16(b, htole16(i)))
|
||||
#define store32_le(b, i) (store32(b, htole32(i)))
|
||||
|
||||
#define load16_be(b) (be16toh(load16(b)))
|
||||
#define load32_be(b) (be32toh(load32(b)))
|
||||
#define store16_be(b, i) (store16(b, htobe16(i)))
|
||||
#define store32_be(b, i) (store32(b, htobe32(i)))
|
||||
|
||||
#endif //FLIPPERZERO_FIRMWARE_ENDIANNESS_H
|
||||
+1
-52
@@ -21,60 +21,9 @@
|
||||
|
||||
#include "SCD30.h"
|
||||
#include "../interfaces/I2CSensor.h"
|
||||
#include "../interfaces/endianness.h"
|
||||
//#include <3rdparty/everest/include/everest/kremlin/c_endianness.h>
|
||||
|
||||
inline static uint16_t load16(uint8_t* b) {
|
||||
uint16_t x;
|
||||
memcpy(&x, b, 2);
|
||||
return x;
|
||||
}
|
||||
|
||||
inline static uint32_t load32(uint8_t* b) {
|
||||
uint32_t x;
|
||||
memcpy(&x, b, 4);
|
||||
return x;
|
||||
}
|
||||
|
||||
inline static void store16(uint8_t* b, uint16_t i) {
|
||||
memcpy(b, &i, 2);
|
||||
}
|
||||
|
||||
inline static void store32(uint8_t* b, uint32_t i) {
|
||||
memcpy(b, &i, 4);
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define htobe16(x) (x)
|
||||
#define htobe32(x) (x)
|
||||
#define htole16(x) __builtin_bswap16(x)
|
||||
#define htole32(x) __builtin_bswap32(x)
|
||||
#define be16toh(x) (x)
|
||||
#define be32toh(x) (x)
|
||||
#define le16toh(x) __builtin_bswap16(x)
|
||||
#define le32toh(x) __builtin_bswap32(x)
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define htobe16(x) __builtin_bswap16(x)
|
||||
#define htobe32(x) __builtin_bswap32(x)
|
||||
#define htole16(x) (x)
|
||||
#define htole32(x) (x)
|
||||
#define be16toh(x) __builtin_bswap16(x)
|
||||
#define be32toh(x) __builtin_bswap32(x)
|
||||
#define le16toh(x) (x)
|
||||
#define le32toh(x) (x)
|
||||
#else
|
||||
#error "What kind of system is this?"
|
||||
#endif
|
||||
|
||||
#define load16_le(b) (le16toh(load16(b)))
|
||||
#define load32_le(b) (le32toh(load32(b)))
|
||||
#define store16_le(b, i) (store16(b, htole16(i)))
|
||||
#define store32_le(b, i) (store32(b, htole32(i)))
|
||||
|
||||
#define load16_be(b) (be16toh(load16(b)))
|
||||
#define load32_be(b) (be32toh(load32(b)))
|
||||
#define store16_be(b, i) (store16(b, htobe16(i)))
|
||||
#define store32_be(b, i) (store32(b, htobe32(i)))
|
||||
|
||||
typedef union {
|
||||
uint16_t array16[2];
|
||||
uint8_t array8[4];
|
||||
|
||||
+291
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
Unitemp - Universal temperature reader
|
||||
Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n)
|
||||
Contributed by divinebird (https://github.com/divinebird)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Some information may be seen on https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library
|
||||
|
||||
#include "SCD30.h"
|
||||
#include "../interfaces/I2CSensor.h"
|
||||
#include "../interfaces/endianness.h"
|
||||
//#include <3rdparty/everest/include/everest/kremlin/c_endianness.h>
|
||||
|
||||
bool unitemp_SCD40_alloc(Sensor* sensor, char* args);
|
||||
bool unitemp_SCD40_init(Sensor* sensor);
|
||||
bool unitemp_SCD40_deinit(Sensor* sensor);
|
||||
UnitempStatus unitemp_SCD40_update(Sensor* sensor);
|
||||
bool unitemp_SCD40_free(Sensor* sensor);
|
||||
|
||||
const SensorType SCD40 = {
|
||||
.typename = "SCD40",
|
||||
.interface = &I2C,
|
||||
.datatype = UT_DATA_TYPE_TEMP_HUM_CO2,
|
||||
.pollingInterval = 5000,
|
||||
.allocator = unitemp_SCD40_alloc,
|
||||
.mem_releaser = unitemp_SCD40_free,
|
||||
.initializer = unitemp_SCD40_init,
|
||||
.deinitializer = unitemp_SCD40_deinit,
|
||||
.updater = unitemp_SCD40_update};
|
||||
|
||||
#define SCD40_ID 0x62
|
||||
|
||||
#define COMMAND_START_PERIODIC_MEASUREMENT 0X21B1
|
||||
#define COMMAND_READ_MEASUREMENT 0XEC05
|
||||
#define COMMAND_STOP_PERIODIC_MEASUREMENT 0X3F86
|
||||
|
||||
#define COMMAND_PERSIST_SETTINGS 0X3615
|
||||
#define COMMAND_GET_SERIAL_NUMBER 0X3682
|
||||
#define COMMAND_PERFORM_SELF_TEST 0X3639
|
||||
#define COMMAND_PERFORM_FACTORY_RESET 0X3632
|
||||
#define COMMAND_REINIT 0X3646
|
||||
|
||||
#define COMMAND_SET_TEMPERATURE_OFFSET 0X241D
|
||||
#define COMMAND_GET_TEMPERATURE_OFFSET 0X2318
|
||||
#define COMMAND_SET_SENSOR_ALTITUDE 0X2427
|
||||
#define COMMAND_GET_SENSOR_ALTITUDE 0X2322
|
||||
#define COMMAND_SET_AMBIENT_PRESSURE 0XE000
|
||||
#define COMMAND_PERFORM_FORCED_RECALIBRATION 0X362F
|
||||
#define COMMAND_SET_AUTOMATIC_SELF_CALIBRATION_ENABLED 0X2416
|
||||
#define COMMAND_GET_AUTOMATIC_SELF_CALIBRATION_ENABLED 0X2313
|
||||
|
||||
static bool readMeasurement(Sensor* sensor) __attribute__((unused));
|
||||
static void reset(Sensor* sensor) __attribute__((unused));
|
||||
|
||||
static bool setAutoSelfCalibration(Sensor* sensor, bool enable) __attribute__((unused));
|
||||
static bool getAutoSelfCalibration(Sensor* sensor) __attribute__((unused));
|
||||
|
||||
static bool getFirmwareVersion(Sensor* sensor, uint16_t* val) __attribute__((unused));
|
||||
|
||||
static float getTemperatureOffset(Sensor* sensor) __attribute__((unused));
|
||||
static bool setTemperatureOffset(Sensor* sensor, float tempOffset) __attribute__((unused));
|
||||
|
||||
static bool beginMeasuring(Sensor* sensor) __attribute__((unused));
|
||||
static bool stopMeasurement(Sensor* sensor) __attribute__((unused));
|
||||
|
||||
bool unitemp_SCD40_alloc(Sensor* sensor, char* args) {
|
||||
UNUSED(args);
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
|
||||
i2c_sensor->minI2CAdr = SCD40_ID << 1;
|
||||
i2c_sensor->maxI2CAdr = SCD40_ID << 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unitemp_SCD40_free(Sensor* sensor) {
|
||||
//Нечего высвобождать, так как ничего не было выделено
|
||||
UNUSED(sensor);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unitemp_SCD40_init(Sensor* sensor) {
|
||||
return beginMeasuring(sensor);
|
||||
}
|
||||
|
||||
bool unitemp_SCD40_deinit(Sensor* sensor) {
|
||||
return stopMeasurement(sensor);
|
||||
}
|
||||
|
||||
UnitempStatus unitemp_SCD40_update(Sensor* sensor) {
|
||||
readMeasurement(sensor);
|
||||
return UT_SENSORSTATUS_OK;
|
||||
}
|
||||
|
||||
#define CRC8_POLYNOMIAL 0x31
|
||||
#define CRC8_INIT 0xFF
|
||||
|
||||
static uint8_t computeCRC8(uint8_t* message, uint8_t len) {
|
||||
uint8_t crc = CRC8_INIT; // Init with 0xFF
|
||||
for(uint8_t x = 0; x < len; x++) {
|
||||
crc ^= message[x]; // XOR-in the next input byte
|
||||
for(uint8_t i = 0; i < 8; i++) {
|
||||
if((crc & 0x80) != 0)
|
||||
crc = (uint8_t)((crc << 1) ^ CRC8_POLYNOMIAL);
|
||||
else
|
||||
crc <<= 1;
|
||||
}
|
||||
}
|
||||
return crc; // No output reflection
|
||||
}
|
||||
|
||||
// Sends a command along with arguments and CRC
|
||||
static bool sendCommandWithCRC(Sensor* sensor, uint16_t command, uint16_t arguments) {
|
||||
static const uint8_t cmdSize = 5;
|
||||
|
||||
uint8_t bytes[cmdSize];
|
||||
uint8_t* pointer = bytes;
|
||||
store16_be(pointer, command);
|
||||
pointer += 2;
|
||||
uint8_t* argPos = pointer;
|
||||
store16_be(pointer, arguments);
|
||||
pointer += 2;
|
||||
*pointer = computeCRC8(argPos, pointer - argPos);
|
||||
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
return unitemp_i2c_writeArray(i2c_sensor, cmdSize, bytes);
|
||||
}
|
||||
|
||||
// Sends just a command, no arguments, no CRC
|
||||
static bool sendCommand(Sensor* sensor, uint16_t command) {
|
||||
static const uint8_t cmdSize = 2;
|
||||
|
||||
uint8_t bytes[cmdSize];
|
||||
store16_be(bytes, command);
|
||||
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
return unitemp_i2c_writeArray(i2c_sensor, cmdSize, bytes);
|
||||
}
|
||||
|
||||
static uint16_t readRegister(Sensor* sensor, uint16_t registerAddress) {
|
||||
static const uint8_t regSize = 2;
|
||||
|
||||
if(!sendCommand(sensor, registerAddress)) return 0; // Sensor did not ACK
|
||||
|
||||
furi_delay_ms(3);
|
||||
|
||||
uint8_t bytes[regSize];
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
if(!unitemp_i2c_readArray(i2c_sensor, regSize, bytes)) return 0;
|
||||
|
||||
return load16_be(bytes);
|
||||
}
|
||||
|
||||
static bool loadWord(uint8_t* buff, uint16_t* val) {
|
||||
uint16_t tmp = load16_be(buff);
|
||||
uint8_t expectedCRC = computeCRC8(buff, 2);
|
||||
if(buff[2] != expectedCRC) return false;
|
||||
*val = tmp;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getSettingValue(Sensor* sensor, uint16_t registerAddress, uint16_t* val) {
|
||||
static const uint8_t respSize = 3;
|
||||
|
||||
if(!sendCommand(sensor, registerAddress)) return false; // Sensor did not ACK
|
||||
|
||||
furi_delay_ms(3);
|
||||
|
||||
uint8_t bytes[respSize];
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
if(!unitemp_i2c_readArray(i2c_sensor, respSize, bytes)) return false;
|
||||
|
||||
return loadWord(bytes, val);
|
||||
}
|
||||
|
||||
// Get 18 bytes from SCD30
|
||||
// Updates global variables with floats
|
||||
// Returns true if success
|
||||
static bool readMeasurement(Sensor* sensor) {
|
||||
if(!sendCommand(sensor, COMMAND_READ_MEASUREMENT)) {
|
||||
FURI_LOG_E(APP_NAME, "Sensor did not ACK");
|
||||
return false; // Sensor did not ACK
|
||||
}
|
||||
|
||||
furi_delay_ms(3);
|
||||
|
||||
static const uint8_t respSize = 9;
|
||||
uint8_t buff[respSize];
|
||||
uint8_t* bytes = buff;
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
if(!unitemp_i2c_readArray(i2c_sensor, respSize, bytes)) {
|
||||
FURI_LOG_E(APP_NAME, "Error while read measures");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t tmpValue;
|
||||
|
||||
bool error = false;
|
||||
if(loadWord(bytes, &tmpValue)) {
|
||||
sensor->co2 = tmpValue;
|
||||
} else {
|
||||
FURI_LOG_E(APP_NAME, "Error while parsing CO2");
|
||||
error = true;
|
||||
}
|
||||
|
||||
bytes += 3;
|
||||
if(loadWord(bytes, &tmpValue)) {
|
||||
sensor->temp = (float)tmpValue * 175.0f / 65535.0f - 45.0f;
|
||||
} else {
|
||||
FURI_LOG_E(APP_NAME, "Error while parsing temp");
|
||||
error = true;
|
||||
}
|
||||
|
||||
bytes += 3;
|
||||
if(loadWord(bytes, &tmpValue)) {
|
||||
sensor->hum = (float)tmpValue * 100.0f / 65535.0f;
|
||||
} else {
|
||||
FURI_LOG_E(APP_NAME, "Error while parsing humidity");
|
||||
error = true;
|
||||
}
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
static void reset(Sensor* sensor) {
|
||||
sendCommand(sensor, COMMAND_REINIT);
|
||||
}
|
||||
|
||||
static bool setAutoSelfCalibration(Sensor* sensor, bool enable) {
|
||||
return sendCommandWithCRC(
|
||||
sensor, COMMAND_SET_AUTOMATIC_SELF_CALIBRATION_ENABLED, enable); // Activate continuous ASC
|
||||
}
|
||||
|
||||
// Get the current ASC setting
|
||||
static bool getAutoSelfCalibration(Sensor* sensor) {
|
||||
return 1 == readRegister(sensor, COMMAND_GET_AUTOMATIC_SELF_CALIBRATION_ENABLED);
|
||||
}
|
||||
|
||||
// Unfinished
|
||||
static bool getFirmwareVersion(Sensor* sensor, uint16_t* val) {
|
||||
if(!sendCommand(sensor, COMMAND_READ_MEASUREMENT)) {
|
||||
FURI_LOG_E(APP_NAME, "Sensor did not ACK");
|
||||
return false; // Sensor did not ACK
|
||||
}
|
||||
|
||||
static const uint8_t respSize = 9;
|
||||
uint8_t buff[respSize];
|
||||
uint8_t* bytes = buff;
|
||||
I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance;
|
||||
if(!unitemp_i2c_readArray(i2c_sensor, respSize, bytes)) {
|
||||
FURI_LOG_E(APP_NAME, "Error while read measures");
|
||||
return false;
|
||||
}
|
||||
|
||||
*val = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool beginMeasuring(Sensor* sensor) {
|
||||
return sendCommand(sensor, COMMAND_START_PERIODIC_MEASUREMENT);
|
||||
}
|
||||
|
||||
// Stop continuous measurement
|
||||
static bool stopMeasurement(Sensor* sensor) {
|
||||
return sendCommand(sensor, COMMAND_READ_MEASUREMENT);
|
||||
}
|
||||
|
||||
static float getTemperatureOffset(Sensor* sensor) {
|
||||
uint16_t curOffset;
|
||||
if(!getSettingValue(sensor, COMMAND_GET_TEMPERATURE_OFFSET, &curOffset)) return 0.0;
|
||||
return (float)curOffset * 175.0f / 65536.0f;
|
||||
}
|
||||
|
||||
static bool setTemperatureOffset(Sensor* sensor, float tempOffset) {
|
||||
uint16_t newOffset = tempOffset * 65536.0 / 175.0 + 0.5f;
|
||||
return sendCommandWithCRC(
|
||||
sensor, COMMAND_SET_TEMPERATURE_OFFSET, newOffset); // Activate continuous ASC
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Unitemp - Universal temperature reader
|
||||
Copyright (C) 2022-2023 Victor Nikitchuk (https://github.com/quen0n)
|
||||
Contributed by divinebird (https://github.com/divinebird)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef UNITEMP_SCD40
|
||||
#define UNITEMP_SCD40
|
||||
|
||||
#include "../unitemp.h"
|
||||
#include "../Sensors.h"
|
||||
|
||||
extern const SensorType SCD40;
|
||||
/**
|
||||
* @brief Выделение памяти и установка начальных значений датчика SCD40
|
||||
* @param sensor Указатель на создаваемый датчик
|
||||
* @return Истина при успехе
|
||||
*/
|
||||
bool unitemp_SCD40_alloc(Sensor* sensor, char* args);
|
||||
|
||||
/**
|
||||
* @brief Инициализации датчика SCD40
|
||||
* @param sensor Указатель на датчик
|
||||
* @return Истина если инициализация упспешная
|
||||
*/
|
||||
bool unitemp_SCD40_init(Sensor* sensor);
|
||||
|
||||
/**
|
||||
* @brief Деинициализация датчика
|
||||
* @param sensor Указатель на датчик
|
||||
*/
|
||||
bool unitemp_SCD40_deinit(Sensor* sensor);
|
||||
|
||||
/**
|
||||
* @brief Обновление значений из датчика
|
||||
* @param sensor Указатель на датчик
|
||||
* @return Статус опроса датчика
|
||||
*/
|
||||
UnitempStatus unitemp_SCD40_update(Sensor* sensor);
|
||||
|
||||
/**
|
||||
* @brief Высвободить память датчика
|
||||
* @param sensor Указатель на датчик
|
||||
*/
|
||||
bool unitemp_SCD40_free(Sensor* sensor);
|
||||
|
||||
#endif
|
||||
+30
@@ -28,8 +28,31 @@ Unitemp* app;
|
||||
|
||||
void uintemp_celsiumToFarengate(Sensor* sensor) {
|
||||
sensor->temp = sensor->temp * (9.0 / 5.0) + 32;
|
||||
sensor->heat_index = sensor->heat_index * (9.0 / 5.0) + 32;
|
||||
}
|
||||
|
||||
static float heat_index_consts[9] = {
|
||||
-42.379f,
|
||||
2.04901523f,
|
||||
10.14333127f,
|
||||
-0.22475541f,
|
||||
-0.00683783f,
|
||||
-0.05481717f,
|
||||
0.00122874f,
|
||||
0.00085282f,
|
||||
-0.00000199f};
|
||||
void unitemp_calculate_heat_index(Sensor* sensor) {
|
||||
// temp should be in Celsius, heat index will be in Celsius
|
||||
float temp = sensor->temp * (9.0 / 5.0) + 32.0f;
|
||||
float hum = sensor->hum;
|
||||
sensor->heat_index =
|
||||
(heat_index_consts[0] + heat_index_consts[1] * temp + heat_index_consts[2] * hum +
|
||||
heat_index_consts[3] * temp * hum + heat_index_consts[4] * temp * temp +
|
||||
heat_index_consts[5] * hum * hum + heat_index_consts[6] * temp * temp * hum +
|
||||
heat_index_consts[7] * temp * hum * hum + heat_index_consts[8] * temp * temp * hum * hum -
|
||||
32.0f) *
|
||||
(5.0 / 9.0);
|
||||
}
|
||||
void unitemp_pascalToMmHg(Sensor* sensor) {
|
||||
sensor->pressure = sensor->pressure * 0.007500638;
|
||||
}
|
||||
@@ -71,6 +94,7 @@ bool unitemp_saveSettings(void) {
|
||||
app->file_stream, "INFINITY_BACKLIGHT %d\n", app->settings.infinityBacklight);
|
||||
stream_write_format(app->file_stream, "TEMP_UNIT %d\n", app->settings.temp_unit);
|
||||
stream_write_format(app->file_stream, "PRESSURE_UNIT %d\n", app->settings.pressure_unit);
|
||||
stream_write_format(app->file_stream, "HEAT_INDEX %d\n", app->settings.heat_index);
|
||||
|
||||
//Закрытие потока и освобождение памяти
|
||||
file_stream_close(app->file_stream);
|
||||
@@ -166,6 +190,11 @@ bool unitemp_loadSettings(void) {
|
||||
int p = 0;
|
||||
sscanf(((char*)(file_buf + line_end)), "\nPRESSURE_UNIT %d", &p);
|
||||
app->settings.pressure_unit = p;
|
||||
} else if(!strcmp(buff, "HEAT_INDEX")) {
|
||||
//Чтение значения параметра
|
||||
int p = 0;
|
||||
sscanf(((char*)(file_buf + line_end)), "\nHEAT_INDEX %d", &p);
|
||||
app->settings.heat_index = p;
|
||||
} else {
|
||||
FURI_LOG_W(APP_NAME, "Unknown settings parameter: %s", buff);
|
||||
}
|
||||
@@ -203,6 +232,7 @@ static bool unitemp_alloc(void) {
|
||||
app->settings.infinityBacklight = true; //Подсветка горит всегда
|
||||
app->settings.temp_unit = UT_TEMP_CELSIUS; //Единица измерения температуры - градусы Цельсия
|
||||
app->settings.pressure_unit = UT_PRESSURE_MM_HG; //Единица измерения давления - мм рт. ст.
|
||||
app->settings.heat_index = false;
|
||||
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
//Диспетчер окон
|
||||
|
||||
+10
-1
@@ -40,7 +40,7 @@
|
||||
//Имя приложения
|
||||
#define APP_NAME "Unitemp"
|
||||
//Версия приложения
|
||||
#define UNITEMP_APP_VER "1.3"
|
||||
#define UNITEMP_APP_VER "1.4"
|
||||
//Путь хранения файлов плагина
|
||||
#define APP_PATH_FOLDER "/ext/unitemp"
|
||||
//Имя файла с настройками
|
||||
@@ -80,6 +80,8 @@ typedef struct {
|
||||
tempMeasureUnit temp_unit;
|
||||
//Единица измерения давления
|
||||
pressureMeasureUnit pressure_unit;
|
||||
// Do calculate and show heat index
|
||||
bool heat_index;
|
||||
//Последнее состояние OTG
|
||||
bool lastOTGState;
|
||||
} UnitempSettings;
|
||||
@@ -111,6 +113,13 @@ typedef struct {
|
||||
|
||||
/* Объявление прототипов функций */
|
||||
|
||||
/**
|
||||
* @brief Calculates the heat index in Celsius from the temperature and humidity and stores it in the sensor heat_index field
|
||||
*
|
||||
* @param sensor The sensor struct, with temperature in Celcius and humidity in percent
|
||||
*/
|
||||
void unitemp_calculate_heat_index(Sensor* sensor);
|
||||
|
||||
/**
|
||||
* @brief Перевод значения температуры датчика из Цельсия в Фаренгейты
|
||||
*
|
||||
|
||||
+46
-8
@@ -113,6 +113,33 @@ static void _draw_humidity(Canvas* canvas, Sensor* sensor, const uint8_t pos[2])
|
||||
canvas_draw_str(canvas, pos[0] + 27 + int_len / 2 + 4, pos[1] + 10 + 7, "%");
|
||||
}
|
||||
|
||||
static void _draw_heat_index(Canvas* canvas, Sensor* sensor, const uint8_t pos[2]) {
|
||||
canvas_draw_rframe(canvas, pos[0], pos[1], 54, 20, 3);
|
||||
canvas_draw_rframe(canvas, pos[0], pos[1], 54, 19, 3);
|
||||
|
||||
canvas_draw_icon(canvas, pos[0] + 3, pos[1] + 3, &I_heat_index_11x14);
|
||||
|
||||
int16_t heat_index_int = sensor->heat_index;
|
||||
int8_t heat_index_dec = abs((int16_t)(sensor->heat_index * 10) % 10);
|
||||
|
||||
snprintf(app->buff, BUFF_SIZE, "%d", heat_index_int);
|
||||
canvas_set_font(canvas, FontBigNumbers);
|
||||
canvas_draw_str_aligned(
|
||||
canvas,
|
||||
pos[0] + 27 + ((sensor->heat_index <= -10 || sensor->heat_index > 99) ? 5 : 0),
|
||||
pos[1] + 10,
|
||||
AlignCenter,
|
||||
AlignCenter,
|
||||
app->buff);
|
||||
|
||||
if(heat_index_int <= 99) {
|
||||
uint8_t int_len = canvas_string_width(canvas, app->buff);
|
||||
snprintf(app->buff, BUFF_SIZE, ".%d", heat_index_dec);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, pos[0] + 27 + int_len / 2 + 2, pos[1] + 10 + 7, app->buff);
|
||||
}
|
||||
}
|
||||
|
||||
static void _draw_pressure(Canvas* canvas, Sensor* sensor) {
|
||||
const uint8_t x = 29, y = 39;
|
||||
//Рисование рамки
|
||||
@@ -320,12 +347,23 @@ static void _draw_carousel_values(Canvas* canvas) {
|
||||
ColorWhite);
|
||||
break;
|
||||
case UT_DATA_TYPE_TEMP_HUM:
|
||||
_draw_temperature(
|
||||
canvas,
|
||||
unitemp_sensor_getActive(generalview_sensor_index),
|
||||
temp_positions[1][0],
|
||||
temp_positions[1][1],
|
||||
ColorWhite);
|
||||
if(!app->settings.heat_index) {
|
||||
_draw_temperature(
|
||||
canvas,
|
||||
unitemp_sensor_getActive(generalview_sensor_index),
|
||||
temp_positions[1][0],
|
||||
temp_positions[1][1],
|
||||
ColorWhite);
|
||||
} else {
|
||||
_draw_temperature(
|
||||
canvas,
|
||||
unitemp_sensor_getActive(generalview_sensor_index),
|
||||
temp_positions[2][0],
|
||||
temp_positions[2][1],
|
||||
ColorWhite);
|
||||
_draw_heat_index(
|
||||
canvas, unitemp_sensor_getActive(generalview_sensor_index), hum_positions[1]);
|
||||
}
|
||||
_draw_humidity(
|
||||
canvas, unitemp_sensor_getActive(generalview_sensor_index), hum_positions[0]);
|
||||
break;
|
||||
@@ -446,8 +484,8 @@ static void _draw_carousel_info(Canvas* canvas) {
|
||||
->currentI2CAdr >>
|
||||
1);
|
||||
canvas_draw_str(canvas, 57, 35, app->buff);
|
||||
canvas_draw_str(canvas, 54, 46, "15 (C0)");
|
||||
canvas_draw_str(canvas, 54, 58, "16 (C1)");
|
||||
canvas_draw_str(canvas, 54, 46, "15 (C1)");
|
||||
canvas_draw_str(canvas, 54, 58, "16 (C0)");
|
||||
}
|
||||
}
|
||||
static void _draw_view_sensorsCarousel(Canvas* canvas) {
|
||||
|
||||
@@ -26,6 +26,7 @@ static VariableItemList* variable_item_list;
|
||||
static const char states[2][9] = {"Auto", "Infinity"};
|
||||
static const char temp_units[UT_TEMP_COUNT][3] = {"*C", "*F"};
|
||||
static const char pressure_units[UT_PRESSURE_COUNT][6] = {"mm Hg", "in Hg", "kPa", "hPA"};
|
||||
static const char heat_index_bool[2][4] = {"OFF", "ON"};
|
||||
|
||||
//Элемент списка - бесконечная подсветка
|
||||
VariableItem* infinity_backlight_item;
|
||||
@@ -33,6 +34,8 @@ VariableItem* infinity_backlight_item;
|
||||
VariableItem* temperature_unit_item;
|
||||
//Единица измерения давления
|
||||
VariableItem* pressure_unit_item;
|
||||
|
||||
VariableItem* heat_index_item;
|
||||
#define VIEW_ID UnitempViewSettings
|
||||
|
||||
/**
|
||||
@@ -57,6 +60,7 @@ static uint32_t _exit_callback(void* context) {
|
||||
(bool)variable_item_get_current_value_index(infinity_backlight_item);
|
||||
app->settings.temp_unit = variable_item_get_current_value_index(temperature_unit_item);
|
||||
app->settings.pressure_unit = variable_item_get_current_value_index(pressure_unit_item);
|
||||
app->settings.heat_index = variable_item_get_current_value_index(heat_index_item);
|
||||
unitemp_saveSettings();
|
||||
unitemp_loadSettings();
|
||||
|
||||
@@ -90,6 +94,11 @@ static void _setting_change_callback(VariableItem* item) {
|
||||
pressure_unit_item,
|
||||
pressure_units[variable_item_get_current_value_index(pressure_unit_item)]);
|
||||
}
|
||||
if(item == heat_index_item) {
|
||||
variable_item_set_current_value_text(
|
||||
heat_index_item,
|
||||
heat_index_bool[variable_item_get_current_value_index(heat_index_item)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,6 +115,8 @@ void unitemp_Settings_alloc(void) {
|
||||
variable_item_list_add(variable_item_list, "Temp. unit", 2, _setting_change_callback, app);
|
||||
pressure_unit_item = variable_item_list_add(
|
||||
variable_item_list, "Press. unit", UT_PRESSURE_COUNT, _setting_change_callback, app);
|
||||
heat_index_item = variable_item_list_add(
|
||||
variable_item_list, "Calc. heat index", 2, _setting_change_callback, app);
|
||||
|
||||
//Добавление колбека на нажатие средней кнопки
|
||||
variable_item_list_set_enter_callback(variable_item_list, _enter_callback, app);
|
||||
@@ -139,6 +150,10 @@ void unitemp_Settings_switch(void) {
|
||||
pressure_unit_item,
|
||||
pressure_units[variable_item_get_current_value_index(pressure_unit_item)]);
|
||||
|
||||
variable_item_set_current_value_index(heat_index_item, (uint8_t)app->settings.heat_index);
|
||||
variable_item_set_current_value_text(
|
||||
heat_index_item, heat_index_bool[variable_item_get_current_value_index(heat_index_item)]);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, VIEW_ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
fap_icon="wav_10px.png",
|
||||
fap_category="Media",
|
||||
fap_icon_assets="images",
|
||||
fap_author="@DrZlo13 & (ported, fixed by @xMasterX), (improved by @LTVA1)",
|
||||
fap_version="1.0",
|
||||
fap_description="Audio player for WAV files, recommended to convert files to unsigned 8-bit PCM stereo, but it may work with others too",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=110,
|
||||
fap_icon="wifi_10px.png",
|
||||
fap_category="GPIO",
|
||||
fap_author="@SequoiaSan & @xMasterX",
|
||||
fap_version="1.0",
|
||||
fap_description="WiFi scanner module interface, based on ESP8266",
|
||||
)
|
||||
|
||||
@@ -8,4 +8,7 @@ App(
|
||||
order=280,
|
||||
fap_icon="zombie_10px.png",
|
||||
fap_category="Games",
|
||||
fap_author="@DevMilanIan & @xMasterX, (original By @Dooskington)",
|
||||
fap_version="1.0",
|
||||
fap_description="Defend your walls from the zombies",
|
||||
)
|
||||
|
||||
@@ -12,7 +12,6 @@ App(
|
||||
"subghz",
|
||||
"bad_usb",
|
||||
"u2f",
|
||||
"fap_loader",
|
||||
"archive",
|
||||
"clock",
|
||||
"subghz_remote",
|
||||
@@ -32,7 +31,6 @@ App(
|
||||
"subghz",
|
||||
#"bad_usb",
|
||||
#"u2f",
|
||||
"fap_loader",
|
||||
"archive",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <core/common_defines.h>
|
||||
#include <core/log.h>
|
||||
#include <gui/modules/file_browser_worker.h>
|
||||
#include <fap_loader/fap_loader_app.h>
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <math.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
@@ -381,7 +381,7 @@ void archive_add_app_item(ArchiveBrowserView* browser, const char* name) {
|
||||
static bool archive_get_fap_meta(FuriString* file_path, FuriString* fap_name, uint8_t** icon_ptr) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool success = false;
|
||||
if(fap_loader_load_name_and_icon(file_path, storage, icon_ptr, fap_name)) {
|
||||
if(flipper_application_load_name_and_icon(file_path, storage, icon_ptr, fap_name)) {
|
||||
success = true;
|
||||
}
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
@@ -11,17 +11,28 @@
|
||||
#define SCENE_STATE_DEFAULT (0)
|
||||
#define SCENE_STATE_NEED_REFRESH (1)
|
||||
|
||||
static const char* flipper_app_name[] = {
|
||||
[ArchiveFileTypeIButton] = "iButton",
|
||||
[ArchiveFileTypeNFC] = "NFC",
|
||||
[ArchiveFileTypeSubGhz] = "Sub-GHz",
|
||||
[ArchiveFileTypeLFRFID] = "125 kHz RFID",
|
||||
[ArchiveFileTypeInfrared] = "Infrared",
|
||||
[ArchiveFileTypeBadUsb] = "Bad USB",
|
||||
[ArchiveFileTypeU2f] = "U2F",
|
||||
[ArchiveFileTypeApplication] = "Applications",
|
||||
[ArchiveFileTypeUpdateManifest] = "UpdaterApp",
|
||||
};
|
||||
const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
|
||||
switch(file_type) {
|
||||
case ArchiveFileTypeIButton:
|
||||
return "iButton";
|
||||
case ArchiveFileTypeNFC:
|
||||
return "NFC";
|
||||
case ArchiveFileTypeSubGhz:
|
||||
return "Sub-GHz";
|
||||
case ArchiveFileTypeLFRFID:
|
||||
return "125 kHz RFID";
|
||||
case ArchiveFileTypeInfrared:
|
||||
return "Infrared";
|
||||
case ArchiveFileTypeBadUsb:
|
||||
return "Bad USB";
|
||||
case ArchiveFileTypeU2f:
|
||||
return "U2F";
|
||||
case ArchiveFileTypeUpdateManifest:
|
||||
return "UpdaterApp";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void archive_loader_callback(const void* message, void* context) {
|
||||
furi_assert(message);
|
||||
@@ -39,20 +50,20 @@ static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selec
|
||||
UNUSED(browser);
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
|
||||
LoaderStatus status;
|
||||
if(selected->is_app) {
|
||||
char* param = strrchr(furi_string_get_cstr(selected->path), '/');
|
||||
if(param != NULL) {
|
||||
param++;
|
||||
}
|
||||
status = loader_start(loader, flipper_app_name[selected->type], param);
|
||||
} else {
|
||||
status = loader_start(
|
||||
loader, flipper_app_name[selected->type], furi_string_get_cstr(selected->path));
|
||||
}
|
||||
const char* app_name = archive_get_flipper_app_name(selected->type);
|
||||
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
if(app_name) {
|
||||
if(selected->is_app) {
|
||||
char* param = strrchr(furi_string_get_cstr(selected->path), '/');
|
||||
if(param != NULL) {
|
||||
param++;
|
||||
}
|
||||
loader_start_with_gui_error(loader, app_name, param);
|
||||
} else {
|
||||
loader_start_with_gui_error(loader, app_name, furi_string_get_cstr(selected->path));
|
||||
}
|
||||
} else {
|
||||
loader_start_with_gui_error(loader, furi_string_get_cstr(selected->path), NULL);
|
||||
}
|
||||
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
@@ -464,9 +464,24 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||
browser->view,
|
||||
ArchiveBrowserViewModel * model,
|
||||
{
|
||||
int32_t scroll_speed = 1;
|
||||
if(model->button_held_for_ticks > 5) {
|
||||
if(model->button_held_for_ticks % 2) {
|
||||
scroll_speed = 0;
|
||||
} else {
|
||||
scroll_speed = model->button_held_for_ticks > 9 ? 4 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(event->key == InputKeyUp) {
|
||||
model->item_idx =
|
||||
((model->item_idx - 1) + model->item_cnt) % model->item_cnt;
|
||||
if(model->item_idx < scroll_speed) {
|
||||
model->button_held_for_ticks = 0;
|
||||
model->item_idx = model->item_cnt - 1;
|
||||
} else {
|
||||
model->item_idx =
|
||||
((model->item_idx - scroll_speed) + model->item_cnt) %
|
||||
model->item_cnt;
|
||||
}
|
||||
if(is_file_list_load_required(model)) {
|
||||
model->list_loading = true;
|
||||
browser->callback(ArchiveBrowserEventLoadPrevItems, browser->context);
|
||||
@@ -475,8 +490,15 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||
browser->callback(ArchiveBrowserEventFavMoveUp, browser->context);
|
||||
}
|
||||
model->scroll_counter = 0;
|
||||
model->button_held_for_ticks += 1;
|
||||
} else if(event->key == InputKeyDown) {
|
||||
model->item_idx = (model->item_idx + 1) % model->item_cnt;
|
||||
int32_t count = model->item_cnt;
|
||||
if(model->item_idx + scroll_speed >= count) {
|
||||
model->button_held_for_ticks = 0;
|
||||
model->item_idx = 0;
|
||||
} else {
|
||||
model->item_idx = (model->item_idx + scroll_speed) % model->item_cnt;
|
||||
}
|
||||
if(is_file_list_load_required(model)) {
|
||||
model->list_loading = true;
|
||||
browser->callback(ArchiveBrowserEventLoadNextItems, browser->context);
|
||||
@@ -485,6 +507,7 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||
browser->callback(ArchiveBrowserEventFavMoveDown, browser->context);
|
||||
}
|
||||
model->scroll_counter = 0;
|
||||
model->button_held_for_ticks += 1;
|
||||
}
|
||||
},
|
||||
false);
|
||||
@@ -521,6 +544,14 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
if(event->type == InputTypeRelease) {
|
||||
with_view_model(
|
||||
browser->view,
|
||||
ArchiveBrowserViewModel * model,
|
||||
{ model->button_held_for_ticks = 0; },
|
||||
true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ typedef struct {
|
||||
int32_t array_offset;
|
||||
int32_t list_offset;
|
||||
size_t scroll_counter;
|
||||
|
||||
uint32_t button_held_for_ticks;
|
||||
} ArchiveBrowserViewModel;
|
||||
|
||||
void archive_browser_set_callback(
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
App(
|
||||
appid="fap_loader",
|
||||
name="Applications",
|
||||
apptype=FlipperAppType.APP,
|
||||
entry_point="fap_loader_app",
|
||||
cdefines=["APP_FAP_LOADER"],
|
||||
requires=[
|
||||
"gui",
|
||||
"storage",
|
||||
"loader",
|
||||
],
|
||||
stack_size=int(1.5 * 1024),
|
||||
icon="A_Plugins_14",
|
||||
order=9,
|
||||
)
|
||||
@@ -1,243 +0,0 @@
|
||||
#include "fap_loader_app.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal_debug.h>
|
||||
|
||||
#include <assets_icons.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/loading.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <toolbox/path.h>
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
#define TAG "FapLoader"
|
||||
|
||||
struct FapLoader {
|
||||
FlipperApplication* app;
|
||||
Storage* storage;
|
||||
DialogsApp* dialogs;
|
||||
Gui* gui;
|
||||
FuriString* fap_path;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
Loading* loading;
|
||||
};
|
||||
|
||||
bool fap_loader_load_name_and_icon(
|
||||
FuriString* path,
|
||||
Storage* storage,
|
||||
uint8_t** icon_ptr,
|
||||
FuriString* item_name) {
|
||||
FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface);
|
||||
|
||||
FlipperApplicationPreloadStatus preload_res =
|
||||
flipper_application_preload_manifest(app, furi_string_get_cstr(path));
|
||||
|
||||
bool load_success = false;
|
||||
|
||||
if(preload_res == FlipperApplicationPreloadStatusSuccess) {
|
||||
const FlipperApplicationManifest* manifest = flipper_application_get_manifest(app);
|
||||
if(manifest->has_icon) {
|
||||
memcpy(*icon_ptr, manifest->icon, FAP_MANIFEST_MAX_ICON_SIZE);
|
||||
}
|
||||
furi_string_set(item_name, manifest->name);
|
||||
load_success = true;
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "FAP Loader failed to preload %s", furi_string_get_cstr(path));
|
||||
load_success = false;
|
||||
}
|
||||
|
||||
flipper_application_free(app);
|
||||
return load_success;
|
||||
}
|
||||
|
||||
static bool fap_loader_item_callback(
|
||||
FuriString* path,
|
||||
void* context,
|
||||
uint8_t** icon_ptr,
|
||||
FuriString* item_name) {
|
||||
FapLoader* fap_loader = context;
|
||||
furi_assert(fap_loader);
|
||||
return fap_loader_load_name_and_icon(path, fap_loader->storage, icon_ptr, item_name);
|
||||
}
|
||||
|
||||
static bool fap_loader_run_selected_app(FapLoader* loader, bool ignore_mismatch) {
|
||||
furi_assert(loader);
|
||||
|
||||
FuriString* error_message;
|
||||
|
||||
error_message = furi_string_alloc_set("unknown error");
|
||||
|
||||
bool file_selected = false;
|
||||
bool show_error = true;
|
||||
bool retry = false;
|
||||
do {
|
||||
file_selected = true;
|
||||
loader->app = flipper_application_alloc(loader->storage, firmware_api_interface);
|
||||
size_t start = furi_get_tick();
|
||||
|
||||
FURI_LOG_I(TAG, "FAP Loader is loading %s", furi_string_get_cstr(loader->fap_path));
|
||||
|
||||
FlipperApplicationPreloadStatus preload_res =
|
||||
flipper_application_preload(loader->app, furi_string_get_cstr(loader->fap_path));
|
||||
if(preload_res != FlipperApplicationPreloadStatusSuccess) {
|
||||
if(preload_res == FlipperApplicationPreloadStatusApiMismatch) {
|
||||
if(!ignore_mismatch) {
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
dialog_message_set_header(
|
||||
message, "API Mismatch", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(message, "Cancel", NULL, "Continue");
|
||||
dialog_message_set_text(
|
||||
message,
|
||||
"This app might not\nwork correctly\nContinue anyways?",
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
if(dialog_message_show(loader->dialogs, message) == DialogMessageButtonRight) {
|
||||
retry = true;
|
||||
}
|
||||
dialog_message_free(message);
|
||||
show_error = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
const char* err_msg = flipper_application_preload_status_to_string(preload_res);
|
||||
furi_string_printf(error_message, "Preload failed: %s", err_msg);
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"FAP Loader failed to preload %s: %s",
|
||||
furi_string_get_cstr(loader->fap_path),
|
||||
err_msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FURI_LOG_I(TAG, "FAP Loader is mapping");
|
||||
FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(loader->app);
|
||||
if(load_status != FlipperApplicationLoadStatusSuccess) {
|
||||
const char* err_msg = flipper_application_load_status_to_string(load_status);
|
||||
furi_string_printf(error_message, "Load failed: %s", err_msg);
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"FAP Loader failed to map to memory %s: %s",
|
||||
furi_string_get_cstr(loader->fap_path),
|
||||
err_msg);
|
||||
break;
|
||||
}
|
||||
|
||||
FURI_LOG_I(TAG, "Loaded in %ums", (size_t)(furi_get_tick() - start));
|
||||
FURI_LOG_I(TAG, "FAP Loader is starting app");
|
||||
|
||||
FuriThread* thread = flipper_application_spawn(loader->app, NULL);
|
||||
|
||||
/* This flag is set by the debugger - to break on app start */
|
||||
if(furi_hal_debug_is_gdb_session_active()) {
|
||||
FURI_LOG_W(TAG, "Triggering BP for debugger");
|
||||
/* After hitting this, you can set breakpoints in your .fap's code
|
||||
* Note that you have to toggle breakpoints that were set before */
|
||||
__asm volatile("bkpt 0");
|
||||
}
|
||||
|
||||
FuriString* app_name = furi_string_alloc();
|
||||
path_extract_filename_no_ext(furi_string_get_cstr(loader->fap_path), app_name);
|
||||
furi_thread_set_appid(thread, furi_string_get_cstr(app_name));
|
||||
furi_string_free(app_name);
|
||||
|
||||
furi_thread_start(thread);
|
||||
furi_thread_join(thread);
|
||||
|
||||
show_error = false;
|
||||
int ret = furi_thread_get_return_code(thread);
|
||||
|
||||
FURI_LOG_I(TAG, "FAP app returned: %i", ret);
|
||||
} while(0);
|
||||
|
||||
if(show_error) {
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
dialog_message_set_header(message, "Error", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(message, NULL, NULL, NULL);
|
||||
|
||||
FuriString* buffer;
|
||||
buffer = furi_string_alloc();
|
||||
furi_string_printf(buffer, "%s", furi_string_get_cstr(error_message));
|
||||
furi_string_replace(buffer, ":", "\n");
|
||||
dialog_message_set_text(
|
||||
message, furi_string_get_cstr(buffer), 64, 32, AlignCenter, AlignCenter);
|
||||
|
||||
dialog_message_show(loader->dialogs, message);
|
||||
dialog_message_free(message);
|
||||
furi_string_free(buffer);
|
||||
}
|
||||
|
||||
furi_string_free(error_message);
|
||||
|
||||
if(file_selected) {
|
||||
flipper_application_free(loader->app);
|
||||
}
|
||||
|
||||
return retry;
|
||||
}
|
||||
|
||||
static bool fap_loader_select_app(FapLoader* loader) {
|
||||
const DialogsFileBrowserOptions browser_options = {
|
||||
.extension = ".fap",
|
||||
.skip_assets = true,
|
||||
.icon = &I_unknown_10px,
|
||||
.hide_ext = true,
|
||||
.item_loader_callback = fap_loader_item_callback,
|
||||
.item_loader_context = loader,
|
||||
.base_path = EXT_PATH("apps"),
|
||||
};
|
||||
|
||||
return dialog_file_browser_show(
|
||||
loader->dialogs, loader->fap_path, loader->fap_path, &browser_options);
|
||||
}
|
||||
|
||||
static FapLoader* fap_loader_alloc(const char* path) {
|
||||
FapLoader* loader = malloc(sizeof(FapLoader)); //-V799
|
||||
loader->fap_path = furi_string_alloc_set(path);
|
||||
loader->storage = furi_record_open(RECORD_STORAGE);
|
||||
loader->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
loader->gui = furi_record_open(RECORD_GUI);
|
||||
loader->view_dispatcher = view_dispatcher_alloc();
|
||||
loader->loading = loading_alloc();
|
||||
view_dispatcher_attach_to_gui(
|
||||
loader->view_dispatcher, loader->gui, ViewDispatcherTypeFullscreen);
|
||||
view_dispatcher_add_view(loader->view_dispatcher, 0, loading_get_view(loader->loading));
|
||||
return loader;
|
||||
} //-V773
|
||||
|
||||
static void fap_loader_free(FapLoader* loader) {
|
||||
view_dispatcher_remove_view(loader->view_dispatcher, 0);
|
||||
loading_free(loader->loading);
|
||||
view_dispatcher_free(loader->view_dispatcher);
|
||||
furi_string_free(loader->fap_path);
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
free(loader);
|
||||
}
|
||||
|
||||
int32_t fap_loader_app(void* p) {
|
||||
FapLoader* loader;
|
||||
if(p) {
|
||||
loader = fap_loader_alloc((const char*)p);
|
||||
view_dispatcher_switch_to_view(loader->view_dispatcher, 0);
|
||||
if(fap_loader_run_selected_app(loader, false)) {
|
||||
fap_loader_run_selected_app(loader, true);
|
||||
}
|
||||
} else {
|
||||
loader = fap_loader_alloc(EXT_PATH("apps"));
|
||||
while(fap_loader_select_app(loader)) {
|
||||
view_dispatcher_switch_to_view(loader->view_dispatcher, 0);
|
||||
if(fap_loader_run_selected_app(loader, false)) {
|
||||
fap_loader_run_selected_app(loader, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fap_loader_free(loader);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
#include <storage/storage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct FapLoader FapLoader;
|
||||
|
||||
/**
|
||||
* @brief Load name and icon from FAP file.
|
||||
*
|
||||
* @param path Path to FAP file.
|
||||
* @param storage Storage instance.
|
||||
* @param icon_ptr Icon pointer.
|
||||
* @param item_name Application name.
|
||||
* @return true if icon and name were loaded successfully.
|
||||
*/
|
||||
bool fap_loader_load_name_and_icon(
|
||||
FuriString* path,
|
||||
Storage* storage,
|
||||
uint8_t** icon_ptr,
|
||||
FuriString* item_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -4,9 +4,9 @@
|
||||
#include <gui/icon.h>
|
||||
|
||||
typedef enum {
|
||||
FlipperApplicationFlagDefault = 0,
|
||||
FlipperApplicationFlagInsomniaSafe = (1 << 0),
|
||||
} FlipperApplicationFlag;
|
||||
FlipperInternalApplicationFlagDefault = 0,
|
||||
FlipperInternalApplicationFlagInsomniaSafe = (1 << 0),
|
||||
} FlipperInternalApplicationFlag;
|
||||
|
||||
typedef struct {
|
||||
const FuriThreadCallback app;
|
||||
@@ -14,48 +14,41 @@ typedef struct {
|
||||
const char* appid;
|
||||
const size_t stack_size;
|
||||
const Icon* icon;
|
||||
const FlipperApplicationFlag flags;
|
||||
} FlipperApplication;
|
||||
const FlipperInternalApplicationFlag flags;
|
||||
} FlipperInternalApplication;
|
||||
|
||||
typedef void (*FlipperOnStartHook)(void);
|
||||
typedef void (*FlipperInternalOnStartHook)(void);
|
||||
|
||||
extern const char* FLIPPER_AUTORUN_APP_NAME;
|
||||
|
||||
/* Services list
|
||||
* Spawned on startup
|
||||
*/
|
||||
extern const FlipperApplication FLIPPER_SERVICES[];
|
||||
extern const FlipperInternalApplication FLIPPER_SERVICES[];
|
||||
extern const size_t FLIPPER_SERVICES_COUNT;
|
||||
|
||||
/* Apps list
|
||||
* Spawned by loader
|
||||
*/
|
||||
extern const FlipperApplication FLIPPER_APPS[];
|
||||
extern const FlipperInternalApplication FLIPPER_APPS[];
|
||||
extern const size_t FLIPPER_APPS_COUNT;
|
||||
|
||||
/* On system start hooks
|
||||
* Called by loader, after OS initialization complete
|
||||
*/
|
||||
extern const FlipperOnStartHook FLIPPER_ON_SYSTEM_START[];
|
||||
extern const FlipperInternalOnStartHook FLIPPER_ON_SYSTEM_START[];
|
||||
extern const size_t FLIPPER_ON_SYSTEM_START_COUNT;
|
||||
|
||||
/* System apps
|
||||
* Can only be spawned by loader by name
|
||||
*/
|
||||
extern const FlipperApplication FLIPPER_SYSTEM_APPS[];
|
||||
extern const FlipperInternalApplication FLIPPER_SYSTEM_APPS[];
|
||||
extern const size_t FLIPPER_SYSTEM_APPS_COUNT;
|
||||
|
||||
/* Separate scene app holder
|
||||
* Spawned by loader
|
||||
*/
|
||||
extern const FlipperApplication FLIPPER_SCENE;
|
||||
extern const FlipperApplication FLIPPER_SCENE_APPS[];
|
||||
extern const size_t FLIPPER_SCENE_APPS_COUNT;
|
||||
|
||||
extern const FlipperApplication FLIPPER_ARCHIVE;
|
||||
extern const FlipperInternalApplication FLIPPER_ARCHIVE;
|
||||
|
||||
/* Settings list
|
||||
* Spawned by loader
|
||||
*/
|
||||
extern const FlipperApplication FLIPPER_SETTINGS_APPS[];
|
||||
extern const FlipperInternalApplication FLIPPER_SETTINGS_APPS[];
|
||||
extern const size_t FLIPPER_SETTINGS_APPS_COUNT;
|
||||
|
||||
@@ -37,6 +37,7 @@ static void desktop_loader_callback(const void* message, void* context) {
|
||||
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
|
||||
}
|
||||
}
|
||||
|
||||
static void desktop_lock_icon_draw_callback(Canvas* canvas, void* context) {
|
||||
UNUSED(context);
|
||||
furi_assert(canvas);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <toolbox/saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define DESKTOP_SETTINGS_VER (10)
|
||||
#define DESKTOP_SETTINGS_VER (11)
|
||||
|
||||
#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
|
||||
#define DESKTOP_SETTINGS_MAGIC (0x17)
|
||||
|
||||
@@ -36,7 +36,8 @@ static void desktop_scene_main_interact_animation_callback(void* context) {
|
||||
}
|
||||
|
||||
#ifdef APP_ARCHIVE
|
||||
static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* flipper_app) {
|
||||
static void
|
||||
desktop_switch_to_app(Desktop* desktop, const FlipperInternalApplication* flipper_app) {
|
||||
furi_assert(desktop);
|
||||
furi_assert(flipper_app);
|
||||
furi_assert(flipper_app->app);
|
||||
@@ -63,33 +64,19 @@ static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* fl
|
||||
#endif
|
||||
|
||||
static void desktop_scene_main_open_app_or_profile(Desktop* desktop, const char* path) {
|
||||
do {
|
||||
LoaderStatus status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, path);
|
||||
if(status == LoaderStatusOk) break;
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
|
||||
status = loader_start(desktop->loader, "Passport", NULL);
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
} while(false);
|
||||
if(loader_start_with_gui_error(desktop->loader, path, NULL) != LoaderStatusOk) {
|
||||
loader_start(desktop->loader, "Passport", NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void desktop_scene_main_start_favorite(Desktop* desktop, FavoriteApp* application) {
|
||||
LoaderStatus status = LoaderStatusErrorInternal;
|
||||
if(application->is_external) {
|
||||
status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, application->name_or_path);
|
||||
} else if(strlen(application->name_or_path) > 0) {
|
||||
status = loader_start(desktop->loader, application->name_or_path, NULL);
|
||||
if(strlen(application->name_or_path) > 4) {
|
||||
loader_start_with_gui_error(desktop->loader, application->name_or_path, NULL);
|
||||
} else {
|
||||
// No favourite app is set! So we skipping this part
|
||||
return;
|
||||
//status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, NULL);
|
||||
}
|
||||
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
}
|
||||
|
||||
void desktop_scene_main_callback(DesktopEvent event, void* context) {
|
||||
@@ -152,10 +139,7 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
|
||||
case DesktopMainEventOpenPowerOff: {
|
||||
LoaderStatus status = loader_start(desktop->loader, "Power", "off");
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
loader_start(desktop->loader, "Power", "off", NULL);
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
@@ -185,18 +169,12 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
case DesktopAnimationEventInteractAnimation:
|
||||
if(!animation_manager_interact_process(desktop->animation_manager)) {
|
||||
LoaderStatus status = loader_start(desktop->loader, "Passport", NULL);
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
loader_start(desktop->loader, "Passport", NULL, NULL);
|
||||
}
|
||||
consumed = true;
|
||||
break;
|
||||
case DesktopMainEventOpenPassport: {
|
||||
LoaderStatus status = loader_start(desktop->loader, "Passport", NULL);
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
loader_start(desktop->loader, "Passport", NULL, NULL);
|
||||
break;
|
||||
}
|
||||
case DesktopMainEventOpenGameMenu: {
|
||||
|
||||
@@ -16,7 +16,8 @@ typedef struct DialogsApp DialogsApp;
|
||||
/****************** FILE BROWSER ******************/
|
||||
|
||||
/**
|
||||
* File browser dialog extra options
|
||||
* File browser dialog extra options.
|
||||
* This can be default-initialized using {@link dialog_file_browser_set_basic_options}.
|
||||
* @param extension file extension to be offered for selection
|
||||
* @param base_path root folder path for navigation with back key
|
||||
* @param skip_assets true - do not show assets folders
|
||||
@@ -38,8 +39,10 @@ typedef struct {
|
||||
} DialogsFileBrowserOptions;
|
||||
|
||||
/**
|
||||
* Initialize file browser dialog options
|
||||
* and set default values
|
||||
* Initialize file browser dialog options and set default values.
|
||||
* This is guaranteed to initialize all fields
|
||||
* so it is safe to pass pointer to uninitialized {@code options}
|
||||
* and assume that the data behind it becomes fully initialized after the call.
|
||||
* @param options pointer to options structure
|
||||
* @param extension file extension to filter
|
||||
* @param icon file icon pointer, NULL for default icon
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user