Skip to content

Commit 404e3ed

Browse files
committed
profile: retry profile settings application also for at command error status
This commit also retries the application of at setting values if the command returns an error. Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
1 parent 7d863e0 commit 404e3ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

digi/xbee/profile.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
from digi.xbee import firmware
2424
from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice
25-
from digi.xbee.exception import XBeeException, TimeoutException, FirmwareUpdateException
25+
from digi.xbee.exception import XBeeException, TimeoutException, FirmwareUpdateException, ATCommandException
2626
from digi.xbee.filesystem import LocalXBeeFileSystemManager, FileSystemException, FileSystemNotSupportedException
2727
from digi.xbee.models.atcomm import ATStringCommand
2828
from digi.xbee.models.hw import HardwareVersion
@@ -1060,16 +1060,18 @@ def _set_parameter_with_retries(self, parameter, value, retries):
10601060
XBeeException: if there is any error setting the parameter.
10611061
"""
10621062
_log.debug("Setting parameter '%s' to '%s'" % (parameter, value))
1063+
msg = ""
10631064
while retries > 0:
10641065
try:
10651066
return self._xbee_device.set_parameter(parameter, value)
1066-
except TimeoutException:
1067+
except (TimeoutException, ATCommandException) as e:
1068+
msg = str(e)
10671069
retries -= 1
10681070
time.sleep(0.2)
10691071
except XBeeException:
10701072
raise
10711073

1072-
raise XBeeException("Timeout setting parameter '%s'" % parameter)
1074+
raise XBeeException("Error setting parameter '%s': %s" % parameter, msg)
10731075

10741076
def _update_firmware(self):
10751077
"""

0 commit comments

Comments
 (0)