[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>
This commit is contained in:
parent
f061b937d0
commit
fb7cc1dd60
@ -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");
|
||||
|
@ -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;
|
||||
const uint32_t subghz_frequencies_433_92_testing = 12;
|
@ -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(
|
||||
"\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");
|
||||
printf("\tchat <frequency:in Herz>\t - Chat with other Flippers\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,6 +551,21 @@ void subghz_cli_command(Cli* cli, string_t args, void* context) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(string_cmp_str(cmd, "chat") == 0) {
|
||||
subghz_cli_command_chat(cli, args);
|
||||
break;
|
||||
}
|
||||
|
||||
if(string_cmp_str(cmd, "tx") == 0) {
|
||||
subghz_cli_command_tx(cli, args, context);
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
@ -550,11 +576,17 @@ void subghz_cli_command(Cli* cli, string_t args, void* context) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(string_cmp_str(cmd, "chat") == 0) {
|
||||
subghz_cli_command_chat(cli, args);
|
||||
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");
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user