Skip to content

Commit

Permalink
SubGhz: fix GUI ReadRAW and add new man (flipperdevices#843)
Browse files Browse the repository at this point in the history
* 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: あく <[email protected]>
  • Loading branch information
Skorpionm and skotopes authored Nov 26, 2021
1 parent f52e9fc commit 7c0943e
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 30 deletions.
9 changes: 8 additions & 1 deletion applications/notification/notification-messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions applications/notification/notification-messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 1 addition & 8 deletions applications/notification/notification-settings-app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions applications/subghz/helpers/subghz_custom_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef enum {
SubghzCustomEventViewReadRAWSendStart,
SubghzCustomEventViewReadRAWSendStop,
SubghzCustomEventViewReadRAWSave,
SubghzCustomEventViewReadRAWVibro,

SubghzCustomEventViewTransmitterBack,
SubghzCustomEventViewTransmitterSendStart,
Expand Down
4 changes: 4 additions & 0 deletions applications/subghz/scenes/subghz_scene_read_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion applications/subghz/scenes/subghz_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ 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) ==
SubghzCustomEventManagerSet) {
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(
Expand Down
18 changes: 10 additions & 8 deletions applications/subghz/views/subghz_read_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -326,7 +329,6 @@ bool subghz_read_raw_input(InputEvent* event, void* context) {
return true;
});
}

return true;
}

Expand Down
24 changes: 15 additions & 9 deletions assets/resources/subghz/keeloq_mfcodes
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion assets/resources/subghz/keeloq_mfcodes_user
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/subghz/protocols/subghz_protocol_keeloq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions lib/subghz/subghz_file_encoder_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 7c0943e

Please sign in to comment.