Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-12-25 16:19:30 +0300
committerGitHub <noreply@github.com>2021-12-25 16:19:30 +0300
commitfb7cc1dd60155e0829757f997526c113594648fe (patch)
tree89d90519c98386bce1a6c4b5d936a0dd930ed074
parentf061b937d03dfceb876a66456f85977dfe87b2eb (diff)
[FL-2162] SubGhz: Cli refactoring (#926)
* [FL-2162] SubGhz: Cli refactoring * SubGhz: power reduction for Australia * SubGhz: add frequencies for testing the Japanese region * Desktop: fix fav app Co-authored-by: Anna Prosvetova <anna@prosvetova.me> Co-authored-by: あく <alleteam@gmail.com>
-rw-r--r--applications/desktop/scenes/desktop_scene_main.c2
-rw-r--r--applications/subghz/helpers/subghz_testing.c5
-rw-r--r--applications/subghz/subghz_cli.c70
-rw-r--r--firmware/targets/f6/furi-hal/furi-hal-subghz.c2
-rw-r--r--firmware/targets/f7/furi-hal/furi-hal-subghz.c2
5 files changed, 55 insertions, 26 deletions
diff --git a/applications/desktop/scenes/desktop_scene_main.c b/applications/desktop/scenes/desktop_scene_main.c
index 89158d6d..90f211b7 100644
--- a/applications/desktop/scenes/desktop_scene_main.c
+++ b/applications/desktop/scenes/desktop_scene_main.c
@@ -91,7 +91,7 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
case DesktopMainEventOpenFavorite:
LOAD_DESKTOP_SETTINGS(&desktop->settings);
- if(desktop->settings.favorite) {
+ if(desktop->settings.favorite < FLIPPER_APPS_COUNT) {
desktop_switch_to_app(desktop, &FLIPPER_APPS[desktop->settings.favorite]);
} else {
FURI_LOG_E("DesktopSrv", "Can't find favorite application");
diff --git a/applications/subghz/helpers/subghz_testing.c b/applications/subghz/helpers/subghz_testing.c
index b3dc610f..4c83b2a9 100644
--- a/applications/subghz/helpers/subghz_testing.c
+++ b/applications/subghz/helpers/subghz_testing.c
@@ -4,8 +4,11 @@ const uint32_t subghz_frequencies_testing[] = {
/* 300 - 348 */
300000000,
304500000,
+ 312025000,
+ 313250000,
313250000,
315000000,
+ 315225000,
321950000,
348000000,
/* 387 - 464 */
@@ -31,4 +34,4 @@ const uint32_t subghz_frequencies_testing[] = {
const uint32_t subghz_frequencies_count_testing =
sizeof(subghz_frequencies_testing) / sizeof(uint32_t);
-const uint32_t subghz_frequencies_433_92_testing = 9; \ No newline at end of file
+const uint32_t subghz_frequencies_433_92_testing = 12; \ No newline at end of file
diff --git a/applications/subghz/subghz_cli.c b/applications/subghz/subghz_cli.c
index b2b4523d..a52defa3 100644
--- a/applications/subghz/subghz_cli.c
+++ b/applications/subghz/subghz_cli.c
@@ -24,7 +24,7 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) {
int ret = sscanf(string_get_cstr(args), "%lu", &frequency);
if(ret != 1) {
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
- cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args));
+ cli_print_usage("subghz tx_carrier", "<Frequency: in Hz>", string_get_cstr(args));
return;
}
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
@@ -67,7 +67,7 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) {
int ret = sscanf(string_get_cstr(args), "%lu", &frequency);
if(ret != 1) {
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
- cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args));
+ cli_print_usage("subghz rx_carrier", "<Frequency: in Hz>", string_get_cstr(args));
return;
}
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
@@ -115,8 +115,8 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) {
frequency,
repeat);
cli_print_usage(
- "subghz_rx",
- "<3 Byte Key in hex> <Frequency in HZ> <Repeat count>",
+ "subghz tx",
+ "<3 Byte Key: in hex> <Frequency: in Hz> <Repeat count>",
string_get_cstr(args));
return;
}
@@ -198,7 +198,7 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
int ret = sscanf(string_get_cstr(args), "%lu", &frequency);
if(ret != 1) {
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
- cli_print_usage("subghz_rx", "<Frequency in HZ>", string_get_cstr(args));
+ cli_print_usage("subghz rx", "<Frequency: in Hz>", string_get_cstr(args));
return;
}
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
@@ -268,11 +268,22 @@ static void subghz_cli_command_print_usage() {
printf("Usage:\r\n");
printf("subghz <cmd> <args>\r\n");
printf("Cmd list:\r\n");
+
+ printf("\tchat <frequency:in Hz>\t - Chat with other Flippers\r\n");
printf(
- "\tencrypt_keeloq <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt keeloq manufacture keys\r\n");
- printf(
- "\tencrypt_raw <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt RAW data\r\n");
- printf("\tchat <frequency:in Herz>\t - Chat with other Flippers\r\n");
+ "\ttx <3 byte Key: in hex> <frequency: in Hz> <repeat: count>\t - Transmitting key\r\n");
+ printf("\trx <frequency:in Hz>\t - Reception key\r\n");
+
+ if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
+ printf("\r\n");
+ printf(" debug cmd:\r\n");
+ printf("\ttx_carrier <frequency:in Hz>\t - Transmit carrier\r\n");
+ printf("\trx_carrier <frequency:in Hz>\t - Receiv carrier\r\n");
+ printf(
+ "\tencrypt_keeloq <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt keeloq manufacture keys\r\n");
+ printf(
+ "\tencrypt_raw <path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>\t - Encrypt RAW data\r\n");
+ }
}
static void subghz_cli_command_encrypt_keeloq(Cli* cli, string_t args) {
@@ -360,7 +371,7 @@ static void subghz_cli_command_chat(Cli* cli, string_t args) {
int ret = sscanf(string_get_cstr(args), "%lu", &frequency);
if(ret != 1) {
printf("sscanf returned %d, frequency: %lu\r\n", ret, frequency);
- cli_print_usage("subghz_txrx", "<Frequency in HZ>", string_get_cstr(args));
+ cli_print_usage("subghz chat", "<Frequency: in Hz>", string_get_cstr(args));
return;
}
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
@@ -540,20 +551,41 @@ void subghz_cli_command(Cli* cli, string_t args, void* context) {
break;
}
- if(string_cmp_str(cmd, "encrypt_keeloq") == 0) {
- subghz_cli_command_encrypt_keeloq(cli, args);
+ if(string_cmp_str(cmd, "chat") == 0) {
+ subghz_cli_command_chat(cli, args);
break;
}
- if(string_cmp_str(cmd, "encrypt_raw") == 0) {
- subghz_cli_command_encrypt_raw(cli, args);
+ if(string_cmp_str(cmd, "tx") == 0) {
+ subghz_cli_command_tx(cli, args, context);
break;
}
- if(string_cmp_str(cmd, "chat") == 0) {
- subghz_cli_command_chat(cli, args);
+ if(string_cmp_str(cmd, "rx") == 0) {
+ subghz_cli_command_rx(cli, args, context);
break;
}
+ if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
+ if(string_cmp_str(cmd, "encrypt_keeloq") == 0) {
+ subghz_cli_command_encrypt_keeloq(cli, args);
+ break;
+ }
+
+ if(string_cmp_str(cmd, "encrypt_raw") == 0) {
+ subghz_cli_command_encrypt_raw(cli, args);
+ break;
+ }
+
+ if(string_cmp_str(cmd, "tx_carrier") == 0) {
+ subghz_cli_command_tx_carrier(cli, args, context);
+ break;
+ }
+
+ if(string_cmp_str(cmd, "rx_carrier") == 0) {
+ subghz_cli_command_rx_carrier(cli, args, context);
+ break;
+ }
+ }
subghz_cli_command_print_usage();
} while(false);
@@ -565,12 +597,6 @@ void subghz_on_system_start() {
#ifdef SRV_CLI
Cli* cli = furi_record_open("cli");
- cli_add_command(
- cli, "subghz_tx_carrier", CliCommandFlagDefault, subghz_cli_command_tx_carrier, NULL);
- cli_add_command(
- cli, "subghz_rx_carrier", CliCommandFlagDefault, subghz_cli_command_rx_carrier, NULL);
- cli_add_command(cli, "subghz_tx", CliCommandFlagDefault, subghz_cli_command_tx, NULL);
- cli_add_command(cli, "subghz_rx", CliCommandFlagDefault, subghz_cli_command_rx, NULL);
cli_add_command(cli, "subghz", CliCommandFlagDefault, subghz_cli_command, NULL);
furi_record_close("cli");
diff --git a/firmware/targets/f6/furi-hal/furi-hal-subghz.c b/firmware/targets/f6/furi-hal/furi-hal-subghz.c
index b54b4845..b25a3052 100644
--- a/firmware/targets/f6/furi-hal/furi-hal-subghz.c
+++ b/firmware/targets/f6/furi-hal/furi-hal-subghz.c
@@ -285,7 +285,7 @@ static const uint8_t furi_hal_subghz_preset_ook_async_patable[8] = {
0x00};
static const uint8_t furi_hal_subghz_preset_ook_async_patable_au[8] = {
0x00,
- 0x86, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
+ 0x37, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
0x00,
0x00,
0x00,
diff --git a/firmware/targets/f7/furi-hal/furi-hal-subghz.c b/firmware/targets/f7/furi-hal/furi-hal-subghz.c
index b54b4845..b25a3052 100644
--- a/firmware/targets/f7/furi-hal/furi-hal-subghz.c
+++ b/firmware/targets/f7/furi-hal/furi-hal-subghz.c
@@ -285,7 +285,7 @@ static const uint8_t furi_hal_subghz_preset_ook_async_patable[8] = {
0x00};
static const uint8_t furi_hal_subghz_preset_ook_async_patable_au[8] = {
0x00,
- 0x86, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
+ 0x37, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
0x00,
0x00,
0x00,