Skip to content

Commit

Permalink
Remove unused ledgerblue code and address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonored committed Dec 7, 2019
1 parent b21234c commit 64e5d1c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 36 deletions.
5 changes: 4 additions & 1 deletion src/apdu_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ static bool parse_allowed_operations(
) {
return parse_operations(out, in, in_size, key->derivation_type, &key->bip32_path, &is_operation_allowed);
}
#endif

#else

static bool parse_allowed_operation_packet(
struct parsed_operation_group *const out,
Expand All @@ -125,6 +126,8 @@ static bool parse_allowed_operation_packet(
return parse_operations_packet(out, in, in_size, &is_operation_allowed);
}

#endif

#ifdef BAKING_APP // ----------------------------------------------------------

__attribute__((noreturn)) static void prompt_register_delegate(
Expand Down
52 changes: 17 additions & 35 deletions src/ui_nano_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,58 +47,44 @@ static unsigned button_handler(unsigned button_mask, unsigned button_mask_counte

#define PROMPT_CYCLES 3

#ifdef TARGET_BLUE
#define BLUE_BAGL_ELEMENT_T_FIELDS , 0, 0, 0, NULL, NULL, NULL
#else
#define BLUE_BAGL_ELEMENT_T_FIELDS
#endif // TARGET_BLUE

#ifdef BAKING_APP
static const bagl_element_t ui_idle_screen[] = {
// type userid x y w h str rad
// fill fg bg fid iid txt touchparams... ]
{{BAGL_RECTANGLE, 0x00, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF,
0, 0},
NULL
BLUE_BAGL_ELEMENT_T_FIELDS },
NULL },

{{BAGL_ICON, 0x00, 3, 12, 7, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0,
BAGL_GLYPH_ICON_CROSS},
NULL
BLUE_BAGL_ELEMENT_T_FIELDS },
NULL },

//{{BAGL_ICON , 0x01, 21, 9, 14, 14, 0, 0, 0
//, 0xFFFFFF, 0x000000, 0, BAGL_GLYPH_ICON_TRANSACTION_BADGE }, NULL, 0, 0,
//0, NULL, NULL, NULL },
{{BAGL_LABELINE, 0x01, 0, 12, 128, 12, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
"Last Block Level"
BLUE_BAGL_ELEMENT_T_FIELDS },
"Last Block Level" },

{{BAGL_LABELINE, 0x01, 0, 26, 128, 12, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
G.baking_idle_screens.hwm
BLUE_BAGL_ELEMENT_T_FIELDS },
G.baking_idle_screens.hwm },

{{BAGL_LABELINE, 0x02, 0, 12, 128, 12, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
"Baking Key"
BLUE_BAGL_ELEMENT_T_FIELDS },
"Baking Key" },

{{BAGL_LABELINE, 0x02, 23, 26, 82, 12, 0x80 | 10, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 26},
G.baking_idle_screens.pkh
BLUE_BAGL_ELEMENT_T_FIELDS },
G.baking_idle_screens.pkh },

{{BAGL_LABELINE, 0x03, 0, 12, 128, 12, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
"Chain"
BLUE_BAGL_ELEMENT_T_FIELDS },
"Chain" },

{{BAGL_LABELINE, 0x03, 23, 26, 82, 12, 0x80 | 10, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 26},
G.baking_idle_screens.chain
BLUE_BAGL_ELEMENT_T_FIELDS },
G.baking_idle_screens.chain },

};

Expand Down Expand Up @@ -275,28 +261,23 @@ unsigned char io_event(__attribute__((unused)) unsigned char channel) {
static const bagl_element_t ui_multi_screen[] = {
{{BAGL_RECTANGLE, BAGL_STATIC_ELEMENT, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF,
0, 0},
NULL
BLUE_BAGL_ELEMENT_T_FIELDS },
NULL },

{{BAGL_ICON, BAGL_STATIC_ELEMENT, 3, 12, 7, 7, 0, 0, 0, 0xFFFFFF, 0x000000, 0,
BAGL_GLYPH_ICON_CROSS},
NULL
BLUE_BAGL_ELEMENT_T_FIELDS },
NULL },

{{BAGL_ICON, BAGL_STATIC_ELEMENT, 117, 13, 8, 6, 0, 0, 0, 0xFFFFFF, 0x000000, 0,
BAGL_GLYPH_ICON_CHECK},
NULL
BLUE_BAGL_ELEMENT_T_FIELDS },
NULL },

{{BAGL_LABELINE, BAGL_STATIC_ELEMENT, 0, 12, 128, 12, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
global.ui.prompt.active_prompt
BLUE_BAGL_ELEMENT_T_FIELDS },
global.ui.prompt.active_prompt },

{{BAGL_LABELINE, BAGL_SCROLLING_ELEMENT, 23, 26, 82, 12, 0x80 | 10, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_EXTRABOLD_11px | BAGL_FONT_ALIGNMENT_CENTER, 26},
global.ui.prompt.active_value
BLUE_BAGL_ELEMENT_T_FIELDS },
global.ui.prompt.active_value },
};

void switch_screen(uint32_t which) {
Expand Down Expand Up @@ -330,10 +311,11 @@ void ui_prompt(const char *const *labels, ui_callback_t ok_c, ui_callback_t cxl_

ui_display(ui_multi_screen, NUM_ELEMENTS(ui_multi_screen),
ok_c, cxl_c, screen_count);
#ifndef DEBUG
THROW(ASYNC_EXCEPTION);
#else // In debug mode, the THROW above produces a PRINTF statement in an invalid position and causes the screen to blank. In debug mode, we just directly call the equivalent longjmp.
#ifdef DEBUG
// In debug mode, the THROW below produces a PRINTF statement in an invalid position and causes the screen to blank, so instead we just directly call the equivalent longjmp for debug only.
longjmp(try_context_get()->jmp_buf, ASYNC_EXCEPTION);
#else
THROW(ASYNC_EXCEPTION);
#endif
}

Expand Down

0 comments on commit 64e5d1c

Please sign in to comment.