Skip to content

Commit bddb7af

Browse files
Merge pull request #18 from jaylikesbunda/main
v1.1.3
2 parents d3a5906 + 936ded6 commit bddb7af

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## v1.1.3
4+
- **Added specific buttondown icon for help menu button to not be dependent on firmware icons**
5+
36
## v1.1.2
47
- improved ESP connection check reliability by trying AT command first with shorter timeouts, while keeping original 'stop' command as fallback
58

application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ App(
99
fap_category="GPIO/ESP",
1010
# Optional values
1111
icon="A_GhostESP_14",
12-
fap_version="1.1.2",
12+
fap_version="1.1.3",
1313
fap_icon="ghost_esp.png", # 10x10 1-bit PNG
1414
fap_icon_assets="images", # Image assets to compile for this application
1515
)

gui_modules/mainmenu.c

+28-19
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define ICON_WIDTH 20
1515
#define ICON_PADDING 3
1616
#define TEXT_BOTTOM_MARGIN 8
17+
#define BUTTON_HEIGHT 12
1718

1819
typedef struct {
1920
uint8_t x;
@@ -108,6 +109,31 @@ void main_menu_set_help_callback(MainMenu* main_menu, MainMenuItemCallback callb
108109
main_menu->help_context = context;
109110
}
110111

112+
static void draw_help_button(Canvas* canvas) {
113+
const char* str = "Help";
114+
const size_t vertical_offset = 3;
115+
const size_t horizontal_offset = 3;
116+
const size_t string_width = canvas_string_width(canvas, str);
117+
118+
// Create a small arrow icon directly
119+
const uint8_t arrow_width = 7;
120+
const uint8_t arrow_height = 4;
121+
const int32_t icon_h_offset = 3;
122+
const int32_t icon_width_with_offset = arrow_width + icon_h_offset;
123+
const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset;
124+
125+
const int32_t x = (canvas_width(canvas) - button_width) / 2;
126+
const int32_t y = canvas_height(canvas);
127+
128+
// Draw text
129+
canvas_draw_str(canvas, x + horizontal_offset, y - vertical_offset, str);
130+
131+
// Draw small down arrow
132+
const int32_t arrow_x = x + horizontal_offset + string_width + icon_h_offset;
133+
const int32_t arrow_y = y - vertical_offset - arrow_height;
134+
canvas_draw_line(canvas, arrow_x + 3, arrow_y + 3, arrow_x + 6, arrow_y);
135+
canvas_draw_line(canvas, arrow_x + 3, arrow_y + 3, arrow_x, arrow_y);
136+
}
111137

112138
static CardLayout calculate_card_layout(
113139
Canvas* canvas,
@@ -250,27 +276,10 @@ static void main_menu_view_draw_callback(Canvas* canvas, void* _model) {
250276
position++;
251277
}
252278

253-
// Draw help button last, so it's on top of everything
279+
// Draw help button last
254280
canvas_set_font(canvas, FontSecondary);
255281
canvas_set_color(canvas, ColorBlack);
256-
257-
const size_t vertical_offset = 3;
258-
const size_t horizontal_offset = 3;
259-
const size_t string_width = canvas_string_width(canvas, "Help");
260-
const Icon* icon = &I_ButtonDown_7x4;
261-
const int32_t icon_h_offset = 3;
262-
const int32_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset;
263-
const int32_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1;
264-
const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset;
265-
266-
const int32_t x = (canvas_width(canvas) - button_width) / 2;
267-
const int32_t y = canvas_height(canvas);
268-
269-
// Position at bottom with proper margins
270-
canvas_draw_str(canvas, x + horizontal_offset, y - vertical_offset, "Help");
271-
canvas_draw_icon(
272-
canvas, x + horizontal_offset + string_width + icon_h_offset, y - icon_v_offset, icon);
273-
// Reset color
282+
draw_help_button(canvas);
274283
canvas_set_color(canvas, ColorBlack);
275284
}
276285
static bool main_menu_view_input_callback(InputEvent* event, void* context) {

src/ghost_esp_icons.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
extern const Icon I_Wifi_icon;
55
extern const Icon I_BLE_icon;
66
extern const Icon I_GPS_icon;
7-
extern const Icon I_Cog;
8-
extern const Icon I_ButtonDown_7x4;
7+
extern const Icon I_Cog;

src/settings_ui.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ bool settings_custom_event_callback(void* context, uint32_t event_id) {
396396
"Updated by: Jay Candel\n"
397397
"Built with <3";
398398

399-
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.1.2");
399+
confirmation_view_set_header(app_state->confirmation_view, "Ghost ESP v1.1.3");
400400
confirmation_view_set_text(app_state->confirmation_view, info_text);
401401

402402
// Save current view before switching

0 commit comments

Comments
 (0)