Skip to content

Commit 2bd2a7b

Browse files
committed
pylint
1 parent 456ab88 commit 2bd2a7b

File tree

4 files changed

+31
-39
lines changed
  • circuitpython-esp32-camera

4 files changed

+31
-39
lines changed

circuitpython-esp32-camera/esp32-kaluga-onionskin-gif/code.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
2525
Set up the first frame using the viewfinder. Click the REC button to take a frame.
2626
27-
Set up the next frame using the viewfinder. The previous and current frames are blended together on the display, which is called an "onionskin". Click the REC button to take the next frame.
27+
Set up the next frame using the viewfinder. The previous and current frames are
28+
blended together on the display, which is called an "onionskin". Click the REC
29+
button to take the next frame.
2830
2931
After 10 frames are recorded, the GIF is complete and you can begin recording another.
3032
@@ -45,14 +47,12 @@
4547

4648
import os
4749
import struct
48-
import time
4950

5051
import esp32_camera
5152
import analogio
5253
import board
5354
import busio
5455
import bitmaptools
55-
import digitalio
5656
import displayio
5757
import sdcardio
5858
import storage
@@ -145,7 +145,7 @@ def next_filename(extension="jpg"):
145145

146146
# Pre-cache the next image number
147147
next_filename("gif")
148-
148+
149149
# Blank the whole display
150150
g = displayio.Group()
151151
display.show(g)
@@ -170,33 +170,34 @@ def open_next_image(extension="jpg"):
170170
display_bus.send(42, struct.pack(">hh", ow, onionskin.width + ow - 1))
171171
display_bus.send(43, struct.pack(">hh", oh, onionskin.height + ow - 1))
172172

173-
def wait_record_pressed_update_display(first_frame, cam):
173+
def wait_record_pressed_update_display(first_frame, camera):
174174
while record_pressed():
175175
pass
176176
while True:
177-
frame = cam.take(1)
177+
frame = camera.take(1)
178178
print(type(frame))
179179
if record_pressed():
180180
return frame
181-
181+
182182
if first_frame:
183183
# First frame -- display as-is
184184
display_bus.send(44, frame)
185185
else:
186186
bitmaptools.alphablend(onionskin, old_frame, frame, displayio.Colorspace.RGB565_SWAPPED)
187187
display_bus.send(44, onionskin)
188-
188+
189189
def take_stop_motion_gif(n_frames=10, replay_frame_time=.3):
190190
print(f"0/{n_frames}")
191191
frame = wait_record_pressed_update_display(True, cam)
192-
with open_next_image("gif") as f, gifio.GifWriter(f, cam.width, cam.height, displayio.Colorspace.RGB565_SWAPPED, dither=True) as g:
193-
g.add_frame(frame, replay_frame_time)
192+
with open_next_image("gif") as f, gifio.GifWriter(f, cam.width, cam.height,
193+
displayio.Colorspace.RGB565_SWAPPED, dither=True) as writer:
194+
writer.add_frame(frame, replay_frame_time)
194195
for i in range(1, n_frames):
195196
print(f"{i}/{n_frames}")
196197
old_frame.blit(0, 0, frame, x1=0, y1=0, x2=cam.width, y2=cam.height)
197198
frame = wait_record_pressed_update_display(False, cam)
198-
g.add_frame(frame, replay_frame_time)
199-
print(f"done")
199+
writer.add_frame(frame, replay_frame_time)
200+
print("done")
200201

201202
while True:
202203
take_stop_motion_gif()

circuitpython-esp32-camera/esp32-s3-eye-adafruitio/code.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,23 @@
1111
1212
To use:
1313
* On io.adafruit.com, create a feed named "image" and turn OFF history
14-
* On io.adafruit.com, create a dashboard and add an "image" block using the feed "image" as its data
14+
* On io.adafruit.com, create a dashboard and add an "image" block
15+
using the feed "image" as its data
1516
* Set up CIRCUITPY/.env with WiFI and Adafruit IO credentials
1617
* Copy the project bundle to CIRCUITPY
1718
"""
1819

19-
import os
20+
import binascii
21+
import io
22+
import ssl
2023
import time
21-
24+
import adafruit_minimqtt.adafruit_minimqtt as MQTT
25+
from adafruit_io.adafruit_io import IO_MQTT
26+
import board
2227
import dotenv
23-
import io
24-
import sys
25-
import binascii
2628
import esp32_camera
27-
import board
2829
import socketpool
2930
import wifi
30-
import ssl
31-
32-
import adafruit_minimqtt.adafruit_minimqtt as MQTT
33-
from adafruit_io.adafruit_io import IO_MQTT
3431

3532
aio_username = dotenv.get_key('/.env', 'AIO_USERNAME')
3633
aio_key = dotenv.get_key('/.env', 'AIO_KEY')
@@ -53,15 +50,15 @@
5350

5451
pool = socketpool.SocketPool(wifi.radio)
5552

56-
print("Connecting to Adafruit IO")
57-
mqtt_client = MQTT.MQTT(
58-
broker="io.adafruit.com",
53+
print("Connecting to Adafruit IO")
54+
mqtt_client = MQTT.MQTT(
55+
broker="io.adafruit.com",
5956
username=aio_username,
6057
password=aio_key,
61-
socket_pool=pool,
62-
ssl_context=ssl.create_default_context(),
63-
)
64-
mqtt_client.connect()
58+
socket_pool=pool,
59+
ssl_context=ssl.create_default_context(),
60+
)
61+
mqtt_client.connect()
6562
io = IO_MQTT(mqtt_client)
6663

6764
while True:

circuitpython-esp32-camera/esp32-s3-eye-lcdview/code.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
Copy the project bundle to CIRCUITPY.
1515
"""
1616

17-
import os
1817
import struct
19-
import time
2018

2119
import adafruit_ticks
22-
import esp32_camera
2320
import board
2421
import displayio
25-
from adafruit_st7789 import ST7789
22+
import esp32_camera
2623

2724
cam = esp32_camera.Camera(
2825
data_pins=board.CAMERA_DATA,

circuitpython-esp32-camera/esp32-s3eye-qrio-repl/code.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
ILI9341 display.
88
"""
99

10-
import esp32_camera
11-
from terminalio import FONT
10+
import struct
1211
import board
12+
import esp32_camera
1313
import qrio
14-
import displayio
15-
import busio
16-
import struct
1714

1815
print("Initializing camera")
1916
cam = esp32_camera.Camera(

0 commit comments

Comments
 (0)