From 2bcae57967aeee9df60c1df7f90f216387569ee5 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 22:11:22 +0000 Subject: [PATCH 1/4] ci: add .deepsource.toml --- .deepsource.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..ae0e43d --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,7 @@ +version = 1 + +[[analyzers]] +name = "cxx" + +[[transformers]] +name = "clang-format" \ No newline at end of file From 4096b7d9b68d89f05ad82fd5eae1a4483a699b7a Mon Sep 17 00:00:00 2001 From: DerSkythe Date: Fri, 20 Sep 2024 08:51:15 +0400 Subject: [PATCH 2/4] feat: moved to FW GUI buttons --- helpers/gui_top_buttons.c | 59 ------------------------------- helpers/gui_top_buttons.h | 35 ------------------ scenes/subbrute_scene_load_file.c | 2 +- views/subbrute_attack_view.c | 5 ++- views/subbrute_main_view.c | 5 ++- 5 files changed, 5 insertions(+), 101 deletions(-) delete mode 100644 helpers/gui_top_buttons.c delete mode 100644 helpers/gui_top_buttons.h diff --git a/helpers/gui_top_buttons.c b/helpers/gui_top_buttons.c deleted file mode 100644 index 0415c5a..0000000 --- a/helpers/gui_top_buttons.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "gui_top_buttons.h" - -void elements_button_top_left(Canvas* canvas, const char* str) { - const Icon* icon = &I_ButtonUp_7x4; - - const uint8_t button_height = 12; - const uint8_t vertical_offset = 3; - const uint8_t horizontal_offset = 3; - const uint8_t string_width = canvas_string_width(canvas, str); - const uint8_t icon_h_offset = 3; - const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; - const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset; - const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; - - const uint8_t x = 0; - const uint8_t y = 0 + button_height; - - uint8_t line_x = x + button_width; - uint8_t line_y = y - button_height; - canvas_draw_box(canvas, x, line_y, button_width, button_height); - canvas_draw_line(canvas, line_x + 0, line_y, line_x + 0, y - 1); - canvas_draw_line(canvas, line_x + 1, line_y, line_x + 1, y - 2); - canvas_draw_line(canvas, line_x + 2, line_y, line_x + 2, y - 3); - - canvas_invert_color(canvas); - canvas_draw_icon(canvas, x + horizontal_offset, y - icon_v_offset, icon); - canvas_draw_str( - canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str); - canvas_invert_color(canvas); -} - -void elements_button_top_right(Canvas* canvas, const char* str) { - const Icon* icon = &I_ButtonDown_7x4; - - const uint8_t button_height = 12; - const uint8_t vertical_offset = 3; - const uint8_t horizontal_offset = 3; - const uint8_t string_width = canvas_string_width(canvas, str); - const uint8_t icon_h_offset = 3; - const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; - const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1; - const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; - - const uint8_t x = canvas_width(canvas); - const uint8_t y = 0 + button_height; - - uint8_t line_x = x - button_width; - uint8_t line_y = y - button_height; - canvas_draw_box(canvas, line_x, line_y, button_width, button_height); - canvas_draw_line(canvas, line_x - 1, line_y, line_x - 1, y - 1); - canvas_draw_line(canvas, line_x - 2, line_y, line_x - 2, y - 2); - canvas_draw_line(canvas, line_x - 3, line_y, line_x - 3, y - 3); - - canvas_invert_color(canvas); - canvas_draw_str(canvas, x - button_width + horizontal_offset, y - vertical_offset, str); - canvas_draw_icon( - canvas, x - horizontal_offset - icon_get_width(icon), y - icon_v_offset, icon); - canvas_invert_color(canvas); -} \ No newline at end of file diff --git a/helpers/gui_top_buttons.h b/helpers/gui_top_buttons.h deleted file mode 100644 index 6862ed6..0000000 --- a/helpers/gui_top_buttons.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -/** - * @brief This function draws a button in the top left corner of the canvas with icon and string. - * - * The design and layout of the button is defined within this function. - * - * - * @param[in] canvas This is a pointer to the @c Canvas structure where the button will be drawn. - * @param[in] str This is a pointer to the character string that will be drawn within the button. - * - * @note Thanks to the author of metronome @see https://github.com/panki27/Metronome - * - */ -void elements_button_top_left(Canvas* canvas, const char* str); - -/** - * @brief This function draws a button in the top right corner of the canvas with icon and string. - * - * The design and layout of the button is defined within this function. - * - * - * @param[in] canvas This is a pointer to the @c Canvas structure where the button will be drawn. - * @param[in] str This is a pointer to the character string that will be drawn within the button. - * - * @note Thanks to the author of metronome @see https://github.com/panki27/Metronome - * - */ -void elements_button_top_right(Canvas* canvas, const char* str); diff --git a/scenes/subbrute_scene_load_file.c b/scenes/subbrute_scene_load_file.c index aa78769..936ba72 100644 --- a/scenes/subbrute_scene_load_file.c +++ b/scenes/subbrute_scene_load_file.c @@ -56,7 +56,7 @@ void subbrute_scene_load_file_on_enter(void* context) { } // Ready to run! FURI_LOG_I(TAG, "Ready to run"); - res = true; + load_result = true; } } diff --git a/views/subbrute_attack_view.c b/views/subbrute_attack_view.c index 1f5766d..4cd9f56 100644 --- a/views/subbrute_attack_view.c +++ b/views/subbrute_attack_view.c @@ -1,6 +1,5 @@ #include "subbrute_attack_view.h" #include "../subbrute_i.h" -#include "../helpers/gui_top_buttons.h" #include #include @@ -310,8 +309,8 @@ void subbrute_attack_view_draw(Canvas* canvas, void* context) { elements_button_left(canvas, "-1"); elements_button_right(canvas, "+1"); elements_button_center(canvas, "Start"); - elements_button_top_left(canvas, "Save"); - elements_button_top_right(canvas, "Resend"); + elements_button_up(canvas, "Save"); + elements_button_down(canvas, "Resend"); } else { // canvas_draw_icon_animation const uint8_t icon_h_offset = 0; diff --git a/views/subbrute_main_view.c b/views/subbrute_main_view.c index 0a19979..3480725 100644 --- a/views/subbrute_main_view.c +++ b/views/subbrute_main_view.c @@ -1,6 +1,5 @@ #include "subbrute_main_view.h" #include "../subbrute_i.h" -#include "../helpers/gui_top_buttons.h" #include #include @@ -126,9 +125,9 @@ void subbrute_main_view_draw_is_byte_selected(Canvas* canvas, SubBruteMainViewMo // Switch to another mode if(model->two_bytes) { - elements_button_top_left(canvas, "One byte"); + elements_button_up(canvas, "One byte"); } else { - elements_button_top_left(canvas, "Two bytes"); + elements_button_down(canvas, "Two bytes"); } } From e29f15918636044d149a7643987bedbf5306097b Mon Sep 17 00:00:00 2001 From: DerSkythe <31771569+derskythe@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:53:50 +0400 Subject: [PATCH 3/4] fix: `subbrute_main_view.c` invalid button Signed-off-by: DerSkythe <31771569+derskythe@users.noreply.github.com> --- views/subbrute_main_view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/subbrute_main_view.c b/views/subbrute_main_view.c index 3480725..a840fe7 100644 --- a/views/subbrute_main_view.c +++ b/views/subbrute_main_view.c @@ -127,7 +127,7 @@ void subbrute_main_view_draw_is_byte_selected(Canvas* canvas, SubBruteMainViewMo if(model->two_bytes) { elements_button_up(canvas, "One byte"); } else { - elements_button_down(canvas, "Two bytes"); + elements_button_up(canvas, "Two bytes"); } } From e7645bc226d83986f2a81cef0935c8b152236183 Mon Sep 17 00:00:00 2001 From: DerSkythe <31771569+derskythe@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:55:50 +0400 Subject: [PATCH 4/4] bump: version 3.F Signed-off-by: DerSkythe <31771569+derskythe@users.noreply.github.com> --- subbrute_i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subbrute_i.h b/subbrute_i.h index 63748ed..8301a88 100644 --- a/subbrute_i.h +++ b/subbrute_i.h @@ -31,7 +31,7 @@ #include "views/subbrute_attack_view.h" #include "views/subbrute_main_view.h" -#define SUB_BRUTE_FORCER_VERSION "Sub-GHz BruteForcer 3.E" +#define SUB_BRUTE_FORCER_VERSION "Sub-GHz BruteForcer 3.F" #ifdef FURI_DEBUG //#define SUBBRUTE_FAST_TRACK false