more improvements with locate maybe

This commit is contained in:
Laura Klünder 2024-12-29 02:16:45 +01:00
parent 0b88260c7c
commit 7f60e65277

View file

@ -257,7 +257,7 @@ class Locator:
already_got.add(key) already_got.add(key)
deduplicized_scan_data_in_the_same_room.append((peer_id, value)) deduplicized_scan_data_in_the_same_room.append((peer_id, value))
the_sum = sum((value.rssi + 90) for peer_id, value in deduplicized_scan_data_in_the_same_room[:3]) the_sum = sum((value.rssi + 100) for peer_id, value in deduplicized_scan_data_in_the_same_room[:3])
level = router.levels[space.level_id] level = router.levels[space.level_id]
if level.on_top_of_id: if level.on_top_of_id:
@ -274,9 +274,10 @@ class Locator:
else: else:
x = 0 x = 0
y = 0 y = 0
# sure this can be better probably
for peer_id, value in deduplicized_scan_data_in_the_same_room[:3]: for peer_id, value in deduplicized_scan_data_in_the_same_room[:3]:
x += float(self.peers[peer_id].xyz[0]) * (value.rssi+90) / the_sum x += float(self.peers[peer_id].xyz[0]) * (value.rssi+100) / the_sum
y += float(self.peers[peer_id].xyz[1]) * (value.rssi+90) / the_sum y += float(self.peers[peer_id].xyz[1]) * (value.rssi+100) / the_sum
return CustomLocation( return CustomLocation(
level=level, level=level,
x=x/100, x=x/100,