Skip to content

Commit 75e0b45

Browse files
committed
samples: fix an issue when using odd-length strings in the agriculture demo
Signed-off-by: Ruben Moral <ruben.moral@digi.com>
1 parent c7d7d49 commit 75e0b45

File tree

1 file changed

+4
-2
lines changed
  • samples/demos/end_to_end_agriculture

1 file changed

+4
-2
lines changed

samples/demos/end_to_end_agriculture/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@ def save_properties(properties):
199199
if prop in text_properties:
200200
xbee.atcmd(xbee_properties[prop], properties[prop])
201201
else:
202-
xbee.atcmd(xbee_properties[prop],
203-
binascii.unhexlify(properties[prop]))
202+
value = properties[prop]
203+
if len(value) % 2 != 0:
204+
value = "0" + value
205+
xbee.atcmd(xbee_properties[prop], binascii.unhexlify(value))
204206

205207
# Configure the network encryption based on the given password.
206208
if properties.get(PROP_PASS) is None:

0 commit comments

Comments
 (0)