Improve TypeError error message wording from config_set() #173
Replies: 3 comments 2 replies
-
Hi @fronders, This is expected behaviour for In this case the issue can be simply resolved by supplying the value as bytes, i.e.: import pyubx2
command = pyubx2.UBXMessage.config_set(
layers=pyubx2.SET_LAYER_FLASH,
transaction=pyubx2.TXN_NONE,
cfgData=[(0x20920006, b"\x00")],
)
print(command)
As to why some config database values are defined as |
Beta Was this translation helpful? Give feedback.
-
OK, fair enough, I see many |
Beta Was this translation helpful? Give feedback.
-
The 'little-endian' nature of UBX payload bytes is documented in the u-blox Interface Specifications. What you need to pass to cfgData depends on the attribute type. The type associated with each individual configuration database key is documented in the relevant Interface Specification and can be referenced via ubxtypes_configdb.py.
The
The |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
UBXMessage.config_set() tries to lookup attribute types and fails because of
val2bytes()
function foratt
tovalb
conversionIssue is caused by code on line 281:
pyubx2/src/pyubx2/ubxhelpers.py
Lines 265 to 297 in 1227e03
which returns integer instead of bytes in case of bitmask attribute.
Adding
to_bytes()
conversion fixes the issue.This is especially critical for
X8
type, where little-endian conversion is a must.I don't see why
X1/2/4/8
attributes need to be treated differently fromU1/2/4/8
onesInfo
To Reproduce
Steps to reproduce the behaviour:
Desktop:
GNSS/GPS Device:
Beta Was this translation helpful? Give feedback.
All reactions