Skip to content

Commit ec27fc1

Browse files
subinita01odudex
authored andcommitted
fix(capture_entropy): add missing back button for cancel path
1 parent 6030792 commit ec27fc1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

main/pages/capture_entropy.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "../components/video/video.h"
1616
#include "../ui/dialog.h"
17+
#include "../ui/input_helpers.h"
1718
#include "../ui/theme_widgets.h"
1819
#include "../utils/memory_utils.h"
1920
#include "../utils/secure_mem.h"
@@ -83,6 +84,15 @@ static void low_entropy_prompt_cb(bool retry, void *user_data) {
8384
// If retry (Yes), do nothing - user stays on camera page
8485
}
8586

87+
static void back_btn_cb(lv_event_t *e) {
88+
(void)e;
89+
if (closing)
90+
return;
91+
closing = true;
92+
if (return_callback)
93+
return_callback();
94+
}
95+
8696
static uint8_t *allocate_buffer(size_t size) {
8797
// PPA writes directly into these buffers, so they must be cache-line aligned.
8898
size_t aligned = (size + CONFIG_CACHE_L2_CACHE_LINE_SIZE - 1) &
@@ -337,6 +347,8 @@ void capture_entropy_page_create(lv_obj_t *parent, void (*return_cb)(void)) {
337347
lv_obj_set_style_text_color(instruction, highlight_color(), 0);
338348
lv_obj_align(instruction, LV_ALIGN_BOTTOM_MID, 0, -theme_default_padding());
339349

350+
ui_create_back_button(capture_screen, back_btn_cb);
351+
340352
if (!camera_init()) {
341353
ESP_LOGE(TAG, "Failed to initialize camera");
342354
return;

0 commit comments

Comments
 (0)