Skip to content

Commit

Permalink
release 0.0.44
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey0000 committed Aug 8, 2024
1 parent 6c41570 commit 5d9999b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions pymammotion/data/model/hash_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ class HashList:
def update(self, hash_data: NavGetCommDataAck):
"""Update the map data."""
if hash_data.type == 0:
if self.area.get(hash_data.hash) is None:
self.area[hash_data.hash] = FrameList(total_frame=hash_data.total_frame, data=[hash_data])
self.area[hash_data.hash].data.append(hash_data)
self._add_hash_data(self.area, hash_data)

if hash_data.type == 1:
if self.obstacle.get(hash_data.hash) is None:
self.obstacle[hash_data.hash] = FrameList(total_frame=hash_data.total_frame, data=[hash_data])
self.obstacle[hash_data.hash].data.append(hash_data)
self._add_hash_data(self.obstacle, hash_data)

if hash_data.type == 2:
if self.path.get(hash_data.hash) is None:
self.path[hash_data.hash] = FrameList(total_frame=hash_data.total_frame, data=[hash_data])
self.path[hash_data.hash].data.append(hash_data)
self._add_hash_data(self.path, hash_data)

@staticmethod
def _add_hash_data(hash_dict: dict, hash_data: NavGetCommDataAck) -> None:
if hash_dict.get(hash_data.hash) is None:
hash_dict[hash_data.hash] = FrameList(total_frame=hash_data.total_frame, data=[hash_data])

hash_values = [item.hash for item in hash_dict[hash_data.hash].data]
if hash_data not in hash_values:
hash_dict[hash_data.hash].data.append(hash_data)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pymammotion"
version = "0.0.42"
version = "0.0.44"
license = "GNU-3.0"
description = ""
readme = "README.md"
Expand Down

0 comments on commit 5d9999b

Please sign in to comment.