From 7c0943e7364b3d03e099654548ec9c264b58ef60 Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Fri, 26 Nov 2021 18:01:03 +0400 Subject: [PATCH] SubGhz: fix GUI ReadRAW and add new man (#843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Notification: add sequence_single_vibro * SubGhz: optimizing the performance of the GUI ReadRAW * SubGhz: full highlighting of the default filename on save * SubGhz: add man Leopard, Faraon, Reff, ZX-750, Back_SL-B9, fix syntax Co-authored-by: あく --- .../notification/notification-messages.c | 9 ++++++- .../notification/notification-messages.h | 1 + .../notification/notification-settings-app.c | 9 +------ .../subghz/helpers/subghz_custom_event.h | 1 + .../subghz/scenes/subghz_scene_read_raw.c | 4 ++++ .../subghz/scenes/subghz_scene_save_name.c | 4 +++- applications/subghz/views/subghz_read_raw.c | 18 +++++++------- assets/resources/subghz/keeloq_mfcodes | 24 ++++++++++++------- assets/resources/subghz/keeloq_mfcodes_user | 2 +- lib/subghz/protocols/subghz_protocol_keeloq.c | 4 ++-- lib/subghz/subghz_file_encoder_worker.c | 1 + 11 files changed, 47 insertions(+), 30 deletions(-) diff --git a/applications/notification/notification-messages.c b/applications/notification/notification-messages.c index e8dbbc9c..d600d8c5 100644 --- a/applications/notification/notification-messages.c +++ b/applications/notification/notification-messages.c @@ -309,7 +309,14 @@ const NotificationSequence sequence_blink_white_100 = { NULL, }; -// General +//General +const NotificationSequence sequence_single_vibro = { + &message_vibro_on, + &message_delay_100, + &message_vibro_off, + NULL, +}; + const NotificationSequence sequence_double_vibro = { &message_vibro_on, &message_delay_100, diff --git a/applications/notification/notification-messages.h b/applications/notification/notification-messages.h index 3aad3e09..add4a55d 100644 --- a/applications/notification/notification-messages.h +++ b/applications/notification/notification-messages.h @@ -89,6 +89,7 @@ extern const NotificationSequence sequence_blink_magenta_100; extern const NotificationSequence sequence_blink_white_100; // General +extern const NotificationSequence sequence_single_vibro; extern const NotificationSequence sequence_double_vibro; extern const NotificationSequence sequence_success; extern const NotificationSequence sequence_error; diff --git a/applications/notification/notification-settings-app.c b/applications/notification/notification-settings-app.c index 78d7c65e..93f36e7a 100644 --- a/applications/notification/notification-settings-app.c +++ b/applications/notification/notification-settings-app.c @@ -19,13 +19,6 @@ static const NotificationSequence sequence_note_c = { NULL, }; -static const NotificationSequence sequence_vibro = { - &message_vibro_on, - &message_delay_100, - &message_vibro_off, - NULL, -}; - #define BACKLIGHT_COUNT 5 const char* const backlight_text[BACKLIGHT_COUNT] = { "0%", @@ -150,7 +143,7 @@ static void vibro_changed(VariableItem* item) { variable_item_set_current_value_text(item, vibro_text[index]); app->notification->settings.vibro_on = vibro_value[index]; - notification_message(app->notification, &sequence_vibro); + notification_message(app->notification, &sequence_single_vibro); } static uint32_t notification_app_settings_exit(void* context) { diff --git a/applications/subghz/helpers/subghz_custom_event.h b/applications/subghz/helpers/subghz_custom_event.h index 1d919b8c..65b412f8 100644 --- a/applications/subghz/helpers/subghz_custom_event.h +++ b/applications/subghz/helpers/subghz_custom_event.h @@ -29,6 +29,7 @@ typedef enum { SubghzCustomEventViewReadRAWSendStart, SubghzCustomEventViewReadRAWSendStop, SubghzCustomEventViewReadRAWSave, + SubghzCustomEventViewReadRAWVibro, SubghzCustomEventViewTransmitterBack, SubghzCustomEventViewTransmitterSendStart, diff --git a/applications/subghz/scenes/subghz_scene_read_raw.c b/applications/subghz/scenes/subghz_scene_read_raw.c index 0bdd394c..c9d59d8d 100644 --- a/applications/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/subghz/scenes/subghz_scene_read_raw.c @@ -108,6 +108,10 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE; return true; break; + case SubghzCustomEventViewReadRAWVibro: + notification_message(subghz->notifications, &sequence_single_vibro); + return true; + break; case SubghzCustomEventViewReadRAWSendStart: //set the path to read the file if(strcmp( diff --git a/applications/subghz/scenes/subghz_scene_save_name.c b/applications/subghz/scenes/subghz_scene_save_name.c index b86f9655..4442d39d 100644 --- a/applications/subghz/scenes/subghz_scene_save_name.c +++ b/applications/subghz/scenes/subghz_scene_save_name.c @@ -18,7 +18,7 @@ void subghz_scene_save_name_on_enter(void* context) { if(!strcmp(subghz->file_name, "")) { set_random_name(subghz->file_name, sizeof(subghz->file_name)); - dev_name_empty = true; + } else { memcpy(subghz->file_name_tmp, subghz->file_name, strlen(subghz->file_name) + 1); if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) == @@ -26,6 +26,8 @@ void subghz_scene_save_name_on_enter(void* context) { subghz_get_next_name_file(subghz); } } + //highlighting the entire filename by default + dev_name_empty = true; text_input_set_header_text(text_input, "Name signal"); text_input_set_result_callback( diff --git a/applications/subghz/views/subghz_read_raw.c b/applications/subghz/views/subghz_read_raw.c index b48c8e6f..11b711d7 100644 --- a/applications/subghz/views/subghz_read_raw.c +++ b/applications/subghz/views/subghz_read_raw.c @@ -123,7 +123,7 @@ static int8_t subghz_read_raw_tab_sin(uint8_t x) { void subghz_read_raw_draw_sin(Canvas* canvas, SubghzReadRAWModel* model) { #define SUBGHZ_RAW_SIN_AMPLITUDE 11 - for(int i = 114; i > 0; i--) { + for(int i = 113; i > 0; i--) { canvas_draw_line( canvas, i, @@ -212,12 +212,12 @@ void subghz_read_raw_draw(Canvas* canvas, SubghzReadRAWModel* model) { canvas_draw_line(canvas, 0, 14, 115, 14); canvas_draw_line(canvas, 0, 48, 115, 48); canvas_draw_line(canvas, 115, 14, 115, 48); - subghz_read_raw_draw_scale(canvas, model); if((model->satus == SubghzReadRAWStatusTX) || (model->satus == SubghzReadRAWStatusTXRepeat)) { subghz_read_raw_draw_sin(canvas, model); } else { subghz_read_raw_draw_rssi(canvas, model); + subghz_read_raw_draw_scale(canvas, model); } if(model->satus == SubghzReadRAWStatusIDLE) { @@ -243,13 +243,19 @@ bool subghz_read_raw_input(InputEvent* event, void* context) { furi_assert(context); SubghzReadRAW* instance = context; - if(event->key == InputKeyOk && event->type == InputTypePress) { + if((event->key == InputKeyOk) && + (event->type == InputTypeLong || event->type == InputTypeRepeat)) { + //we check that if we hold the transfer button, + //further check of events is not needed, we exit + return false; + } else if(event->key == InputKeyOk && event->type == InputTypePress) { with_view_model( instance->view, (SubghzReadRAWModel * model) { uint8_t ret = false; if(model->satus == SubghzReadRAWStatusIDLE) { // Start TX instance->callback(SubghzCustomEventViewReadRAWSendStart, instance->context); + instance->callback(SubghzCustomEventViewReadRAWVibro, instance->context); model->satus = SubghzReadRAWStatusTXRepeat; ret = true; } else if(model->satus == SubghzReadRAWStatusTX) { @@ -279,16 +285,13 @@ bool subghz_read_raw_input(InputEvent* event, void* context) { } return true; }); - } else if(event->key == InputKeyLeft && event->type == InputTypeShort) { with_view_model( instance->view, (SubghzReadRAWModel * model) { if(model->satus == SubghzReadRAWStatusStart) { //Config instance->callback(SubghzCustomEventViewReadRAWConfig, instance->context); - } - - if(model->satus == SubghzReadRAWStatusIDLE) { + } else if(model->satus == SubghzReadRAWStatusIDLE) { //Erase model->satus = SubghzReadRAWStatusStart; model->rssi_history_end = false; @@ -326,7 +329,6 @@ bool subghz_read_raw_input(InputEvent* event, void* context) { return true; }); } - return true; } diff --git a/assets/resources/subghz/keeloq_mfcodes b/assets/resources/subghz/keeloq_mfcodes index 3733b76c..a18dd590 100644 --- a/assets/resources/subghz/keeloq_mfcodes +++ b/assets/resources/subghz/keeloq_mfcodes @@ -21,12 +21,18 @@ D8CD53AB5A94898EB53D4FF46546ADBAA24691181A396052A58AAC657D6817AB 43200E08C21747CABC59538888A259238E782545732A1A6EEE00A6929EC9DD97A8BA9812372374046AC66652CC561D60 C38CBE29F22D0E83E58A52E94AA2485DA8E702FBDB89D27249473CB8A19AEF61 9F0EB580F7474985E8460E1682451E213778B77A9CAB4734B75C5386851050BF -2364EBB8237363B21226565675B9F478482CADAE41E795C27287E26137797C10 -775C9A28BA50D759FB438D0200121F01F7DB11986D44D3960F745EAA1E7A2CE2AD92AD718AFCD98BC3269C39F65ADC53 -80F637A04446BF1FBEF3399307527403A15031FC4030F7C1E8217A2367B21A52 -1E3EC8CCECC14E8898D13BB2EEEC1EABABCD83D6930DBB8D381D8378EC5FAF22 -46A68DD969BFF20ADFAC767AFA87D3CA98AE6C056B0B4D43A5A24A7ABBD88D57 -FEC591F298259129A9EC9BE66D903C2D5D94A17D38CD889C878664FC3C118FDA -2BC0AA2C0909417140615C7E901566A9AD2F88BCF500A0AF82A79BE4C0B013CE -D9C9119FE35EB25800F60C2D5D2F018D43CC888147D469BF26F86A8DBABB2DCB -6FFECFF334702D6E32B55B5CDE4191176D2D3CC3A3CE10E880425BD7FC262193 +2364EBB8237363B21226565675B9F47819C5BBC7E917C761BA3652D0A6ED7D3273EB8F3B7FBA68DE4143FB15BBEC35FB +CCDE559A2901A8290D6B2E8EDF66612E4C90E2E7C63643C8C5F244E30874B41039E078089E2253DA73B3A6DD821A84CD +33B239455FBE7AB8CE833C3B9C063EFEAE1FC7AC876AF3294C67D5B08BF7E9EC +F0FBBCEFE99D25104022CD3621B21B5F84FFBC9A5E21B0AED2B1560B39524A5B +E15B0614D9ECA17784E994652755559B7A3DA4B53CE6E63108BCFCD8024761DD +9E244C80E72937274DD6B2787F1A75F278A2DF7CB3B89F7C2BF7CC8DBBF2A3F0 +689DCA188A40DFDD3575A9BD9D7AF2427D0CE707F591029463AEC6B8679969AC +25D9B04D10AF541925901F55D8D7FA9C87523995F53183FB04F00C6023D5930A +D11F70508485C019AFC5FDBE5FD7223710033483C803FC7C2C69BAAD6ACB7CA7 +C081A0ACEA8210AB117028EDFF15641EE287CB1CFF8332A9D208B7324523129E +4C5B7C959C00A30F39A431B20EA1FEBDFB1C71C01CCC45DD883CD511360479BE +ECC0A8237E19D3883A06C5A700647860B3D9E570976D3606A11A4005424FD935 +8F5D7B39696F6F5C2100FFDF71D1C8ECAD98BD1D4CEE7BA8C793815747CE6FD5 +52ED6DE1583093E8D8AB8D16C912F7E89F78A24CE36ED53D3E06D3F81BF62ED1 +416015A128EA3A008573DE760C6AE05BD958BFCB46351F614B617CEE55C5E294 diff --git a/assets/resources/subghz/keeloq_mfcodes_user b/assets/resources/subghz/keeloq_mfcodes_user index 6361d85e..910157d6 100644 --- a/assets/resources/subghz/keeloq_mfcodes_user +++ b/assets/resources/subghz/keeloq_mfcodes_user @@ -1,7 +1,7 @@ # for adding manufacture keys # AABBCCDDEEFFAABB:X:NAME\r\n # AABBCCDDEEFFAABB - man 64 bit -# X - encryption method 1 - Simple Learning, 2 - Normal_Learning, +# X - encryption method 1 - Simple Learning, 2 - Normal_Learning, 3 - Secure_Learning # 0 - iterates over both previous and man in direct and reverse byte sequence # NAME - name (string without spaces) max 64 characters long Filetype: Flipper SubGhz Keystore File diff --git a/lib/subghz/protocols/subghz_protocol_keeloq.c b/lib/subghz/protocols/subghz_protocol_keeloq.c index 42352462..1db8da4d 100644 --- a/lib/subghz/protocols/subghz_protocol_keeloq.c +++ b/lib/subghz/protocols/subghz_protocol_keeloq.c @@ -96,7 +96,7 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector( } break; case KEELOQ_LEARNING_NORMAL: - // Normal_Learning + // Normal Learning // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man_learning = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); @@ -135,7 +135,7 @@ uint8_t subghz_protocol_keeloq_check_remote_controller_selector( return 1; } //########################### - // Normal_Learning + // Normal Learning // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man_learning = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); diff --git a/lib/subghz/subghz_file_encoder_worker.c b/lib/subghz/subghz_file_encoder_worker.c index 8a18c8f0..2bf8da9d 100644 --- a/lib/subghz/subghz_file_encoder_worker.c +++ b/lib/subghz/subghz_file_encoder_worker.c @@ -163,6 +163,7 @@ static int32_t subghz_file_encoder_worker_thread(void* context) { break; } } + osDelay(5); } //waiting for the end of the transfer FURI_LOG_I(TAG, "End read file");