Skip to content

Commit 762accf

Browse files
committed
generic find_and_init doesn't need to pass scale
1 parent bd42fcc commit 762accf

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

adafruit_usb_host_mouse/__init__.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
SUBCLASS_RESERVED = 0x00
4848

4949

50-
def find_and_init_mouse(cursor_image=DEFAULT_CURSOR, scale=1, subclass=SUBCLASS_BOOT): # noqa: PLR0912
50+
def find_and_init_mouse(cursor_image=DEFAULT_CURSOR, subclass=SUBCLASS_BOOT): # noqa: PLR0912
5151
"""
5252
Scan for an attached mouse connected via USB host.
5353
If one is found return a tuple containing the parameters needed to initalize an
@@ -57,8 +57,6 @@ def find_and_init_mouse(cursor_image=DEFAULT_CURSOR, scale=1, subclass=SUBCLASS_
5757
:param cursor_image: Provide the absolute path to the desired cursor bitmap image. If set as
5858
`None`, the object instance created using the returned tuple will not control
5959
a :class:`displayio.TileGrid` object.
60-
:param scale: The scale of the group that the Mouse TileGrid will be put into
61-
Needed in order to properly clamp the mouse to the display bounds
6260
:param subclass: Defines whether to search for boot or non-boot mice.
6361
`0x01`, a boot mouse will be searched for
6462
`0x02`, a non-boot (report) mouse will be searched for
@@ -140,7 +138,6 @@ def find_and_init_mouse(cursor_image=DEFAULT_CURSOR, scale=1, subclass=SUBCLASS_
140138
return (
141139
(mouse_device, mouse_interface_index, mouse_endpoint_address, mouse_was_attached),
142140
mouse_tg,
143-
scale,
144141
)
145142

146143
# if no mouse found
@@ -159,9 +156,9 @@ def find_and_init_boot_mouse(cursor_image=DEFAULT_CURSOR, scale=1): # noqa: PLR
159156
Needed in order to properly clamp the mouse to the display bounds
160157
:return: The :class:`BootMouse` instance or None if no mouse was found.
161158
"""
162-
found_mouse = find_and_init_mouse(cursor_image, scale, SUBCLASS_BOOT)
159+
found_mouse = find_and_init_mouse(cursor_image, SUBCLASS_BOOT)
163160
if found_mouse is not None:
164-
return BootMouse(*found_mouse[0], tilegrid=found_mouse[1], scale=found_mouse[2])
161+
return BootMouse(*found_mouse[0], tilegrid=found_mouse[1], scale=scale)
165162
else:
166163
return None
167164

@@ -178,9 +175,9 @@ def find_and_init_report_mouse(cursor_image=DEFAULT_CURSOR, scale=1): # noqa: P
178175
Needed in order to properly clamp the mouse to the display bounds
179176
:return: The :class:`ReportMouse` instance or None if no mouse was found.
180177
"""
181-
found_mouse = find_and_init_mouse(cursor_image, scale, SUBCLASS_RESERVED)
178+
found_mouse = find_and_init_mouse(cursor_image, SUBCLASS_RESERVED)
182179
if found_mouse is not None:
183-
return ReportMouse(*found_mouse[0], tilegrid=found_mouse[1], scale=found_mouse[2])
180+
return ReportMouse(*found_mouse[0], tilegrid=found_mouse[1], scale=scale)
184181
else:
185182
return None
186183

0 commit comments

Comments
 (0)