Skip to content

Commit

Permalink
Merge remote-tracking branch 'ofw/dev' into mntm-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Sep 6, 2024
2 parents fc2f49b + c632691 commit 16859a4
Show file tree
Hide file tree
Showing 30 changed files with 252 additions and 160 deletions.
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ firmware_debug = distenv.PhonyTarget(
)
distenv.Depends(firmware_debug, firmware_flash)

distenv.PhonyTarget(
firmware_blackmagic = distenv.PhonyTarget(
"blackmagic",
"${GDBPYCOM}",
source=firmware_env["FW_ELF"],
GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}",
GDBREMOTE="${BLACKMAGIC_ADDR}",
FBT_FAP_DEBUG_ELF_ROOT=firmware_env["FBT_FAP_DEBUG_ELF_ROOT"],
)
distenv.Depends(firmware_blackmagic, firmware_flash)

# Debug alien elf
debug_other_opts = [
Expand Down
24 changes: 12 additions & 12 deletions applications/main/ibutton/scenes/ibutton_scene_rpc.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
#include "../ibutton_i.h"

void ibutton_scene_rpc_on_enter(void* context) {
iButton* ibutton = context;
UNUSED(context);
}

static void ibutton_rpc_start_emulation(iButton* ibutton) {
Popup* popup = ibutton->popup;

popup_set_header(popup, "iButton", 82, 28, AlignCenter, AlignBottom);
popup_set_text(popup, "RPC mode", 82, 32, AlignCenter, AlignTop);

popup_set_text(popup, ibutton->key_name, 82, 32, AlignCenter, AlignTop);
popup_set_icon(popup, 2, 14, &I_iButtonKey_49x44);

view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup);

ibutton_worker_emulate_start(ibutton->worker, ibutton->key);

ibutton_notification_message(ibutton, iButtonNotificationMessageEmulateStart);
notification_message(ibutton->notifications, &sequence_display_backlight_on);
}

bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {
iButton* ibutton = context;
Popup* popup = ibutton->popup;

bool consumed = false;

Expand All @@ -27,17 +31,13 @@ bool ibutton_scene_rpc_on_event(void* context, SceneManagerEvent event) {
bool result = false;

if(ibutton_load_key(ibutton, false)) {
popup_set_text(popup, ibutton->key_name, 82, 32, AlignCenter, AlignTop);
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewPopup);

ibutton_notification_message(ibutton, iButtonNotificationMessageEmulateStart);
ibutton_worker_emulate_start(ibutton->worker, ibutton->key);

ibutton_rpc_start_emulation(ibutton);
result = true;
} else {
rpc_system_app_set_error_code(ibutton->rpc, RpcAppSystemErrorCodeParseFile);
rpc_system_app_set_error_text(ibutton->rpc, "Cannot load key file");
}

rpc_system_app_confirm(ibutton->rpc, result);

} else if(event.event == iButtonCustomEventRpcExit) {
rpc_system_app_confirm(ibutton->rpc, true);
scene_manager_stop(ibutton->scene_manager);
Expand Down
12 changes: 5 additions & 7 deletions applications/main/infrared/infrared_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,15 @@ void infrared_tx_start(InfraredApp* infrared) {
infrared->app_state.is_transmitting = true;
}

void infrared_tx_start_button_index(InfraredApp* infrared, size_t button_index) {
bool infrared_tx_start_button_index(InfraredApp* infrared, size_t button_index) {
furi_assert(button_index < infrared_remote_get_signal_count(infrared->remote));

if(infrared_remote_load_signal(infrared->remote, infrared->current_signal, button_index)) {
bool result =
infrared_remote_load_signal(infrared->remote, infrared->current_signal, button_index);
if(result) {
infrared_tx_start(infrared);
} else {
infrared_show_error_message(
infrared,
"Failed to load\n\"%s\"",
infrared_remote_get_signal_name(infrared->remote, button_index));
}
return result;
}

void infrared_tx_stop(InfraredApp* infrared) {
Expand Down
2 changes: 1 addition & 1 deletion applications/main/infrared/infrared_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void infrared_tx_start(InfraredApp* infrared);
* @param[in] button_index index of the signal to be loaded.
* @returns true if the signal could be loaded, false otherwise.
*/
void infrared_tx_start_button_index(InfraredApp* infrared, size_t button_index);
bool infrared_tx_start_button_index(InfraredApp* infrared, size_t button_index);

/**
* @brief Stop transmission of the currently loaded signal.
Expand Down
38 changes: 38 additions & 0 deletions applications/main/infrared/resources/infrared/assets/ac.ir
Original file line number Diff line number Diff line change
Expand Up @@ -1091,3 +1091,41 @@ type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4348 4439 520 1646 520 1646 520 1646 519 1646 520 561 520 561 520 1646 519 561 520 561 520 562 519 562 519 561 520 1646 520 1647 518 563 518 1646 519 562 519 561 520 561 520 562 519 562 519 561 520 1648 517 1647 519 1646 519 1647 519 1646 520 1646 520 1645 520 1647 519 561 520 561 520 562 519 562 519 562 519 562 519 561 520 562 519 561 520 1646 520 562 519 1647 518 1646 520 562 519 560 521 561 520 561 520 561 520 562 519 562 519 560 521 562 519 562 519 560 521 1646 520 1646 520 561 520 562 519 561 520 562 519 561 520 561 520 561 520 561 520 561 520 1647 518 1646 520 562 519 562 519 561 520 1646 520 561 520 5409 4348 4440 519 1645 521 1646 519 1645 521 1645 521 561 520 561 520 1644 522 561 520 561 520 561 520 560 521 562 519 1646 520 1646 520 562 519 1644 522 561 520 561 520 561 520 561 520 561 520 561 520 1646 520 1645 520 1646 520 1645 521 1646 520 1646 520 1644 522 1645 521 560 521 560 521 561 520 561 520 560 521 560 521 561 520 561 520 561 520 1645 521 562 519 1645 521 1645 520 561 520 562 519 561 520 561 520 561 520 560 521 560 521 560 521 560 521 561 520 560 521 1646 520 1646 520 561 520 560 521 559 522 560 521 561 520 561 520 560 521 560 521 560 521 1646 520 1645 520 561 520 560 521 560 521 1645 521 561 520
#
# Model: Airwell AW-HKD012-N91
#
name: Dh
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4387 4398 547 1609 547 530 547 1610 547 1611 545 530 547 530 547 1608 547 530 548 530 547 1611 545 532 546 532 547 1609 547 1610 547 531 547 1608 548 530 547 530 548 530 547 1610 546 1609 547 1610 547 1609 547 1609 547 1611 545 1609 548 1610 546 530 547 530 548 529 549 531 547 531 546 531 547 1608 548 1610 547 1608 548 533 545 1608 548 532 546 532 546 1611 545 532 547 532 545 530 548 1608 547 530 549 1608 547 1609 548 5203 4386 4398 547 1609 546 530 547 1609 546 1607 548 531 547 531 547 1609 547 530 548 531 547 1609 547 531 547 531 547 1608 547 1613 544 531 546 1609 547 531 547 531 547 532 546 1609 547 1609 546 1609 547 1609 547 1608 547 1608 548 1608 548 1609 547 530 547 530 547 530 547 532 546 530 547 530 548 1610 546 1608 547 1609 547 530 547 1609 547 530 547 530 548 1609 546 530 548 530 547 532 546 1610 546 531 546 1608 548 1608 548
#
name: Cool_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4388 4398 547 1608 548 531 546 1610 546 1609 547 530 547 529 548 1608 548 532 547 530 548 1612 544 529 549 530 548 1608 547 1609 547 531 546 1608 548 1607 549 529 549 1608 549 1609 548 1608 548 1608 548 1611 545 1608 548 530 548 1609 547 531 547 530 548 530 548 531 547 529 549 530 548 530 547 531 547 530 548 530 547 529 549 530 548 532 547 530 548 1609 547 1610 547 1608 548 1609 547 1608 548 1608 548 1608 548 1608 548 5203 4388 4396 549 1609 547 529 549 1610 546 1608 548 529 549 530 547 1609 547 530 548 529 549 1608 548 531 547 532 546 1609 547 1609 547 530 548 1609 548 1609 548 529 548 1608 548 1609 548 1609 547 1609 547 1608 548 1609 547 532 546 1608 548 531 548 531 548 530 548 530 548 531 547 530 548 531 548 531 547 530 548 530 548 530 548 531 547 529 549 529 549 1609 548 1608 548 1609 547 1608 548 1608 548 1608 548 1607 549 1607 549
#
name: Cool_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4384 4400 572 1585 571 505 572 1583 573 1584 572 508 570 503 575 1584 572 505 572 506 572 1583 573 504 573 506 571 1586 570 1585 572 532 546 1586 570 1585 571 506 571 1585 571 1583 573 1586 570 1583 573 1584 572 1589 569 505 572 1585 571 506 571 506 573 506 572 505 573 532 545 504 574 509 570 1611 545 506 572 1582 574 506 572 507 571 507 571 507 570 1584 572 507 571 1587 569 506 572 1584 572 1585 571 1583 573 1612 544 5179 4386 4400 570 1584 572 507 571 1583 572 1585 571 506 572 506 572 1584 572 505 572 504 574 1584 572 507 571 504 574 1583 573 1585 572 507 571 1584 572 1610 545 508 571 1587 569 1583 573 1583 573 1585 571 1585 572 1585 572 505 572 1584 572 505 573 507 572 506 571 504 574 505 573 505 574 508 571 1585 571 507 571 1585 571 506 571 506 572 504 574 505 572 1586 570 507 571 1586 570 505 573 1584 572 1585 571 1587 569 1584 573
#
name: Heat_hi
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4386 4398 575 1582 574 503 575 1583 573 1582 574 505 573 504 574 1582 574 506 572 508 570 1583 573 504 574 505 573 1583 573 1584 573 505 573 1582 575 1583 574 504 574 1582 574 1583 573 1583 573 1583 573 1585 571 1586 572 504 573 1584 572 504 573 505 573 505 573 505 573 504 573 506 571 1583 574 505 573 1583 573 1583 573 1584 572 1583 573 505 572 505 573 504 574 1583 574 505 573 505 573 504 574 505 572 1584 572 1584 573 5178 4387 4400 571 1583 573 504 574 1584 572 1584 572 507 572 504 574 1582 574 505 572 505 573 1583 573 504 574 504 574 1582 574 1584 573 503 574 1583 573 1582 574 505 573 1583 573 1582 575 1583 573 1610 546 1584 572 1583 573 505 573 1610 546 506 572 505 573 504 574 504 574 505 573 505 573 1584 573 505 573 1582 574 1584 572 1583 573 1583 573 504 574 503 575 504 574 1585 571 507 571 504 573 506 572 505 572 1584 572 1585 571
#
name: Heat_lo
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4388 4399 547 1608 548 530 548 1610 547 1610 547 529 549 529 548 1608 548 530 548 530 548 1607 549 533 545 531 548 1608 548 1610 546 531 547 1609 547 1608 548 529 549 1609 547 1609 547 1609 547 1609 547 1609 547 1608 548 529 548 1638 519 530 548 530 548 530 548 529 550 528 549 530 548 530 548 1608 548 530 548 1609 548 1610 547 1609 547 531 546 529 549 1608 548 530 548 1609 548 530 548 529 548 530 548 1609 548 1609 548 5205 4387 4398 547 1609 548 531 546 1609 547 1609 547 530 548 531 546 1609 547 531 548 530 573 1583 573 507 571 506 572 1583 573 1582 574 504 574 1581 575 1582 574 506 572 1583 574 1583 573 1583 573 1585 571 1584 572 1585 570 507 571 1582 574 505 574 532 545 505 573 505 572 506 571 505 573 505 573 1584 572 506 572 1583 573 1584 572 1583 573 505 572 504 573 1583 573 505 573 1586 571 506 572 505 573 507 572 1583 573 1584 572
#
name: Off
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4388 4399 572 1583 573 532 546 1585 571 1583 574 503 575 505 573 1584 572 504 574 505 573 1584 573 506 572 504 573 1584 573 1584 572 505 574 1611 545 506 573 1583 573 1585 571 1586 545 1609 547 531 547 1611 545 1608 548 1607 549 530 548 529 548 531 548 532 546 1610 546 533 545 530 547 1609 547 1610 547 1609 547 533 545 529 548 530 548 530 547 531 546 530 547 530 548 533 544 1608 548 1608 548 1610 546 1606 550 1609 547 5203 4388 4397 548 1609 547 531 547 1608 548 1608 548 530 548 530 548 1608 548 531 547 531 547 1610 546 531 547 530 548 1609 547 1611 546 532 547 1609 547 531 547 1608 548 1610 546 1609 547 1608 548 530 547 1609 547 1608 548 1609 547 531 546 530 548 530 547 530 547 1608 548 532 547 534 545 1608 548 1608 548 1609 547 530 548 531 547 531 547 532 546 531 546 531 547 532 546 530 548 1608 547 1608 548 1610 546 1608 548 1608 548
7 changes: 6 additions & 1 deletion applications/main/infrared/scenes/infrared_scene_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ bool infrared_scene_remote_on_event(void* context, SceneManagerEvent event) {

if(custom_type == InfraredCustomEventTypeTransmitStarted) {
furi_assert(button_index >= 0);
infrared_tx_start_button_index(infrared, button_index);
if(!infrared_tx_start_button_index(infrared, button_index)) {
infrared_show_error_message(
infrared,
"Failed to load\n\"%s\"",
infrared_remote_get_signal_name(infrared->remote, button_index));
}
consumed = true;
} else if(custom_type == InfraredCustomEventTypeTransmitStopped) {
infrared_tx_stop(infrared);
Expand Down
45 changes: 28 additions & 17 deletions applications/main/infrared/scenes/infrared_scene_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@ static int32_t infrared_scene_rpc_task_callback(void* context) {

void infrared_scene_rpc_on_enter(void* context) {
InfraredApp* infrared = context;
scene_manager_set_scene_state(infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateIdle);
}

static void infrared_scene_rpc_show(InfraredApp* infrared) {
Popup* popup = infrared->popup;

popup_set_header(popup, "Infrared", 89, 42, AlignCenter, AlignBottom);
popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
popup_set_text(popup, infrared->text_store[0], 89, 44, AlignCenter, AlignTop);

popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61);

popup_set_context(popup, context);
popup_set_context(popup, infrared);
popup_set_callback(popup, infrared_popup_closed_callback);

view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
scene_manager_set_scene_state(infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateIdle);
scene_manager_set_scene_state(
infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateSending);
notification_message(infrared->notifications, &sequence_display_backlight_on);
}

Expand All @@ -52,24 +58,20 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {

} else if(event.event == InfraredCustomEventTypeTaskFinished) {
const bool task_success = infrared_blocking_task_finalize(infrared);

if(task_success) {
const char* remote_name = infrared_remote_get_name(infrared->remote);
infrared_text_store_set(infrared, 0, "loaded\n%s", remote_name);
scene_manager_set_scene_state(
infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateLoaded);

} else {
infrared_text_store_set(
infrared, 0, "failed to load\n%s", furi_string_get_cstr(infrared->file_path));
}
FuriString* str = furi_string_alloc();
furi_string_printf(
str, "Failed to load\n%s", furi_string_get_cstr(infrared->file_path));

popup_set_text(
infrared->popup, infrared->text_store[0], 89, 44, AlignCenter, AlignTop);
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
rpc_system_app_set_error_code(infrared->rpc_ctx, RpcAppSystemErrorCodeParseFile);
rpc_system_app_set_error_text(infrared->rpc_ctx, furi_string_get_cstr(str));

furi_string_free(str);
}
rpc_system_app_confirm(infrared->rpc_ctx, task_success);

} else if(
event.event == InfraredCustomEventTypeRpcButtonPressName ||
event.event == InfraredCustomEventTypeRpcButtonPressIndex) {
Expand All @@ -88,10 +90,19 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) {
TAG, "Sending signal with index \"%ld\"", app_state->current_button_index);
}
if(infrared->app_state.current_button_index != InfraredButtonIndexNone) {
infrared_tx_start_button_index(infrared, app_state->current_button_index);
scene_manager_set_scene_state(
infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateSending);
result = true;
if(infrared_tx_start_button_index(infrared, app_state->current_button_index)) {
const char* remote_name = infrared_remote_get_name(infrared->remote);
infrared_text_store_set(infrared, 0, "emulating\n%s", remote_name);

infrared_scene_rpc_show(infrared);
result = true;
} else {
rpc_system_app_set_error_code(
infrared->rpc_ctx, RpcAppSystemErrorCodeInternalParse);
rpc_system_app_set_error_text(
infrared->rpc_ctx, "Cannot load button data");
result = false;
}
}
}
rpc_system_app_confirm(infrared->rpc_ctx, result);
Expand Down
30 changes: 16 additions & 14 deletions applications/main/lfrfid/scenes/lfrfid_scene_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@

void lfrfid_scene_rpc_on_enter(void* context) {
LfRfid* app = context;
app->rpc_state = LfRfidRpcStateIdle;
}

static void lfrfid_rpc_start_emulation(LfRfid* app) {
Popup* popup = app->popup;

lfrfid_text_store_set(app, "emulating\n%s", furi_string_get_cstr(app->file_name));

popup_set_header(popup, "LF RFID", 89, 42, AlignCenter, AlignBottom);
popup_set_text(popup, "RPC mode", 89, 44, AlignCenter, AlignTop);
popup_set_text(popup, app->text_store, 89, 44, AlignCenter, AlignTop);
popup_set_icon(popup, 0, 12, &I_RFIDDolphinSend_97x61);

view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);

notification_message(app->notifications, &sequence_display_backlight_on);
lfrfid_worker_start_thread(app->lfworker);
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);

app->rpc_state = LfRfidRpcStateIdle;
notification_message(app->notifications, &sequence_display_backlight_on);
notification_message(app->notifications, &sequence_blink_start_magenta);
app->rpc_state = LfRfidRpcStateEmulating;
}

bool lfrfid_scene_rpc_on_event(void* context, SceneManagerEvent event) {
LfRfid* app = context;
Popup* popup = app->popup;
UNUSED(event);
bool consumed = false;

if(event.type == SceneManagerEventTypeCustom) {
Expand All @@ -34,16 +41,11 @@ bool lfrfid_scene_rpc_on_event(void* context, SceneManagerEvent event) {
bool result = false;
if(app->rpc_state == LfRfidRpcStateIdle) {
if(lfrfid_load_key_data(app, app->file_path, false)) {
lfrfid_worker_start_thread(app->lfworker);
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
app->rpc_state = LfRfidRpcStateEmulating;

lfrfid_text_store_set(
app, "emulating\n%s", furi_string_get_cstr(app->file_name));
popup_set_text(popup, app->text_store, 89, 44, AlignCenter, AlignTop);

notification_message(app->notifications, &sequence_blink_start_magenta);
lfrfid_rpc_start_emulation(app);
result = true;
} else {
rpc_system_app_set_error_code(app->rpc_ctx, RpcAppSystemErrorCodeParseFile);
rpc_system_app_set_error_text(app->rpc_ctx, "Cannot load key file");
}
}
rpc_system_app_confirm(app->rpc_ctx, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ static bool nfc_protocol_support_scene_rpc_on_event(NfcApp* instance, SceneManag
if(nfc_load_file(instance, instance->file_path, false)) {
nfc_protocol_support_scene_rpc_setup_ui_and_emulate(instance);
success = true;
} else {
rpc_system_app_set_error_code(
instance->rpc_ctx, RpcAppSystemErrorCodeParseFile);
rpc_system_app_set_error_text(instance->rpc_ctx, "Cannot load key file");
}
}
rpc_system_app_confirm(instance->rpc_ctx, success);
Expand Down
2 changes: 1 addition & 1 deletion applications/main/nfc/nfc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ int32_t nfc_app(void* p) {
nfc->view_dispatcher, nfc->gui, ViewDispatcherTypeFullscreen);

furi_string_set(nfc->file_path, args);
if(nfc_load_file(nfc, nfc->file_path, false)) {
if(nfc_load_file(nfc, nfc->file_path, true)) {
nfc->fav_timeout = is_favorite;
nfc_show_initial_scene_for_device(nfc);
} else {
Expand Down
14 changes: 0 additions & 14 deletions applications/main/subghz/helpers/subghz_error_type.h

This file was deleted.

Loading

0 comments on commit 16859a4

Please sign in to comment.