From 67206904529f1a2596318956e164c5fed9267008 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 31 Jul 2019 11:42:56 +0200 Subject: [PATCH] legacy: don't add more pixels than needed in oledSCA --- legacy/firmware/layout2.c | 4 +++- legacy/firmware/pinmatrix.c | 4 ++-- legacy/gen/bitmaps.c | 2 +- legacy/gen/bitmaps/digit5.png | Bin 128 -> 882 bytes legacy/oled.c | 13 +++++++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/legacy/firmware/layout2.c b/legacy/firmware/layout2.c index 904d50c192..07bc3f6f29 100644 --- a/legacy/firmware/layout2.c +++ b/legacy/firmware/layout2.c @@ -546,7 +546,9 @@ void layoutResetWord(const char *word, int pass, int word_pos, bool last) { FONT_STANDARD); oledDrawStringCenter(OLED_WIDTH / 2, 4 * 9 - 3, word, FONT_FIXED | FONT_DOUBLE); - oledSCA(4 * 9 - 3 - 2, 4 * 9 - 3 + 15 + 2, OLED_WIDTH / 2); + // 30 is the maximum pixels used for a pixel row in the BIP39 word "abstract" + oledSCA(4 * 9 - 3 - 2, 4 * 9 - 3 + 15 + 2, 30); + oledInvert(0, 4 * 9 - 3 - 2, OLED_WIDTH - 1, 4 * 9 - 3 + 15 + 2); layoutButtonYes(btnYes); oledRefresh(); } diff --git a/legacy/firmware/pinmatrix.c b/legacy/firmware/pinmatrix.c index 6ef2400980..1d863c3edb 100644 --- a/legacy/firmware/pinmatrix.c +++ b/legacy/firmware/pinmatrix.c @@ -46,8 +46,8 @@ void pinmatrix_draw(const char *text) { } } for (int i = 0; i < 3; i++) { - oledSCA(12 + i * (h + pad), 12 + i * (h + pad) + h - 1, OLED_WIDTH / 2); - oledInvert(0, 12 + i * (h + pad), OLED_WIDTH - 1, 12 + i * (h + pad) + h - 1); + // 36 is the maximum pixels used for a pin matrix pixel row + oledSCA(12 + i * (h + pad), 12 + i * (h + pad) + h - 1, 36); } oledRefresh(); } diff --git a/legacy/gen/bitmaps.c b/legacy/gen/bitmaps.c index c47c1a0bdd..7b40e628fc 100644 --- a/legacy/gen/bitmaps.c +++ b/legacy/gen/bitmaps.c @@ -6,7 +6,7 @@ const uint8_t bmp_digit1_data[] = { 0xff, 0xff, 0xfc, 0x3f, 0xf8, 0x3f, 0xf0, 0x const uint8_t bmp_digit2_data[] = { 0xff, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xf8, 0x0f, 0xf0, 0x1f, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xe0, 0x07, 0xe0, 0x07, 0xff, 0xff, }; const uint8_t bmp_digit3_data[] = { 0xff, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xf8, 0x0f, 0xf8, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0xff, }; const uint8_t bmp_digit4_data[] = { 0xff, 0xff, 0xff, 0x0f, 0xfe, 0x0f, 0xfc, 0x0f, 0xf8, 0x0f, 0xf1, 0x0f, 0xe3, 0x0f, 0xc7, 0x0f, 0xcf, 0x0f, 0xc0, 0x0f, 0xc0, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0xff, }; -const uint8_t bmp_digit5_data[] = { 0xff, 0xff, 0xe0, 0x1f, 0xe0, 0x1f, 0xe7, 0xff, 0xe7, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0xff, }; +const uint8_t bmp_digit5_data[] = { 0xff, 0xff, 0xe0, 0x0f, 0xe0, 0x0f, 0xe1, 0xff, 0xe1, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xff, 0x87, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0xff, }; const uint8_t bmp_digit6_data[] = { 0xff, 0xff, 0xf8, 0x1f, 0xf0, 0x1f, 0xe1, 0xff, 0xe1, 0xff, 0xe0, 0x1f, 0xe0, 0x0f, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xf0, 0x0f, 0xf8, 0x1f, 0xff, 0xff, }; const uint8_t bmp_digit7_data[] = { 0xff, 0xff, 0xe0, 0x07, 0xe0, 0x07, 0xff, 0x87, 0xff, 0x87, 0xff, 0x0f, 0xfe, 0x1f, 0xfc, 0x1f, 0xfc, 0x3f, 0xf8, 0x7f, 0xf8, 0x7f, 0xf8, 0x7f, 0xf8, 0x7f, 0xf8, 0x7f, 0xf8, 0x7f, 0xff, 0xff, }; const uint8_t bmp_digit8_data[] = { 0xff, 0xff, 0xf8, 0x1f, 0xf0, 0x0f, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xf0, 0x0f, 0xf0, 0x0f, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xe1, 0x87, 0xf0, 0x0f, 0xf8, 0x1f, 0xff, 0xff, }; diff --git a/legacy/gen/bitmaps/digit5.png b/legacy/gen/bitmaps/digit5.png index aafcd3c54549d02e8494ca4bdd4e80fcc25404cb..59b77867394308b8f52d022066f5c0cb6f4961ff 100644 GIT binary patch delta 860 zcmV-i1Ec(a0rCcrBYy(wdQ@0+Qek%>aB^>EX>4U6ba`-PAZ2)IW&i+q+O?KzlH(u@ zg#UAjJpz&tg5zKwReOUy{x-Ig%+6#d4|_~vxiA)OeGQ50e|``53kM};7t~VBF?t*! zhs*^R$={B?$E}ZiSkIS(_A|M=HyBY6W$U!C-<7@pGCp1-5`W#fLHg+dxlY3$C$_Tp zv*&*l<#wIp_B#7_jF!ge+uM~8QHHp^)Ha2?q`|-iRg(3wh-UaIu5E1@E&1Xr1>b!2 z3tFX2OyUOxYK{sG>eLV`RcH*{*$|m4%i5R3ICB**Bw;ohY?7r(5|+wcM1m8(YN2)B zyv|oCVdh2{%727pgh#$@?$Ll}+8EWNMnrgf+G_<}%##DnGRiz-7=X~&x#?QqOS>NK z16Tn;UCW&Cg2gXeibd(>Em;j97^jGvzsTC8#;Z#L=2nOy0RkUMlp=X!HliS$0H{DY zOW*|rNR=BzauA7Nli(xFjc1J3v8=rHW2u0TN)!W|EPn;CLQwd}LV|~iiUw7UYML}_ zaZzH38e_CL*IY5NU~19Kl4UDNQb?L&vXoLzC36-mNzE}^PC4gNFlPy_Xu;D3BT89# zktHm;#Ko4h(MLy`$p^{I4$CpV~&=|CMuRED!(VKKfFufqx_!d(L0ghH#W4Pe23!002Wt zL{&jlD9>a3|NlP&DS!peVq|2*r3l$jCI%7#3qd2%0F`V&_79qEgl#|z3`RW8#cB`9 mei#lKXpolB!kv-Sa3|NlP&DS!peVq|2*sshbKCI%7#3x4x30mU|8 z`h;XZpc%o4$I-}2;mSz%!*I|*I4z+?1z{V|!kv-SVU!k0000 pix) { + pix = width - pix; + for (int x = 0; x < pix / 2; x++) { + oledDrawPixel(x, y); + } + for (int x = OLED_WIDTH - ((pix + 1) / 2); x < OLED_WIDTH; x++) { + oledDrawPixel(x, y); + } } } }