Skip to content

Commit

Permalink
Fix #271 #272 from sca075/refactoring_camera
Browse files Browse the repository at this point in the history
Fix #271
  • Loading branch information
sca075 authored Nov 17, 2024
2 parents c2cd257 + 8deccc3 commit 0855a5d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/mqtt_vacuum_camera/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/sca075/mqtt_vacuum_camera/issues",
"requirements": ["pillow>=10.3.0,<=11.0.0", "numpy"],
"version": "2024.11.0"
"version": "2024.11.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Hypfer Image Handler Class.
It returns the PIL PNG image frame relative to the Map Data extrapolated from the vacuum json.
It also returns calibration, rooms data to the card and other images information to the camera.
Version: 2024.10.0
Version: 2024.11.1
"""

from __future__ import annotations
Expand Down Expand Up @@ -241,7 +241,7 @@ async def async_get_image_from_json(
x=robot_position[0],
y=robot_position[1],
angle=robot_position_angle,
fill=colors["robot"]
fill=colors["robot"],
)
# Resize the image
img_np_array = await self.ac.async_auto_trim_and_zoom_image(
Expand Down Expand Up @@ -298,7 +298,7 @@ async def async_get_image_from_json(
else:
_LOGGER.debug(f"{self.file_name}: Frame Completed.")
return pil_img
except RuntimeError or RuntimeWarning as e:
except (RuntimeError, RuntimeWarning) as e:
_LOGGER.warning(
f"{self.file_name}: Error {e} during image creation.",
exc_info=True,
Expand Down Expand Up @@ -375,8 +375,13 @@ async def async_map_coordinates_offset(
:param hsf: Height scale factor.
:param width: Width of the image.
:param height: Height of the image.
:return: A tuple containing the adjusted (width, height) values
:raises ValueError: If any input parameters are negative
"""

if any(x < 0 for x in (wsf, hsf, width, height)):
raise ValueError("All parameters must be positive integers")

if wsf == 1 and hsf == 1:
self.imu.set_image_offset_ratio_1_1(width, height)
elif wsf == 2 and hsf == 1:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Image Draw Class for Valetudo Rand256 Image Handling.
This class is used to simplify the ImageHandler class.
Version: 2024.10.0
Version: 2024.11.1
"""

from __future__ import annotations
Expand Down Expand Up @@ -366,6 +366,5 @@ async def async_draw_robot_on_map(
robot_pos[1],
robot_angle,
color_robot,
self.img_h.file_name,
)
return np_array

0 comments on commit 0855a5d

Please sign in to comment.