pre-commit

This commit is contained in:
Liz 2025-08-15 12:58:13 -04:00
parent 0be196a266
commit 7c669c774b

View file

@ -123,21 +123,24 @@ class Adafruit_SSD1683(Adafruit_EPD):
self._display_update_val = 0xF7
# Default initialization sequence (tri-color mode)
self._default_init_code = bytes([
_SSD1683_SW_RESET, 0, # Software reset
0xFF, 50, # Wait for busy (50ms delay)
_SSD1683_WRITE_BORDER, 1, # Border waveform control
self._default_init_code = bytes(
[
_SSD1683_SW_RESET,
0, # Software reset
0xFF,
50, # Wait for busy (50ms delay)
_SSD1683_WRITE_BORDER,
1, # Border waveform control
0x05, # Border color/waveform
_SSD1683_TEMP_CONTROL, 1, # Temperature control
_SSD1683_TEMP_CONTROL,
1, # Temperature control
0x80, # Read temp
_SSD1683_DATA_MODE, 1, # Data entry mode
_SSD1683_DATA_MODE,
1, # Data entry mode
0x03, # Y decrement, X increment
0xFE # End of initialization
])
0xFE, # End of initialization
]
)
def begin(self, reset: bool = True) -> None:
"""Begin communication with the display and set basic settings"""
@ -162,7 +165,7 @@ class Adafruit_SSD1683(Adafruit_EPD):
# Use custom init code if provided, otherwise use default
init_code = self._default_init_code
if hasattr(self, '_epd_init_code') and self._epd_init_code is not None:
if hasattr(self, "_epd_init_code") and self._epd_init_code is not None:
init_code = self._epd_init_code
# Send initialization sequence
@ -175,7 +178,7 @@ class Adafruit_SSD1683(Adafruit_EPD):
self.set_ram_address(0, 0)
# Set LUT if we have one
if hasattr(self, '_epd_lut_code') and self._epd_lut_code:
if hasattr(self, "_epd_lut_code") and self._epd_lut_code:
self._send_command_list(self._epd_lut_code)
# Set display size and driver output control
@ -229,10 +232,10 @@ class Adafruit_SSD1683(Adafruit_EPD):
self.command(_SSD1683_SET_RAMXPOS, bytearray([x1 & 0xFF, x2 & 0xFF]))
# Set ram Y start/end position
self.command(_SSD1683_SET_RAMYPOS, bytearray([
y1 & 0xFF, (y1 >> 8) & 0xFF,
y2 & 0xFF, (y2 >> 8) & 0xFF
]))
self.command(
_SSD1683_SET_RAMYPOS,
bytearray([y1 & 0xFF, (y1 >> 8) & 0xFF, y2 & 0xFF, (y2 >> 8) & 0xFF]),
)
def _send_command_list(self, init_sequence: bytes) -> None:
"""Send a sequence of commands from an initialization list"""
@ -248,13 +251,11 @@ class Adafruit_SSD1683(Adafruit_EPD):
delay_ms = init_sequence[i]
i += 1
time.sleep(delay_ms / 1000.0)
else:
# Regular command
if i < len(init_sequence):
elif i < len(init_sequence):
num_args = init_sequence[i]
i += 1
if num_args > 0 and (i + num_args) <= len(init_sequence):
args = init_sequence[i:i + num_args]
args = init_sequence[i : i + num_args]
self.command(cmd, bytearray(args))
i += num_args
else: