diff --git a/canopen_monitor/parse/eds.py b/canopen_monitor/parse/eds.py index 2a25858..bbdaf30 100644 --- a/canopen_monitor/parse/eds.py +++ b/canopen_monitor/parse/eds.py @@ -124,10 +124,10 @@ def __len__(self) -> int: def convert_value(value: str) -> Union[int, str]: # Turn number-like objects into numbers if (value != ''): - if (all(c in string.digits for c in value)): - return int(value, 10) - elif (all(c in string.hexdigits for c in value)): + if (all(c in string.hexdigits for c in value)): return int(value, 16) + elif (all(c in string.digits for c in value)): + return int(value, 10) else: return value diff --git a/tests/__init__.py b/tests/__init__.py index fc5c6ea..b93980e 100755 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -7750,4 +7750,4 @@ ParameterValue= PDOMapping=0 -""" \ No newline at end of file +""" diff --git a/tests/spec_eds_parser.py b/tests/spec_eds_parser.py index 19b155a..39da3fc 100644 --- a/tests/spec_eds_parser.py +++ b/tests/spec_eds_parser.py @@ -102,7 +102,7 @@ def test_get_node_id(self): """ DCF Parsing set node id attribute """ - self.assertEqual(10, + self.assertEqual(0x10, self.eds.node_id, "Error parsing node id")