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-133
Ken Carpenter 3 years ago
parent
commit
bbb03f3708
  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)
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 not self.goto_prev():
# 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
else:
# 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
merged_range = []
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)
if result == 'x':
return -1, False

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

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

Loading…
Cancel
Save