Skip to content

Commit 3615b7d

Browse files
authored
pylint fixes
1 parent 9154946 commit 3615b7d

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

EInk_Autostereograms/code.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@
3131

3232
# read buttons from ePaper shield
3333
def read_buttons():
34+
button = 1
3435
with AnalogIn(board.A3) as ain:
3536
reading = ain.value / 65535
3637
if reading > 0.75:
37-
return None
38+
button = None
3839
if reading > 0.4:
39-
return 4
40+
button = 4
4041
if reading > 0.25:
41-
return 3
42+
button = 3
4243
if reading > 0.13:
43-
return 2
44-
return 1
45-
return None
44+
button = 2
45+
button = 1
46+
return button
4647

4748
# display bitmap file
4849
def display_bitmap(epd, filename):
@@ -101,15 +102,15 @@ def display_bitmap(epd, filename):
101102
else:
102103
led.value = True
103104
if flip: # Bitmap is stored bottom-to-top order (normal BMP)
104-
pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize
105+
f.seek(bmpImageoffset + (bmpHeight - 1 - row) * rowSize)
105106
else: # Bitmap is stored top-to-bottom
106-
pos = bmpImageoffset + row * rowSize
107-
f.seek(pos)
107+
f.seek(bmpImageoffset + row * rowSize)
108+
108109
rowdata = f.read(bmpWidth)
109110
for col in range(bmpWidth):
110111
for b in range(8):
111112
if (rowdata[col] & (0x80 >> b) != 0 and blkpixel == 0) or (
112-
rowdata[col] & (0x80 >> b) == 0 and blkpixel == 1):
113+
rowdata[col] & (0x80 >> b) == 0 and blkpixel == 1):
113114
epd.pixel(col * 8 + b, row, Adafruit_EPD.BLACK)
114115
except (ValueError) as e:
115116
display_message("Error: " + e.args[0])
@@ -278,13 +279,13 @@ def run_job(jobfile):
278279
for x2 in range(panelwidth):
279280
tpanel[x2] = tcanvas[x + x2 - panelwidth]
280281
offset = 0
281-
if (x >= 22 and
282+
if (x >= 22 and
282283
x < (image.width + panelwidth // 2)
283284
and y < image.height):
284285
if (
285-
(image[x - panelwidth // 2, y] != 0 and not inv
286+
(image[x - panelwidth // 2, y] != 0 and not inv
286287
) or (
287-
image[x - panelwidth // 2, y] == 0 and inv)
288+
image[x - panelwidth // 2, y] == 0 and inv)
288289
):
289290
# offset = 4
290291
if job["imagegrayscale"] == 0:

0 commit comments

Comments
 (0)