Browse Source

PASS1-122_b (#23)

* PASS1-102: Fix backwards microSD issue

Found that `ErrorCode` in `SD_HandleTypeDef` was not reset after a failure.
Updated `HAL_SD_Init()` to reset it before attempting initialization.

* Update user messaging for found/not found case of Verify Address

Fix bug with trailing space at end of line in `word_wrap()`

* Strip ever time through the loop
PASS1-125
Ken Carpenter 4 years ago
committed by GitHub
parent
commit
c8fbd9d174
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      ports/stm32/boards/Passport/modules/actions.py
  2. 10
      ports/stm32/boards/Passport/modules/utils.py
  3. 6
      ports/stm32/boards/Passport/modules/ux.py

12
ports/stm32/boards/Passport/modules/actions.py

@ -296,10 +296,16 @@ class VerifyAddressUX(UXStateMachine):
save_next_addr(self.acct_num, addr_type, addr_idx, is_change) save_next_addr(self.acct_num, addr_type, addr_idx, is_change)
address = format_btc_address(address, addr_type) address = format_btc_address(address, addr_type)
result = await ux_show_story('''{} result = await ux_show_story('''Address Verified!
Found at index: {}\nType: {}'''.format(address, addr_idx, 'Change' if is_change == 1 else 'Receive'), title='Verified', left_btn='BACK', {}
right_btn='CONTINUE', center=True, center_vertically=True)
This is a {} address at index {}.'''.format(address, 'change' if is_change == 1 else 'receive', addr_idx),
title='Verify',
left_btn='BACK',
right_btn='CONTINUE',
center=True,
center_vertically=True)
if result == 'x': if result == 'x':
if not self.goto_prev(): if not self.goto_prev():
# Nothing to return back to, so we must have skipped one or more steps...we're done # Nothing to return back to, so we must have skipped one or more steps...we're done

10
ports/stm32/boards/Passport/modules/utils.py

@ -675,16 +675,18 @@ async def scan_for_address(acct_num, address, addr_type, deriv_path, ms_wallet):
return addr_idx, True if is_change else False return addr_idx, True if is_change else False
else: else:
# Address was not found in that batch of 100, so offer to keep searching # Address was not found in that batch of 100, so offer to keep searching
msg = 'Addresses Checked:\n\n' msg = 'Address Not Found.\n\nPassport checked '
# Build a merged range for receive and one for change addresses # Build a merged range for receive and one for change addresses
merged_range = [] merged_range = []
for is_change in range(0, 2): for is_change in range(0, 2):
msg += '{}: {}-{}\n'.format('Change' if is_change == 1 else 'Receive', low_range[is_change][0], high_range[is_change][1] - 1) msg += '{} addresses {}-{}{}'.format(
'change' if is_change == 1 else 'receive', low_range[is_change][0], high_range[is_change][1] - 1,
'.' if is_change == 1 else ', and ')
msg += '\nContinue searching?' msg += '\n\nContinue searching?'
result = await ux_show_story(msg, title='Not Found', left_btn='NO', right_btn='YES', result = await ux_show_story(msg, title='Verify', left_btn='NO', right_btn='YES',
center=True, center_vertically=True) center=True, center_vertically=True)
if result == 'x': if result == 'x':
return -1, False return -1, False

6
ports/stm32/boards/Passport/modules/ux.py

@ -599,10 +599,8 @@ def word_wrap(ln, font):
line_width = 0 line_width = 0
first_non_space = 0 first_non_space = 0
# Skip leading spaces # Strip out leading and trailing spaces
while ln[sp].isspace(): ln = ln.strip()
sp += 1
first_non_space = sp
while sp < len(ln): while sp < len(ln):
ch = ln[sp] ch = ln[sp]

Loading…
Cancel
Save