BIP39 passphrase is both passphrase nad tmp on status bar; few todos + fixes after rebase

This commit is contained in:
scgbckbone 2023-12-05 15:07:48 +01:00
parent 0d625d516f
commit 5dcbc9a5d3
6 changed files with 16 additions and 26 deletions

View File

@ -2,13 +2,9 @@
#
# lcd_display.py - LCD rendering for Q1's 320x240 pixel *colour* display!
#
import machine, uzlib, ckcc, utime, struct, array, sys
import framebuf
import uasyncio
import machine, uzlib, utime, array
from uasyncio import sleep_ms
from graphics_q1 import Graphics
from graphics import Graphics as obsoleteGraphics
import sram2
from st7788 import ST7788
from utils import xfp2str
from ucollections import namedtuple
@ -17,9 +13,6 @@ from ucollections import namedtuple
from font_iosevka import CELL_W, CELL_H, TEXT_PALETTES, COL_TEXT
from font_iosevka import FontIosevka
# free unused screen buffers, we don't work that way
del sram2.display_buf
del sram2.display2_buf
#WIDTH = const(320)
#HEIGHT = const(240)

View File

@ -33,11 +33,10 @@ datestamp,vers,_ = version.get_mpy_version()
print("Version: %s / %s\n" % (vers, datestamp))
# Setup OLED and get something onto it.
try:
from display import Display
except ImportError:
# for Q1
if version.has_qwerty:
from lcd_display import Display
else:
from display import Display
dis = Display()
dis.splash()

View File

@ -449,11 +449,12 @@ class PinAttempt:
if raw_secret is None:
# restore to main wallet's settings
settings.return_to_master_seed()
xfp = 0 # TODO need secret xfp to provide to the draw_status
xfp = settings.get("xfp", 0)
dis.draw_status(xfp=xfp, tmp=0, bip39=0)
else:
xfp = sv.capture_xpub()
dis.draw_status(xfp=xfp)
xfp = sv.capture_xpub()
dis.draw_status(xfp=xfp)
settings.merge_previous_active(old_values)
@ -488,7 +489,7 @@ class PinAttempt:
# On Q1, update status icons
from glob import dis
is_pass, is_tmp = (1,0) if bip39pw else (0,1)
is_pass, is_tmp = (1, 1) if bip39pw else (0, 1)
dis.draw_status(bip39=is_pass, tmp=is_tmp)
return True

View File

@ -10,7 +10,7 @@
# - 'abandon' * 17 + 'agent'
# - 'abandon' * 11 + 'about'
#
import ngu, uctypes, bip39, random, stash, pyb
import ngu, uctypes, bip39, random, stash, pyb, version
from menu import MenuItem, MenuSystem
from utils import xfp2str, parse_extended_key, swab32, pad_raw_secret, problem_file_line
from uhashlib import sha256
@ -677,7 +677,7 @@ async def set_bip39_passphrase(pw, bypass_tmp=False, summarize_ux=True):
nv, xfp, parent_xfp = await calc_bip39_passphrase(pw, bypass_tmp=bypass_tmp)
ret = await set_ephemeral_seed(nv, summarize_ux=summarize_ux, bip39pw=pw,
meta="BIP-39 Passphrase on [%s]" % xfp2str(parent_xfp))
dis.draw_status(bip39=int(bool(pw)), xfp=xfp)
dis.draw_status(bip39=int(bool(pw)), xfp=xfp, tmp=1)
return ret
# Might need to bounce the USB connection, because our pubkey has changed,

View File

@ -4,6 +4,7 @@
#
# Copied from ../external/micropython/drivers/display/ssd1306.py
#
import time
from micropython import const
import framebuf
@ -109,7 +110,6 @@ class SSD1306_SPI(SSD1306):
self.dc = dc
self.res = res
self.cs = cs
import time
self.res(1)
time.sleep_ms(1)
self.res(0)

View File

@ -2,13 +2,8 @@
#
# st7788.py - LCD communications for Q1's 320x240 pixel *colour* display!
#
import machine, uzlib, ckcc, utime, struct, array, sys
from version import is_devmode
import framebuf
import uasyncio
from uasyncio import sleep_ms
from graphics import Graphics
import sram2
import machine, uzlib, utime, struct, sys
# few key commands for this display
CASET = const(0x2a)
@ -92,6 +87,7 @@ class ST7788():
def show_pal_pixels(self, x, y, w, h, palette, pixels):
# show 4-bit packed paletted lookup pixels; used for fonts
assert len(palette) == 2 * 16
# TODO clean up
if 0:
buf = bytearray()
for here in pixels:
@ -116,6 +112,7 @@ class ST7788():
def fill_rect(self, x,y, w,h, pixel=0x0000):
# set a rectangle to a single colour
if not w or not h: return
# TODO clean up
if 0:
assert h >= 1 and w >= 1
pixel = struct.pack('>H', pixel)