-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix switch of operation modes values (closes #48) The Operation mode registry (0x22) contains 0 when the jumper sets the device as a Tag and contains 1 when the jumper sets the device as an anchor. Therefore, the constants are switched in the library to match the behavior of the device. * Hotfix/filter data (#60) * Fix data storing FilterData always returns 0 when reading data from reg due to improper self.data initialization. * Fix improper method name in call * Fix bit operation priority The + operator is called prior to the shift operator wich produce invalid result * Added full discovery as tool, version bump, structured tools a bit
- Loading branch information
Showing
8 changed files
with
58 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ | |
""" | ||
|
||
__version__ = '1.2.5' | ||
__version__ = '1.2.6' | ||
|
||
VERSION = __version__ | ||
version = __version__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from pypozyx import PozyxConstants, UWBSettings, SingleRegister, DeviceList | ||
|
||
|
||
def all_discovery_uwb_settings(): | ||
for channel in PozyxConstants.ALL_UWB_CHANNELS: | ||
for bitrate in PozyxConstants.ALL_UWB_BITRATES: | ||
for prf in PozyxConstants.ALL_UWB_PRFS: | ||
for plen in PozyxConstants.ALL_UWB_PLENS: | ||
yield UWBSettings(channel, bitrate, prf, plen, 33) | ||
|
||
|
||
def get_device_list(pozyx): | ||
"""""" | ||
device_list_size = SingleRegister() | ||
pozyx.getDeviceListSize(device_list_size) | ||
device_list = DeviceList(list_size=device_list_size[0]) | ||
pozyx.getDeviceIds(device_list) | ||
return device_list | ||
|
||
|
||
def discover_all_devices(pozyx): | ||
original_uwb_settings = UWBSettings() | ||
pozyx.getUWBSettings(original_uwb_settings) | ||
|
||
for uwb_settings in all_discovery_uwb_settings(): | ||
pozyx.setUWBSettings(uwb_settings) | ||
|
||
pozyx.clearDevices() | ||
pozyx.doDiscoveryAll(slots=3, slot_duration=0.1) | ||
|
||
device_list = get_device_list(pozyx) | ||
if device_list: | ||
print("Found on {}".format(uwb_settings)) | ||
for device_id in device_list: | ||
print("\t- {}".format(device_id)) | ||
|
||
pozyx.setUWBSettings(original_uwb_settings) | ||
|
||
|
||
if __name__ == '__main__': | ||
from pypozyx import PozyxSerial, get_first_pozyx_serial_port | ||
pozyx = PozyxSerial(get_first_pozyx_serial_port()) | ||
|
||
discover_all_devices(pozyx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
import json | ||
import pypozyx | ||
import warnings | ||
import time | ||
|
||
|
||
class Version(object): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters