Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge with flipperdevices #1

Merged
merged 26 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9ffcc52
Mifare Ultralight authentication (#1365)
ezhevita Aug 7, 2022
67a9753
Add a Mifare Classic info screen to parser output (#1504)
Astrrra Aug 7, 2022
f3d7d7d
Extend random name generator (#1551)
ppseprus Aug 7, 2022
173c941
NFC: Add Skylanders support (#1553)
gornekich Aug 7, 2022
81b404a
Add ability to type a space with the input keyboard by long-pressing …
Maycuz Aug 7, 2022
416cce9
[FL-2718, FL-2719] SubGhz: add protocol BERNER / ELKA / TEDSEN / TEL…
Skorpionm Aug 7, 2022
a7316e7
Added support for Samsung TVs using address 07. (#1509)
Mastahh Aug 7, 2022
ca23d0c
fix building updater package (#1564)
xMasterX Aug 9, 2022
01eb92d
Mifare Classic emulation fixes (#1566)
Astrrra Aug 9, 2022
1d50a59
[FL-2059] Storage fixes for handling empty files (#1563)
hedger Aug 9, 2022
add2497
rpc: additional verification of message data (#1576)
hedger Aug 11, 2022
fae392d
[FL-2677] SubGhz: region provisioning (#1574)
skotopes Aug 11, 2022
ba0502a
SubGhz: show region provisioning message (#1580)
skotopes Aug 11, 2022
79d9731
fix: typo badusb demo windows (#1579)
vrifox Aug 11, 2022
a39111a
[FL-2723] SubGhz: add protocol Honeywell_WDB / Doorbell (#1560)
Skorpionm Aug 11, 2022
874eb46
rpc: fixed missing read blocks (#1581)
hedger Aug 11, 2022
aab8ce5
Skip empty lines in favorites.txt (#1571)
nminaylov Aug 11, 2022
36b8dfe
[FL-2729] SubGhz: fix bett decoder (#1573)
Skorpionm Aug 11, 2022
a5a79c5
[FL-2705] RPC APP fixes #1568
nminaylov Aug 11, 2022
e0b184c
Scripts: add new region to otp generator (#1582)
skotopes Aug 11, 2022
1db7632
fbt: clear PYTHONPATH in env setup (#1585)
GMMan Aug 12, 2022
6ee2c15
FuriHal,About,Desktop: show provisioned region (#1589)
skotopes Aug 12, 2022
c846bca
FuriHal: do not enable LSECSS if BORRST is active (#1590)
hedger Aug 12, 2022
1655366
[FL-2728] Fix Null Pointer Dereference errors in IR #1583
gsurkov Aug 12, 2022
9e452d2
[FL-2735] IR green LED fix (#1591)
gsurkov Aug 12, 2022
e1ffb4a
fbt: support for LOADER_AUTOSTART; post-build size stats (#1594)
hedger Aug 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vscode/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Visual Studio Code workspace for Flipper Zero

## Setup

* To start developing with VSCode, run `./fbt vscode_dist` in project root. _That should only be done once_
* After that, open firmware folder in VSCode: "File" > "Open folder"

For more details on fbt, see [fbt docs](../documentation/fbt.md).


## Workflow

Commands for building firmware are invoked through Build menu: Ctrl+Shift+B.

To attach a debugging session, first build and flash firmware, then choose your debug probe in Debug menu (Ctrl+Shift+D).

Note that you have to detach debugging session before rebuilding and re-flashing firmware.
4 changes: 2 additions & 2 deletions .vscode/example/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
"label": "[Release] Build update bundle",
"group": "build",
"type": "shell",
"command": "./fbt update_package COMPACT=1 DEBUG=0"
"command": "./fbt updater_package COMPACT=1 DEBUG=0"
},
{
"label": "[Debug] Build update bundle",
"group": "build",
"type": "shell",
"command": "./fbt update_package"
"command": "./fbt updater_package"
},
{
"label": "[Release] Build updater",
Expand Down
4 changes: 3 additions & 1 deletion applications/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <gui/modules/empty_screen.h>
#include <m-string.h>
#include <furi_hal_version.h>
#include <furi_hal_region.h>
#include <furi_hal_bt.h>

typedef DialogMessageButton (*AboutDialogScreen)(DialogsApp* dialogs, DialogMessage* message);
Expand Down Expand Up @@ -83,12 +84,13 @@ static DialogMessageButton hw_version_screen(DialogsApp* dialogs, DialogMessage*

string_cat_printf(
buffer,
"%d.F%dB%dC%d %s %s\n",
"%d.F%dB%dC%d %s:%s %s\n",
furi_hal_version_get_hw_version(),
furi_hal_version_get_hw_target(),
furi_hal_version_get_hw_body(),
furi_hal_version_get_hw_connect(),
furi_hal_version_get_hw_region_name(),
furi_hal_region_get_name(),
my_name ? my_name : "Unknown");

string_cat_printf(buffer, "Serial Number:\n");
Expand Down
4 changes: 2 additions & 2 deletions applications/accessor/accessor_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ void AccessorApp::run(void) {
}

AccessorApp::AccessorApp() {
notification = static_cast<NotificationApp*>(furi_record_open("notification"));
notification = static_cast<NotificationApp*>(furi_record_open(RECORD_NOTIFICATION));
onewire_host = onewire_host_alloc();
furi_hal_power_enable_otg();
}

AccessorApp::~AccessorApp() {
furi_hal_power_disable_otg();
furi_record_close("notification");
furi_record_close(RECORD_NOTIFICATION);
onewire_host_free(onewire_host);
}

Expand Down
3 changes: 2 additions & 1 deletion applications/accessor/accessor_view_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AccessorAppViewManager::AccessorAppViewManager() {
popup = popup_alloc();
add_view(ViewType::Popup, popup_get_view(popup));

gui = static_cast<Gui*>(furi_record_open("gui"));
gui = static_cast<Gui*>(furi_record_open(RECORD_GUI));
view_dispatcher_attach_to_gui(view_dispatcher, gui, ViewDispatcherTypeFullscreen);

// set previous view callback for all views
Expand All @@ -31,6 +31,7 @@ AccessorAppViewManager::~AccessorAppViewManager() {
view_dispatcher, static_cast<uint32_t>(AccessorAppViewManager::ViewType::Popup));

// free view modules
furi_record_close(RECORD_GUI);
submenu_free(submenu);
popup_free(popup);

Expand Down
2 changes: 2 additions & 0 deletions applications/applications.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ typedef struct {

typedef void (*FlipperOnStartHook)(void);

extern const char* FLIPPER_AUTORUN_APP_NAME;

/* Services list
* Spawned on startup
*/
Expand Down
12 changes: 6 additions & 6 deletions applications/archive/helpers/archive_favorites.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ uint16_t archive_favorites_count(void* context) {
break;
}
if(!string_size(buffer)) {
break;
continue; // Skip empty lines
}
++lines;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ static bool archive_favourites_rescan() {
break;
}
if(!string_size(buffer)) {
break;
continue;
}

if(string_search(buffer, "/app:") == 0) {
Expand Down Expand Up @@ -152,7 +152,7 @@ bool archive_favorites_read(void* context) {
break;
}
if(!string_size(buffer)) {
break;
continue;
}

if(string_search(buffer, "/app:") == 0) {
Expand Down Expand Up @@ -215,7 +215,7 @@ bool archive_favorites_delete(const char* format, ...) {
break;
}
if(!string_size(buffer)) {
break;
continue;
}

if(string_search(buffer, filename)) {
Expand Down Expand Up @@ -259,7 +259,7 @@ bool archive_is_favorite(const char* format, ...) {
break;
}
if(!string_size(buffer)) {
break;
continue;
}
if(!string_search(buffer, filename)) {
found = true;
Expand Down Expand Up @@ -299,7 +299,7 @@ bool archive_favorites_rename(const char* src, const char* dst) {
break;
}
if(!string_size(buffer)) {
break;
continue;
}

archive_file_append(
Expand Down
2 changes: 1 addition & 1 deletion applications/cli/cli_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
void cli_command_device_info_callback(const char* key, const char* value, bool last, void* context) {
UNUSED(context);
UNUSED(last);
printf("%-24s: %s\r\n", key, value);
printf("%-30s: %s\r\n", key, value);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion applications/desktop/views/desktop_view_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ void desktop_debug_render(Canvas* canvas, void* model) {
snprintf(
buffer,
sizeof(buffer),
"%d.F%dB%dC%d %s %s",
"%d.F%dB%dC%d %s:%s %s",
furi_hal_version_get_hw_version(),
furi_hal_version_get_hw_target(),
furi_hal_version_get_hw_body(),
furi_hal_version_get_hw_connect(),
furi_hal_version_get_hw_region_name(),
furi_hal_region_get_name(),
my_name ? my_name : "Unknown");
canvas_draw_str(canvas, 5, 19 + STATUS_BAR_Y_SHIFT, buffer);

Expand Down
4 changes: 3 additions & 1 deletion applications/gui/modules/text_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ static bool char_is_lowercase(char letter) {
}

static char char_to_uppercase(const char letter) {
if(isalpha(letter)) {
if(letter == '_') {
return 0x20;
} else if(isalpha(letter)) {
return (letter - 0x20);
} else {
return letter;
Expand Down
2 changes: 2 additions & 0 deletions applications/ibutton/ibutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ static void ibutton_rpc_command_callback(RpcAppSystemEvent event, void* context)
if(event == RpcAppEventSessionClose) {
view_dispatcher_send_custom_event(
ibutton->view_dispatcher, iButtonCustomEventRpcSessionClose);
rpc_system_app_set_callback(ibutton->rpc_ctx, NULL, NULL);
ibutton->rpc_ctx = NULL;
} else if(event == RpcAppEventAppExit) {
view_dispatcher_send_custom_event(ibutton->view_dispatcher, iButtonCustomEventRpcExit);
} else if(event == RpcAppEventLoadFile) {
Expand Down
10 changes: 5 additions & 5 deletions applications/ibutton/scenes/ibutton_scene_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {
if(event.event == iButtonCustomEventRpcLoad) {
const char* arg = rpc_system_app_get_data(ibutton->rpc_ctx);
bool result = false;
if(arg) {
if(arg && (string_empty_p(ibutton->file_path))) {
string_set_str(ibutton->file_path, arg);
if(ibutton_load_key_data(ibutton, ibutton->file_path, false)) {
ibutton_worker_emulate_start(ibutton->key_worker, ibutton->key);
Expand All @@ -51,17 +51,17 @@ bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {

string_clear(key_name);
result = true;
} else {
string_reset(ibutton->file_path);
}
}
rpc_system_app_confirm(ibutton->rpc_ctx, RpcAppEventLoadFile, result);
} else if(event.event == iButtonCustomEventRpcExit) {
rpc_system_app_confirm(ibutton->rpc_ctx, RpcAppEventAppExit, true);
ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop);
scene_manager_stop(ibutton->scene_manager);
view_dispatcher_stop(ibutton->view_dispatcher);
} else if(event.event == iButtonCustomEventRpcSessionClose) {
rpc_system_app_set_callback(ibutton->rpc_ctx, NULL, NULL);
ibutton->rpc_ctx = NULL;
ibutton_notification_message(ibutton, iButtonNotificationMessageBlinkStop);
scene_manager_stop(ibutton->scene_manager);
view_dispatcher_stop(ibutton->view_dispatcher);
}
}
Expand Down
23 changes: 22 additions & 1 deletion applications/infrared/infrared.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ static void infrared_rpc_command_callback(RpcAppSystemEvent event, void* context
if(event == RpcAppEventSessionClose) {
view_dispatcher_send_custom_event(
infrared->view_dispatcher, InfraredCustomEventTypeRpcSessionClose);
rpc_system_app_set_callback(infrared->rpc_ctx, NULL, NULL);
infrared->rpc_ctx = NULL;
} else if(event == RpcAppEventAppExit) {
view_dispatcher_send_custom_event(
infrared->view_dispatcher, InfraredCustomEventTypeRpcExit);
Expand Down Expand Up @@ -293,6 +295,13 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
}

void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
if(infrared->app_state.is_transmitting) {
FURI_LOG_D(INFRARED_LOG_TAG, "Transmitter is already active");
return;
} else {
infrared->app_state.is_transmitting = true;
}

if(infrared_signal_is_raw(signal)) {
InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal);
infrared_worker_set_raw_signal(infrared->worker, raw->timings, raw->timings_size);
Expand All @@ -302,8 +311,11 @@ void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
}

DOLPHIN_DEED(DolphinDeedIrSend);
infrared_worker_tx_start(infrared->worker);
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);

infrared_worker_tx_set_get_signal_callback(
infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared);
infrared_worker_tx_start(infrared->worker);
}

void infrared_tx_start_button_index(Infrared* infrared, size_t button_index) {
Expand All @@ -322,7 +334,16 @@ void infrared_tx_start_received(Infrared* infrared) {
}

void infrared_tx_stop(Infrared* infrared) {
if(!infrared->app_state.is_transmitting) {
FURI_LOG_D(INFRARED_LOG_TAG, "Transmitter is already stopped");
return;
} else {
infrared->app_state.is_transmitting = false;
}

infrared_worker_tx_stop(infrared->worker);
infrared_worker_tx_set_get_signal_callback(infrared->worker, NULL, NULL);

infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
}

Expand Down
2 changes: 2 additions & 0 deletions applications/infrared/infrared_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define INFRARED_APP_EXTENSION ".ir"

#define INFRARED_DEFAULT_REMOTE_NAME "Remote"
#define INFRARED_LOG_TAG "InfraredApp"

typedef enum {
InfraredButtonIndexNone = -1,
Expand All @@ -63,6 +64,7 @@ typedef enum {
typedef struct {
bool is_learning_new_remote;
bool is_debug_enabled;
bool is_transmitting;
InfraredEditTarget edit_target : 8;
InfraredEditMode edit_mode : 8;
int32_t current_button_index;
Expand Down
42 changes: 8 additions & 34 deletions applications/infrared/scenes/infrared_scene_learn_success.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

#include <dolphin/dolphin.h>

typedef enum {
InfraredSceneLearnSuccessStateIdle = 0,
InfraredSceneLearnSuccessStateSending = 1,
} InfraredSceneLearnSuccessState;

static void
infrared_scene_learn_success_dialog_result_callback(DialogExResult result, void* context) {
Infrared* infrared = context;
Expand All @@ -21,9 +16,6 @@ void infrared_scene_learn_success_on_enter(void* context) {
DOLPHIN_DEED(DolphinDeedIrLearnSuccess);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOn);

infrared_worker_tx_set_get_signal_callback(
infrared->worker, infrared_worker_tx_get_signal_steady_callback, context);

if(infrared_signal_is_raw(signal)) {
InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal);
dialog_ex_set_header(dialog_ex, "Unknown", 95, 10, AlignCenter, AlignCenter);
Expand Down Expand Up @@ -63,57 +55,42 @@ void infrared_scene_learn_success_on_enter(void* context) {
dialog_ex_set_context(dialog_ex, context);
dialog_ex_enable_extended_events(dialog_ex);

scene_manager_set_scene_state(
infrared->scene_manager, InfraredSceneLearnSuccess, InfraredSceneLearnSuccessStateIdle);
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx);
}

bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent event) {
Infrared* infrared = context;
SceneManager* scene_manager = infrared->scene_manager;
uint32_t scene_state = scene_manager_get_scene_state(scene_manager, InfraredSceneLearnSuccess);
const bool is_transmitter_idle = !infrared->app_state.is_transmitting;
bool consumed = false;

if(event.type == SceneManagerEventTypeTick) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
if(is_transmitter_idle) {
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOn);
}
consumed = true;
} else if(event.type == SceneManagerEventTypeBack) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
if(is_transmitter_idle) {
scene_manager_next_scene(scene_manager, InfraredSceneAskBack);
}
consumed = true;
} else if(event.type == SceneManagerEventTypeCustom) {
if(event.event == DialogExResultLeft) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
if(is_transmitter_idle) {
scene_manager_next_scene(scene_manager, InfraredSceneAskRetry);
}
consumed = true;
} else if(event.event == DialogExResultRight) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
if(is_transmitter_idle) {
scene_manager_next_scene(scene_manager, InfraredSceneLearnEnterName);
}
consumed = true;
} else if(event.event == DialogExPressCenter) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
scene_manager_set_scene_state(
scene_manager,
InfraredSceneLearnSuccess,
InfraredSceneLearnSuccessStateSending);
infrared_tx_start_received(infrared);
infrared_play_notification_message(
infrared, InfraredNotificationMessageBlinkStartSend);
}
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOff);
infrared_tx_start_received(infrared);
consumed = true;
} else if(event.event == DialogExReleaseCenter) {
if(scene_state == InfraredSceneLearnSuccessStateSending) {
scene_manager_set_scene_state(
scene_manager, InfraredSceneLearnSuccess, InfraredSceneLearnSuccessStateIdle);
infrared_tx_stop(infrared);
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOff);
}
infrared_tx_stop(infrared);
consumed = true;
}
}
Expand All @@ -123,9 +100,6 @@ bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent even

void infrared_scene_learn_success_on_exit(void* context) {
Infrared* infrared = context;
InfraredWorker* worker = infrared->worker;
dialog_ex_reset(infrared->dialog_ex);
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
infrared_play_notification_message(infrared, InfraredNotificationMessageGreenOff);
infrared_worker_tx_set_get_signal_callback(worker, NULL, NULL);
}
Loading