2
2
#include <gui/elements.h>
3
3
4
4
uint8_t counter = 0 ;
5
- #define TIME_BETWEEN_CARDS 6
5
+
6
6
uint8_t id_list [17 ][5 ] = {
7
7
{0x00 , 0x00 , 0x00 , 0x00 , 0x00 }, // Null bytes
8
8
{0xFF , 0xFF , 0xFF , 0xFF , 0xFF }, // Only FF
@@ -78,6 +78,7 @@ uint8_t id_list_h[14][3] = {
78
78
};
79
79
80
80
void flipfrid_scene_run_attack_on_enter (FlipFridState * context ) {
81
+ context -> time_between_cards = 10 ;
81
82
context -> attack_step = 0 ;
82
83
context -> dict = protocol_dict_alloc (lfrfid_protocols , LFRFIDProtocolMax );
83
84
context -> worker = lfrfid_worker_alloc (context -> dict );
@@ -488,30 +489,11 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
488
489
}
489
490
}
490
491
}
491
- if (context -> proto == PAC ) {
492
- if (counter > 10 ) {
493
- counter = 0 ;
494
- } else {
495
- counter ++ ;
496
- }
497
- } else if (context -> proto == HIDProx ) {
498
- if (counter > 10 ) {
499
- counter = 0 ;
500
- } else {
501
- counter ++ ;
502
- }
503
- } else if (context -> proto == H10301 ) {
504
- if (counter > 10 ) {
505
- counter = 0 ;
506
- } else {
507
- counter ++ ;
508
- }
492
+
493
+ if (counter > context -> time_between_cards ) {
494
+ counter = 0 ;
509
495
} else {
510
- if (counter > TIME_BETWEEN_CARDS ) {
511
- counter = 0 ;
512
- } else {
513
- counter ++ ;
514
- }
496
+ counter ++ ;
515
497
}
516
498
}
517
499
}
@@ -521,9 +503,22 @@ void flipfrid_scene_run_attack_on_event(FlipFridEvent event, FlipFridState* cont
521
503
if (event .input_type == InputTypeShort ) {
522
504
switch (event .key ) {
523
505
case InputKeyDown :
506
+ break ;
524
507
case InputKeyUp :
508
+ break ;
525
509
case InputKeyLeft :
510
+ if (!context -> is_attacking ) {
511
+ if (context -> time_between_cards > 0 ) {
512
+ context -> time_between_cards -- ;
513
+ }
514
+ }
515
+ break ;
526
516
case InputKeyRight :
517
+ if (!context -> is_attacking ) {
518
+ if (context -> time_between_cards < 60 ) {
519
+ context -> time_between_cards ++ ;
520
+ }
521
+ }
527
522
break ;
528
523
case InputKeyOk :
529
524
counter = 0 ;
@@ -562,9 +557,10 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
562
557
// Title
563
558
canvas_set_font (canvas , FontPrimary );
564
559
canvas_draw_str_aligned (
565
- canvas , 64 , 8 , AlignCenter , AlignTop , string_get_cstr (context -> attack_name ));
560
+ canvas , 64 , 2 , AlignCenter , AlignTop , string_get_cstr (context -> attack_name ));
566
561
567
562
char uid [18 ];
563
+ char speed [16 ];
568
564
if (context -> proto == HIDProx ) {
569
565
snprintf (
570
566
uid ,
@@ -605,18 +601,25 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
605
601
context -> payload [4 ]);
606
602
}
607
603
608
- canvas_draw_str_aligned (canvas , 64 , 36 , AlignCenter , AlignTop , uid );
604
+ canvas_draw_str_aligned (canvas , 64 , 38 , AlignCenter , AlignTop , uid );
609
605
610
606
canvas_set_font (canvas , FontSecondary );
611
607
612
608
canvas_draw_str_aligned (
613
- canvas , 64 , 22 , AlignCenter , AlignTop , string_get_cstr (context -> proto_name ));
609
+ canvas , 64 , 26 , AlignCenter , AlignTop , string_get_cstr (context -> proto_name ));
610
+
611
+ snprintf (speed , sizeof (speed ), "Time delay: %d" , context -> time_between_cards );
612
+
613
+ //canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignTop, "Speed:");
614
+ canvas_draw_str_aligned (canvas , 64 , 14 , AlignCenter , AlignTop , speed );
614
615
//char start_stop_msg[20];
615
616
if (context -> is_attacking ) {
616
617
elements_button_center (canvas , "Stop" );
617
618
//snprintf(start_stop_msg, sizeof(start_stop_msg), " Press OK to stop ");
618
619
} else {
619
620
elements_button_center (canvas , "Start" );
621
+ elements_button_left (canvas , "TD -" );
622
+ elements_button_right (canvas , "+ TD" );
620
623
}
621
624
//canvas_draw_str_aligned(canvas, 64, 44, AlignCenter, AlignTop, start_stop_msg);
622
625
}
0 commit comments