mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 09:18:35 -07:00
Merge remote-tracking branch 'origin/feat/subghz-save-hopping-state' into feat/subghz-save-hopping-state
This commit is contained in:
@@ -19,7 +19,7 @@ void gpio_scene_usb_uart_on_enter(void* context) {
|
||||
uint32_t prev_state = scene_manager_get_scene_state(app->scene_manager, GpioAppViewUsbUart);
|
||||
if(prev_state == 0) {
|
||||
scene_usb_uart = malloc(sizeof(SceneUsbUartBridge));
|
||||
scene_usb_uart->cfg.vcp_ch = 0; // TODO: settings load
|
||||
scene_usb_uart->cfg.vcp_ch = 0; // TODO FL-3495: settings load
|
||||
scene_usb_uart->cfg.uart_ch = 0;
|
||||
scene_usb_uart->cfg.flow_pins = 0;
|
||||
scene_usb_uart->cfg.baudrate_mode = 0;
|
||||
|
||||
@@ -85,7 +85,7 @@ static void infrared_cli_print_usage(void) {
|
||||
printf("\tir decode <input_file> [<output_file>]\r\n");
|
||||
printf("\tir universal <remote_name> <signal_name>\r\n");
|
||||
printf("\tir universal list <remote_name>\r\n");
|
||||
// TODO: Do not hardcode universal remote names
|
||||
// TODO FL-3496: Do not hardcode universal remote names
|
||||
printf("\tAvailable universal remotes: tv audio ac projector\r\n");
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ static bool infrared_cli_decode_raw_signal(
|
||||
|
||||
size_t i;
|
||||
for(i = 0; i < raw_signal->timings_size; ++i) {
|
||||
// TODO: Any infrared_check_decoder_ready() magic?
|
||||
// TODO FL-3523: Any infrared_check_decoder_ready() magic?
|
||||
const InfraredMessage* message = infrared_decode(decoder, level, raw_signal->timings[i]);
|
||||
|
||||
if(message) {
|
||||
|
||||
@@ -208,6 +208,21 @@ void infrared_signal_set_raw_signal(
|
||||
float duty_cycle) {
|
||||
infrared_signal_clear_timings(signal);
|
||||
|
||||
// If the frequency is out of bounds, set it to the closest bound same for duty cycle
|
||||
// TODO: Should we return error instead? Also infrared_signal_is_valid is used only in CLI for some reason?!
|
||||
if(frequency > INFRARED_MAX_FREQUENCY) {
|
||||
frequency = INFRARED_MAX_FREQUENCY;
|
||||
} else if(frequency < INFRARED_MIN_FREQUENCY) {
|
||||
frequency = INFRARED_MIN_FREQUENCY;
|
||||
}
|
||||
if((duty_cycle <= (float)0) || (duty_cycle > (float)1)) {
|
||||
duty_cycle = (float)0.33;
|
||||
}
|
||||
// In case of timings out of bounds we just call return
|
||||
if((timings_size <= 0) || (timings_size > MAX_TIMINGS_AMOUNT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
signal->is_raw = true;
|
||||
|
||||
signal->payload.raw.timings_size = timings_size;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "../infrared_i.h"
|
||||
|
||||
#include "common/infrared_scene_universal_common.h"
|
||||
#include <furi_hal_rtc.h>
|
||||
|
||||
void infrared_scene_universal_ac_on_enter(void* context) {
|
||||
infrared_scene_universal_common_on_enter(context);
|
||||
@@ -18,24 +19,26 @@ void infrared_scene_universal_ac_on_enter(void* context) {
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
22,
|
||||
&I_Off_25x27,
|
||||
&I_Off_hvr_25x27,
|
||||
6,
|
||||
15,
|
||||
&I_power_19x20,
|
||||
&I_power_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 4, 37, &I_power_text_24x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Off");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
36,
|
||||
22,
|
||||
&I_Dehumidify_25x27,
|
||||
&I_Dehumidify_hvr_25x27,
|
||||
39,
|
||||
15,
|
||||
&I_dry_19x20,
|
||||
&I_dry_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 41, 37, &I_dry_text_15x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Dh");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
@@ -43,9 +46,9 @@ void infrared_scene_universal_ac_on_enter(void* context) {
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
59,
|
||||
&I_CoolHi_25x27,
|
||||
&I_CoolHi_hvr_25x27,
|
||||
49,
|
||||
&I_max_24x23,
|
||||
&I_max_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Cool_hi");
|
||||
@@ -54,39 +57,71 @@ void infrared_scene_universal_ac_on_enter(void* context) {
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
36,
|
||||
59,
|
||||
&I_HeatHi_25x27,
|
||||
&I_HeatHi_hvr_25x27,
|
||||
37,
|
||||
49,
|
||||
&I_max_24x23,
|
||||
&I_max_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Heat_hi");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
91,
|
||||
&I_CoolLo_25x27,
|
||||
&I_CoolLo_hvr_25x27,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
100,
|
||||
&I_celsius_24x23,
|
||||
&I_celsius_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
} else {
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
100,
|
||||
&I_fahren_24x23,
|
||||
&I_fahren_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
}
|
||||
infrared_brute_force_add_record(brute_force, i++, "Cool_lo");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
2,
|
||||
36,
|
||||
91,
|
||||
&I_HeatLo_25x27,
|
||||
&I_HeatLo_hvr_25x27,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
|
||||
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
2,
|
||||
37,
|
||||
100,
|
||||
&I_celsius_24x23,
|
||||
&I_celsius_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
} else {
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
2,
|
||||
37,
|
||||
100,
|
||||
&I_fahren_24x23,
|
||||
&I_fahren_hover_24x23,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
}
|
||||
infrared_brute_force_add_record(brute_force, i++, "Heat_lo");
|
||||
|
||||
button_panel_add_label(button_panel, 6, 10, FontPrimary, "AC remote");
|
||||
button_panel_add_icon(button_panel, 0, 60, &I_cool_30x51);
|
||||
button_panel_add_icon(button_panel, 34, 60, &I_heat_30x51);
|
||||
|
||||
button_panel_add_label(button_panel, 4, 10, FontPrimary, "AC remote");
|
||||
|
||||
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
||||
|
||||
@@ -18,82 +18,88 @@ void infrared_scene_universal_audio_on_enter(void* context) {
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
11,
|
||||
&I_Power_25x27,
|
||||
&I_Power_hvr_25x27,
|
||||
6,
|
||||
13,
|
||||
&I_power_19x20,
|
||||
&I_power_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 4, 35, &I_power_text_24x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Power");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
36,
|
||||
11,
|
||||
&I_Mute_25x27,
|
||||
&I_Mute_hvr_25x27,
|
||||
39,
|
||||
13,
|
||||
&I_mute_19x20,
|
||||
&I_mute_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 39, 35, &I_mute_text_19x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Mute");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
41,
|
||||
&I_Play_25x27,
|
||||
&I_Play_hvr_25x27,
|
||||
6,
|
||||
42,
|
||||
&I_play_19x20,
|
||||
&I_play_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 6, 64, &I_play_text_19x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Play");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
36,
|
||||
41,
|
||||
&I_Pause_25x27,
|
||||
&I_Pause_hvr_25x27,
|
||||
0,
|
||||
2,
|
||||
6,
|
||||
71,
|
||||
&I_pause_19x20,
|
||||
&I_pause_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 4, 93, &I_pause_text_23x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Pause");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
71,
|
||||
&I_TrackPrev_25x27,
|
||||
&I_TrackPrev_hvr_25x27,
|
||||
6,
|
||||
101,
|
||||
&I_prev_19x20,
|
||||
&I_prev_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 6, 123, &I_prev_text_19x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Prev");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
2,
|
||||
36,
|
||||
71,
|
||||
&I_TrackNext_25x27,
|
||||
&I_TrackNext_hvr_25x27,
|
||||
3,
|
||||
39,
|
||||
101,
|
||||
&I_next_19x20,
|
||||
&I_next_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 39, 123, &I_next_text_19x6);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Next");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
101,
|
||||
&I_Vol_down_25x27,
|
||||
&I_Vol_down_hvr_25x27,
|
||||
1,
|
||||
2,
|
||||
37,
|
||||
77,
|
||||
&I_voldown_24x21,
|
||||
&I_voldown_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
|
||||
@@ -101,16 +107,17 @@ void infrared_scene_universal_audio_on_enter(void* context) {
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
3,
|
||||
36,
|
||||
101,
|
||||
&I_Vol_up_25x27,
|
||||
&I_Vol_up_hvr_25x27,
|
||||
1,
|
||||
37,
|
||||
43,
|
||||
&I_volup_24x21,
|
||||
&I_volup_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
||||
|
||||
button_panel_add_label(button_panel, 1, 8, FontPrimary, "Mus. remote");
|
||||
button_panel_add_label(button_panel, 1, 10, FontPrimary, "Mus. remote");
|
||||
button_panel_add_icon(button_panel, 34, 56, &I_vol_ac_text_30x30);
|
||||
|
||||
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
||||
|
||||
@@ -19,34 +19,38 @@ void infrared_scene_universal_fan_on_enter(void* context) {
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
6,
|
||||
24,
|
||||
&I_Power_25x27,
|
||||
&I_Power_hvr_25x27,
|
||||
&I_power_19x20,
|
||||
&I_power_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Power");
|
||||
button_panel_add_icon(button_panel, 4, 46, &I_power_text_24x5);
|
||||
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
36,
|
||||
39,
|
||||
24,
|
||||
&I_Mode_25x27,
|
||||
&I_Mode_hvr_25x27,
|
||||
&I_mode_19x20,
|
||||
&I_mode_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Mode");
|
||||
button_panel_add_icon(button_panel, 39, 46, &I_mode_text_20x5);
|
||||
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
66,
|
||||
&I_Vol_up_25x27,
|
||||
&I_Vol_up_hvr_25x27,
|
||||
1,
|
||||
37,
|
||||
55,
|
||||
&I_volup_24x21,
|
||||
&I_volup_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Speed_up");
|
||||
@@ -54,11 +58,11 @@ void infrared_scene_universal_fan_on_enter(void* context) {
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
36,
|
||||
66,
|
||||
&I_Vol_down_25x27,
|
||||
&I_Vol_down_hvr_25x27,
|
||||
2,
|
||||
37,
|
||||
89,
|
||||
&I_voldown_24x21,
|
||||
&I_voldown_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Speed_dn");
|
||||
@@ -66,31 +70,32 @@ void infrared_scene_universal_fan_on_enter(void* context) {
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
98,
|
||||
&I_Rotate_25x27,
|
||||
&I_Rotate_hvr_25x27,
|
||||
1,
|
||||
6,
|
||||
58,
|
||||
&I_rotate_19x20,
|
||||
&I_rotate_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Rotate");
|
||||
button_panel_add_icon(button_panel, 4, 80, &I_rotate_text_24x5);
|
||||
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
36,
|
||||
98,
|
||||
&I_Timer_25x27,
|
||||
&I_Timer_hvr_25x27,
|
||||
6,
|
||||
87,
|
||||
&I_timer_19x20,
|
||||
&I_timer_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Timer");
|
||||
button_panel_add_icon(button_panel, 4, 109, &I_timer_text_23x5);
|
||||
|
||||
button_panel_add_label(button_panel, 5, 11, FontPrimary, "Fan remote");
|
||||
button_panel_add_label(button_panel, 20, 63, FontSecondary, "Speed");
|
||||
button_panel_add_label(button_panel, 8, 23, FontSecondary, "Pwr");
|
||||
button_panel_add_label(button_panel, 40, 23, FontSecondary, "Mod");
|
||||
button_panel_add_icon(button_panel, 34, 68, &I_speed_text_30x30);
|
||||
|
||||
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
||||
|
||||
@@ -18,46 +18,49 @@ void infrared_scene_universal_projector_on_enter(void* context) {
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
19,
|
||||
&I_Power_25x27,
|
||||
&I_Power_hvr_25x27,
|
||||
6,
|
||||
24,
|
||||
&I_power_19x20,
|
||||
&I_power_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 4, 46, &I_power_text_24x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Power");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
36,
|
||||
19,
|
||||
&I_Mute_25x27,
|
||||
&I_Mute_hvr_25x27,
|
||||
39,
|
||||
24,
|
||||
&I_mute_19x20,
|
||||
&I_mute_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 39, 46, &I_mute_text_19x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Mute");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
64,
|
||||
&I_Vol_up_25x27,
|
||||
&I_Vol_up_hvr_25x27,
|
||||
1,
|
||||
37,
|
||||
55,
|
||||
&I_volup_24x21,
|
||||
&I_volup_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
||||
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
36,
|
||||
64,
|
||||
&I_Vol_down_25x27,
|
||||
&I_Vol_down_hvr_25x27,
|
||||
2,
|
||||
37,
|
||||
89,
|
||||
&I_voldown_24x21,
|
||||
&I_voldown_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
|
||||
@@ -65,29 +68,31 @@ void infrared_scene_universal_projector_on_enter(void* context) {
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
101,
|
||||
&I_Play_25x27,
|
||||
&I_Play_hvr_25x27,
|
||||
1,
|
||||
6,
|
||||
58,
|
||||
&I_play_19x20,
|
||||
&I_play_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Play");
|
||||
button_panel_add_icon(button_panel, 6, 80, &I_play_text_19x5);
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
36,
|
||||
101,
|
||||
&I_Pause_25x27,
|
||||
&I_Pause_hvr_25x27,
|
||||
6,
|
||||
87,
|
||||
&I_pause_19x20,
|
||||
&I_pause_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Pause");
|
||||
button_panel_add_icon(button_panel, 4, 109, &I_pause_text_23x5);
|
||||
|
||||
button_panel_add_label(button_panel, 10, 11, FontPrimary, "Projector");
|
||||
button_panel_add_label(button_panel, 17, 60, FontSecondary, "Volume");
|
||||
button_panel_add_label(button_panel, 3, 11, FontPrimary, "Proj. remote");
|
||||
button_panel_add_icon(button_panel, 34, 68, &I_vol_ac_text_30x30);
|
||||
|
||||
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
||||
|
||||
@@ -18,77 +18,82 @@ void infrared_scene_universal_tv_on_enter(void* context) {
|
||||
i,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
19,
|
||||
&I_Power_25x27,
|
||||
&I_Power_hvr_25x27,
|
||||
6,
|
||||
16,
|
||||
&I_power_19x20,
|
||||
&I_power_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 4, 38, &I_power_text_24x5);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Power");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
36,
|
||||
19,
|
||||
&I_Mute_25x27,
|
||||
&I_Mute_hvr_25x27,
|
||||
39,
|
||||
16,
|
||||
&I_mute_19x20,
|
||||
&I_mute_hover_19x20,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
button_panel_add_icon(button_panel, 39, 38, &I_mute_text_19x5);
|
||||
|
||||
button_panel_add_icon(button_panel, 0, 66, &I_ch_text_31x34);
|
||||
button_panel_add_icon(button_panel, 35, 66, &I_vol_tv_text_29x34);
|
||||
|
||||
infrared_brute_force_add_record(brute_force, i++, "Mute");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
38,
|
||||
53,
|
||||
&I_volup_24x21,
|
||||
&I_volup_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
66,
|
||||
&I_Vol_up_25x27,
|
||||
&I_Vol_up_hvr_25x27,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_up");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
1,
|
||||
36,
|
||||
66,
|
||||
&I_Up_25x27,
|
||||
&I_Up_hvr_25x27,
|
||||
53,
|
||||
&I_ch_up_24x21,
|
||||
&I_ch_up_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Ch_next");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
98,
|
||||
&I_Vol_down_25x27,
|
||||
&I_Vol_down_hvr_25x27,
|
||||
38,
|
||||
91,
|
||||
&I_voldown_24x21,
|
||||
&I_voldown_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Vol_dn");
|
||||
button_panel_add_item(
|
||||
button_panel,
|
||||
i,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
36,
|
||||
98,
|
||||
&I_Down_25x27,
|
||||
&I_Down_hvr_25x27,
|
||||
3,
|
||||
91,
|
||||
&I_ch_down_24x21,
|
||||
&I_ch_down_hover_24x21,
|
||||
infrared_scene_universal_common_item_callback,
|
||||
context);
|
||||
infrared_brute_force_add_record(brute_force, i++, "Ch_prev");
|
||||
|
||||
button_panel_add_label(button_panel, 6, 11, FontPrimary, "TV remote");
|
||||
button_panel_add_label(button_panel, 9, 64, FontSecondary, "Vol");
|
||||
button_panel_add_label(button_panel, 43, 64, FontSecondary, "Ch");
|
||||
button_panel_add_label(button_panel, 5, 10, FontPrimary, "TV remote");
|
||||
|
||||
view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
|
||||
view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack);
|
||||
|
||||
@@ -14,4 +14,4 @@ enum NfcCustomEvent {
|
||||
NfcCustomEventRpcSessionClose,
|
||||
NfcCustomEventUpdateLog,
|
||||
NfcCustomEventSaveShadow,
|
||||
};
|
||||
};
|
||||
@@ -3,6 +3,7 @@ ADD_SCENE(nfc, read, Read)
|
||||
ADD_SCENE(nfc, saved_menu, SavedMenu)
|
||||
ADD_SCENE(nfc, extra_actions, ExtraActions)
|
||||
ADD_SCENE(nfc, set_type, SetType)
|
||||
ADD_SCENE(nfc, set_type_mf_uid, SetTypeMfUid)
|
||||
ADD_SCENE(nfc, set_sak, SetSak)
|
||||
ADD_SCENE(nfc, set_atqa, SetAtqa)
|
||||
ADD_SCENE(nfc, set_uid, SetUid)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
void nfc_scene_file_select_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
nfc_device_data_clear(&nfc->dev->dev_data);
|
||||
|
||||
// Process file_select return
|
||||
nfc_device_set_loading_callback(nfc->dev, nfc_show_loading_popup, nfc);
|
||||
if(!furi_string_size(nfc->dev->load_path)) {
|
||||
|
||||
@@ -58,7 +58,8 @@ bool nfc_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
||||
if(strcmp(nfc->dev->dev_name, "") != 0) {
|
||||
nfc_device_delete(nfc->dev, true);
|
||||
}
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetUid)) {
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetUid) &&
|
||||
(!scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetTypeMfUid))) {
|
||||
nfc->dev->dev_data.nfc_data = nfc->dev_edit_data;
|
||||
}
|
||||
strlcpy(nfc->dev->dev_name, nfc->text_store, strlen(nfc->text_store) + 1);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexNFCA4,
|
||||
SubmenuIndexNFCA7,
|
||||
SubmenuIndexMFClassicCustomUID,
|
||||
SubmenuIndexGeneratorsStart,
|
||||
};
|
||||
|
||||
@@ -23,6 +24,12 @@ void nfc_scene_set_type_on_enter(void* context) {
|
||||
submenu, "NFC-A 7-bytes UID", SubmenuIndexNFCA7, nfc_scene_set_type_submenu_callback, nfc);
|
||||
submenu_add_item(
|
||||
submenu, "NFC-A 4-bytes UID", SubmenuIndexNFCA4, nfc_scene_set_type_submenu_callback, nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic Custom UID",
|
||||
SubmenuIndexMFClassicCustomUID,
|
||||
nfc_scene_set_type_submenu_callback,
|
||||
nfc);
|
||||
|
||||
// Generators
|
||||
int i = SubmenuIndexGeneratorsStart;
|
||||
@@ -49,6 +56,10 @@ bool nfc_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
nfc->dev->format = NfcDeviceSaveFormatUid;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetSak);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexMFClassicCustomUID) {
|
||||
nfc_device_clear(nfc->dev);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetTypeMfUid);
|
||||
consumed = true;
|
||||
} else {
|
||||
nfc_device_clear(nfc->dev);
|
||||
nfc->generator = nfc_generators[event.event - SubmenuIndexGeneratorsStart];
|
||||
|
||||
103
applications/main/nfc/scenes/nfc_scene_set_type_mf_uid.c
Normal file
103
applications/main/nfc/scenes/nfc_scene_set_type_mf_uid.c
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "lib/nfc/helpers/nfc_generators.h"
|
||||
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexMFC1k4b,
|
||||
SubmenuIndexMFC4k4b,
|
||||
SubmenuIndexMFC1k7b,
|
||||
SubmenuIndexMFC4k7b,
|
||||
SubmenuIndexMFCMini,
|
||||
};
|
||||
|
||||
static const NfcGenerator ganeator_gag = {
|
||||
.name = "Mifare Classic Custom UID",
|
||||
.generator_func = NULL,
|
||||
};
|
||||
|
||||
void nfc_scene_set_type_mf_uid_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_set_type_mf_uid_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic 1k 4byte UID",
|
||||
SubmenuIndexMFC1k4b,
|
||||
nfc_scene_set_type_mf_uid_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic 4k 4byte UID",
|
||||
SubmenuIndexMFC4k4b,
|
||||
nfc_scene_set_type_mf_uid_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic 1k 7byte UID",
|
||||
SubmenuIndexMFC1k7b,
|
||||
nfc_scene_set_type_mf_uid_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic 4k 7byte UID",
|
||||
SubmenuIndexMFC4k7b,
|
||||
nfc_scene_set_type_mf_uid_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Mifare Classic Mini",
|
||||
SubmenuIndexMFCMini,
|
||||
nfc_scene_set_type_mf_uid_submenu_callback,
|
||||
nfc);
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
||||
}
|
||||
|
||||
bool nfc_scene_set_type_mf_uid_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
bool correct_index = false;
|
||||
MfClassicType mf_type = MfClassicType1k;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexMFC1k4b) {
|
||||
nfc->dev->dev_data.nfc_data.uid_len = 4;
|
||||
mf_type = MfClassicType1k;
|
||||
correct_index = true;
|
||||
} else if(event.event == SubmenuIndexMFC1k7b) {
|
||||
nfc->dev->dev_data.nfc_data.uid_len = 7;
|
||||
mf_type = MfClassicType1k;
|
||||
correct_index = true;
|
||||
} else if(event.event == SubmenuIndexMFC4k4b) {
|
||||
nfc->dev->dev_data.nfc_data.uid_len = 4;
|
||||
mf_type = MfClassicType4k;
|
||||
correct_index = true;
|
||||
} else if(event.event == SubmenuIndexMFC4k7b) {
|
||||
nfc->dev->dev_data.nfc_data.uid_len = 7;
|
||||
mf_type = MfClassicType4k;
|
||||
correct_index = true;
|
||||
} else if(event.event == SubmenuIndexMFCMini) {
|
||||
nfc->dev->dev_data.nfc_data.uid_len = 4;
|
||||
mf_type = MfClassicTypeMini;
|
||||
correct_index = true;
|
||||
}
|
||||
if(correct_index) {
|
||||
nfc->generator = &ganeator_gag;
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneSetTypeMfUid, mf_type);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSetUid);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_set_type_mf_uid_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
@@ -35,6 +35,21 @@ bool nfc_scene_set_uid_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveSuccess);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetTypeMfUid)) {
|
||||
MfClassicType mf_type =
|
||||
scene_manager_get_scene_state(nfc->scene_manager, NfcSceneSetTypeMfUid);
|
||||
if(mf_type > MfClassicTypeMini) {
|
||||
furi_crash("Nfc unknown type");
|
||||
}
|
||||
nfc_generate_mf_classic_ext(
|
||||
&nfc->dev->dev_data,
|
||||
nfc->dev_edit_data.uid_len,
|
||||
mf_type,
|
||||
false,
|
||||
nfc->dev_edit_data.uid);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneGenerateInfo);
|
||||
consumed = true;
|
||||
|
||||
} else {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
|
||||
consumed = true;
|
||||
|
||||
@@ -334,7 +334,6 @@ static void subghz_txrx_tx_stop(SubGhzTxRx* instance) {
|
||||
}
|
||||
subghz_txrx_idle(instance);
|
||||
subghz_txrx_speaker_off(instance);
|
||||
//Todo: Show message
|
||||
}
|
||||
|
||||
FlipperFormat* subghz_txrx_get_fff_data(SubGhzTxRx* instance) {
|
||||
@@ -634,8 +633,11 @@ bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t
|
||||
}
|
||||
|
||||
bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
// TODO: Remake this function to check if the frequency is allowed on specific module - for modules not based on CC1101
|
||||
furi_assert(instance);
|
||||
//furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
UNUSED(frequency);
|
||||
/*
|
||||
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
|
||||
subghz_devices_idle(instance->radio_device);
|
||||
subghz_devices_set_frequency(instance->radio_device, frequency);
|
||||
@@ -644,6 +646,8 @@ bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequ
|
||||
subghz_devices_idle(instance->radio_device);
|
||||
|
||||
return ret;
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) {
|
||||
|
||||
@@ -30,7 +30,7 @@ bool subghz_txrx_gen_data_protocol(
|
||||
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_name);
|
||||
|
||||
if(instance->decoder_result == NULL) {
|
||||
//TODO: Error
|
||||
//TODO FL-3502: Error
|
||||
// furi_string_set(error_str, "Protocol not\nfound!");
|
||||
// scene_manager_next_scene(scene_manager, SubGhzSceneShowErrorSub);
|
||||
FURI_LOG_E(TAG, "Protocol not found!");
|
||||
@@ -199,7 +199,7 @@ bool subghz_txrx_gen_faac_slh_protocol(
|
||||
uint32_t frequency,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
uint32_t cnt,
|
||||
uint32_t seed,
|
||||
const char* manufacture_name) {
|
||||
SubGhzTxRx* txrx = context;
|
||||
|
||||
@@ -88,7 +88,7 @@ bool subghz_txrx_gen_faac_slh_protocol(
|
||||
uint32_t frequency,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
uint32_t cnt,
|
||||
uint32_t seed,
|
||||
const char* manufacture_name);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {
|
||||
if(subghz_txrx_load_decoder_by_name_protocol(
|
||||
subghz->txrx,
|
||||
subghz_history_get_protocol_name(subghz->history, subghz->idx_menu_chosen))) {
|
||||
//todo we are trying to deserialize without checking for errors, since it is assumed that we just received this signal
|
||||
// we are trying to deserialize without checking for errors, since it is assumed that we just received this chignal
|
||||
subghz_protocol_decoder_base_deserialize(
|
||||
subghz_txrx_get_decoder(subghz->txrx),
|
||||
subghz_history_get_raw_data(subghz->history, subghz->idx_menu_chosen));
|
||||
|
||||
@@ -45,6 +45,13 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
seed = subghz->secure_data->seed[0] << 24 | subghz->secure_data->seed[1] << 16 |
|
||||
subghz->secure_data->seed[2] << 8 | subghz->secure_data->seed[3];
|
||||
|
||||
if(seed == 0) {
|
||||
furi_string_set(subghz->error_str, "Seed value\ncan not be 0.");
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
generated_protocol = subghz_txrx_gen_keeloq_bft_protocol(
|
||||
subghz->txrx,
|
||||
"AM650",
|
||||
@@ -73,6 +80,12 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
seed = subghz->secure_data->seed[0] << 24 | subghz->secure_data->seed[1] << 16 |
|
||||
subghz->secure_data->seed[2] << 8 | subghz->secure_data->seed[3];
|
||||
|
||||
if(seed == 0) {
|
||||
furi_string_set(subghz->error_str, "Seed value\ncan not be 0.");
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
if(state == SubmenuIndexFaacSLH_433) {
|
||||
generated_protocol = subghz_txrx_gen_faac_slh_protocol(
|
||||
subghz->txrx,
|
||||
@@ -108,8 +121,14 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
// Reset Seed, Fix, Cnt in secure data after successful or unsuccessful generation
|
||||
memset(subghz->secure_data->seed, 0, sizeof(subghz->secure_data->seed));
|
||||
memset(subghz->secure_data->cnt, 0, sizeof(subghz->secure_data->cnt));
|
||||
memset(subghz->secure_data->fix, 0, sizeof(subghz->secure_data->fix));
|
||||
|
||||
if(generated_protocol) {
|
||||
subghz_file_name_clear(subghz);
|
||||
|
||||
scene_manager_set_scene_state(
|
||||
subghz->scene_manager, SubGhzSceneSetType, SubGhzCustomEventManagerSet);
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
|
||||
|
||||
@@ -611,7 +611,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
break;
|
||||
case SubmenuIndexSomfyTelis:
|
||||
generated_protocol = subghz_txrx_gen_somfy_telis_protocol(
|
||||
subghz->txrx, "AM650", 433920000, key & 0x00FFFFFF, 0x2, 0x0003);
|
||||
subghz->txrx, "AM650", 433420000, key & 0x00FFFFFF, 0x2, 0x0003);
|
||||
break;
|
||||
case SubmenuIndexDoorHan_433_92:
|
||||
generated_protocol = subghz_txrx_gen_keeloq_protocol(
|
||||
|
||||
@@ -104,8 +104,10 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!subghz_txrx_radio_device_is_tx_allowed(subghz->txrx, temp_data32)) {
|
||||
FURI_LOG_E(TAG, "This frequency can only be used for RX on chosen radio module");
|
||||
// TODO: use different frequency allowed lists for differnet modules (non cc1101)
|
||||
if(!furi_hal_subghz_is_tx_allowed(temp_data32)) {
|
||||
FURI_LOG_E(TAG, "This frequency can only be used for RX");
|
||||
|
||||
load_key_state = SubGhzLoadKeyStateOnlyRx;
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +126,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
|
||||
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
|
||||
|
||||
if(!strcmp(furi_string_get_cstr(temp_str), "CUSTOM")) {
|
||||
//Todo add Custom_preset_module
|
||||
//TODO FL-3551: add Custom_preset_module
|
||||
//delete preset if it already exists
|
||||
subghz_setting_delete_custom_preset(setting, furi_string_get_cstr(temp_str));
|
||||
//load custom preset from file
|
||||
@@ -291,10 +293,14 @@ bool subghz_save_protocol_to_file(
|
||||
if(!storage_simply_remove(storage, dev_file_name)) {
|
||||
break;
|
||||
}
|
||||
//ToDo check Write
|
||||
|
||||
stream_seek(flipper_format_stream, 0, StreamOffsetFromStart);
|
||||
stream_save_to_file(flipper_format_stream, storage, dev_file_name, FSOM_CREATE_ALWAYS);
|
||||
|
||||
if(storage_common_stat(storage, dev_file_name, NULL) != FSE_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
saved = true;
|
||||
} while(0);
|
||||
furi_string_free(file_dir);
|
||||
|
||||
@@ -13,5 +13,5 @@ App(
|
||||
fap_libs=["assets",],
|
||||
fap_icon="icon.png",
|
||||
fap_description="SubGhz Remote, uses up to 5 .sub files",
|
||||
fap_category="Sub-Ghz",
|
||||
fap_category="Sub-GHz",
|
||||
)
|
||||
@@ -84,7 +84,7 @@ SubRemLoadSubState subrem_sub_preset_load(
|
||||
if(!flipper_format_read_uint32(fff_data_file, "Frequency", &temp_data32, 1)) {
|
||||
FURI_LOG_W(TAG, "Cannot read frequency. Set default frequency");
|
||||
sub_preset->freq_preset.frequency = subghz_setting_get_default_frequency(setting);
|
||||
} else if(!subghz_txrx_radio_device_is_frequecy_valid(txrx, temp_data32)) {
|
||||
} else if(!subghz_txrx_radio_device_is_frequency_valid(txrx, temp_data32)) {
|
||||
FURI_LOG_E(TAG, "Frequency not supported on chosen radio module");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -629,12 +629,12 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance) {
|
||||
return subghz_devices_get_name(instance->radio_device);
|
||||
}
|
||||
|
||||
bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
furi_assert(instance);
|
||||
return subghz_devices_is_frequency_valid(instance->radio_device, frequency);
|
||||
}
|
||||
|
||||
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequency) {
|
||||
furi_assert(instance);
|
||||
furi_assert(instance->txrx_state != SubGhzTxRxStateSleep);
|
||||
|
||||
|
||||
@@ -363,9 +363,9 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance);
|
||||
* @param instance Pointer to a SubGhzTxRx
|
||||
* @return bool True if the frequency is valid
|
||||
*/
|
||||
bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency);
|
||||
bool subghz_txrx_radio_device_is_frequency_valid(SubGhzTxRx* instance, uint32_t frequency);
|
||||
|
||||
bool subghz_txrx_radio_device_is_tx_alowed(SubGhzTxRx* instance, uint32_t frequency);
|
||||
bool subghz_txrx_radio_device_is_tx_allowed(SubGhzTxRx* instance, uint32_t frequency);
|
||||
|
||||
void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state);
|
||||
bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f"
|
||||
|
||||
#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_FACTORY 2
|
||||
#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE 11
|
||||
#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT
|
||||
|
||||
#define U2F_CERT_STOCK 0 // Stock certificate, private key is encrypted with factory key
|
||||
#define U2F_CERT_USER 1 // User certificate, private key is encrypted with unique key
|
||||
@@ -136,7 +136,7 @@ static bool u2f_data_cert_key_encrypt(uint8_t* cert_key) {
|
||||
// Generate random IV
|
||||
furi_hal_random_fill_buf(iv, 16);
|
||||
|
||||
if(!furi_hal_crypto_store_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
return false;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ static bool u2f_data_cert_key_encrypt(uint8_t* cert_key) {
|
||||
FURI_LOG_E(TAG, "Encryption failed");
|
||||
return false;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
furi_hal_crypto_enclave_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
|
||||
@@ -178,8 +178,8 @@ bool u2f_data_cert_key_load(uint8_t* cert_key) {
|
||||
uint8_t key_slot = 0;
|
||||
uint32_t version = 0;
|
||||
|
||||
// Check if unique key exists in secure eclave(typo?) and generate it if missing
|
||||
if(!furi_hal_crypto_verify_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE)) return false;
|
||||
// Check if unique key exists in secure eclave and generate it if missing
|
||||
if(!furi_hal_crypto_enclave_ensure_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE)) return false;
|
||||
|
||||
FuriString* filetype;
|
||||
filetype = furi_string_alloc();
|
||||
@@ -226,7 +226,7 @@ bool u2f_data_cert_key_load(uint8_t* cert_key) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!furi_hal_crypto_store_load_key(key_slot, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(key_slot, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
break;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ bool u2f_data_cert_key_load(uint8_t* cert_key) {
|
||||
FURI_LOG_E(TAG, "Decryption failed");
|
||||
break;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(key_slot);
|
||||
furi_hal_crypto_enclave_unload_key(key_slot);
|
||||
} else {
|
||||
if(!flipper_format_read_hex(flipper_format, "Data", cert_key, 32)) {
|
||||
FURI_LOG_E(TAG, "Missing data");
|
||||
@@ -292,7 +292,7 @@ bool u2f_data_key_load(uint8_t* device_key) {
|
||||
FURI_LOG_E(TAG, "Missing data");
|
||||
break;
|
||||
}
|
||||
if(!furi_hal_crypto_store_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
break;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ bool u2f_data_key_load(uint8_t* device_key) {
|
||||
FURI_LOG_E(TAG, "Decryption failed");
|
||||
break;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
furi_hal_crypto_enclave_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
state = true;
|
||||
} while(0);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ bool u2f_data_key_generate(uint8_t* device_key) {
|
||||
furi_hal_random_fill_buf(iv, 16);
|
||||
furi_hal_random_fill_buf(key, 32);
|
||||
|
||||
if(!furi_hal_crypto_store_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
return false;
|
||||
}
|
||||
@@ -333,7 +333,7 @@ bool u2f_data_key_generate(uint8_t* device_key) {
|
||||
FURI_LOG_E(TAG, "Encryption failed");
|
||||
return false;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
furi_hal_crypto_enclave_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
|
||||
@@ -398,7 +398,7 @@ bool u2f_data_cnt_read(uint32_t* cnt_val) {
|
||||
FURI_LOG_E(TAG, "Missing data");
|
||||
break;
|
||||
}
|
||||
if(!furi_hal_crypto_store_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
break;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ bool u2f_data_cnt_read(uint32_t* cnt_val) {
|
||||
FURI_LOG_E(TAG, "Decryption failed");
|
||||
break;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
furi_hal_crypto_enclave_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
if(cnt.control == U2F_COUNTER_CONTROL_VAL) {
|
||||
*cnt_val = cnt.counter;
|
||||
state = true;
|
||||
@@ -440,7 +440,7 @@ bool u2f_data_cnt_write(uint32_t cnt_val) {
|
||||
cnt.control = U2F_COUNTER_CONTROL_VAL;
|
||||
cnt.counter = cnt_val;
|
||||
|
||||
if(!furi_hal_crypto_store_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
if(!furi_hal_crypto_enclave_load_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE, iv)) {
|
||||
FURI_LOG_E(TAG, "Unable to load encryption key");
|
||||
return false;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ bool u2f_data_cnt_write(uint32_t cnt_val) {
|
||||
FURI_LOG_E(TAG, "Encryption failed");
|
||||
return false;
|
||||
}
|
||||
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
furi_hal_crypto_enclave_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
|
||||
|
||||
Reference in New Issue
Block a user