From a8941f222bf2a943e38ceab49ac0d6588cd72605 Mon Sep 17 00:00:00 2001 From: Tyler <5952757+TylerHann@users.noreply.github.com> Date: Thu, 16 May 2019 19:29:29 -0600 Subject: [PATCH] More consistent code style --- src/ui/nano/nano_draw.c | 3 ++- src/ui/ui_common.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/nano/nano_draw.c b/src/ui/nano/nano_draw.c index e631f8ed..7c021820 100644 --- a/src/ui/nano/nano_draw.c +++ b/src/ui/nano/nano_draw.c @@ -245,8 +245,9 @@ void nano_draw_address_digest() format_address_abbrev(addr, nano_get_text_buffer(TOP)); format_address_checksum(addr, nano_get_text_buffer(BOT)); - if (ui_state.state == STATE_BUNDLE) + if (ui_state.state == STATE_BUNDLE) { NANO_DRAW_ELEMENTS(EL_UP); + } #ifdef TARGET_NANOS NANO_DRAW_ELEMENTS(EL_DOWN, EL_CONFIRM); diff --git a/src/ui/ui_common.c b/src/ui/ui_common.c index e0f8c4b6..26401e1d 100644 --- a/src/ui/ui_common.c +++ b/src/ui/ui_common.c @@ -52,11 +52,11 @@ static size_t format_s64(char *s, const size_t n, const int64_t val) } if (ABS(val) < MAX_INT_DEC) { - snprintf(s, n, "%d", (int)ABS(val)); + snprintf(s, n, "%d", (int)val); } else { // emulate printing of integers larger than 32 bit - snprintf(s, n, "%d%09d", (int)(ABS(val) / MAX_INT_DEC), + snprintf(s, n, "%d%09d", (int)(val / MAX_INT_DEC), (int)(ABS(val) % MAX_INT_DEC)); } return strnlen(s, n); @@ -66,7 +66,7 @@ void format_value_full(char *s, const unsigned int n, const int64_t val) { char buffer[n]; - const size_t num_len = format_s64(buffer, sizeof(buffer), val); + const size_t num_len = format_s64(buffer, sizeof(buffer), ABS(val)); const size_t num_len_comma = num_len + (num_len - 1) / 3; // if the length with commas plus the unit does not fit @@ -82,7 +82,7 @@ void format_value_full(char *s, const unsigned int n, const int64_t val) void format_value_short(char *s, const unsigned int n, int64_t val) { if (ABS(val) < 1000) { - snprintf(s, n, "%d %s", (int)ABS(val), IOTA_UNITS[0]); + snprintf(s, n, "%d %s", (int)(ABS(val)), IOTA_UNITS[0]); return; }