Skip to content

Commit eba0850

Browse files
committed
[feat] add api set_control_modbus_baudrate
1 parent ea5b1cc commit eba0850

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

doc/api/xarm_api.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
xArm-Python-SDK API Documentation (V1.13.28): class XArmAPI in module xarm.wrapper.xarm_api
1+
xArm-Python-SDK API Documentation (V1.13.30): class XArmAPI in module xarm.wrapper.xarm_api
22

33
## class __XArmAPI__
44
****************************************
@@ -3489,6 +3489,15 @@ xArm-Python-SDK API Documentation (V1.13.28): class XArmAPI in module xarm.wrapp
34893489
> :return: code
34903490
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
34913491
3492+
#### def __set_control_modbus_baudrate__(self, baud):
3493+
3494+
> Set the modbus baudrate of the control box
3495+
>
3496+
> :param baud: 4800/9600/19200/38400/57600/115200/230400/460800/921600/1000000/1500000/2000000/2500000
3497+
>
3498+
> :return: code
3499+
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
3500+
34923501

34933502
#### def __set_timeout__(self, timeout):
34943503

xarm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.13.29'
1+
__version__ = '1.13.30'

xarm/wrapper/xarm_api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,6 +2880,17 @@ def get_tgpio_modbus_baudrate(self):
28802880
baudrate: the modbus baudrate of the tool gpio
28812881
"""
28822882
return self._arm.get_tgpio_modbus_baudrate()
2883+
2884+
def set_control_modbus_baudrate(self, baud):
2885+
"""
2886+
Set the modbus baudrate of the control box
2887+
2888+
:param baud: 4800/9600/19200/38400/57600/115200/230400/460800/921600/1000000/1500000/2000000/2500000
2889+
2890+
:return: code
2891+
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
2892+
"""
2893+
return self._arm.set_control_modbus_baudrate(baud)
28832894

28842895
def getset_tgpio_modbus_data(self, datas, min_res_len=0, host_id=9, is_transparent_transmission=False, use_503_port=False, **kwargs):
28852896
"""

xarm/x3/base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,13 @@ def get_tgpio_modbus_baudrate(self):
24952495
# if code == 0 and baud_inx < len(self.arm_cmd.BAUDRATES):
24962496
# self.modbus_baud = self.arm_cmd.BAUDRATES[baud_inx]
24972497
return code, self.modbus_baud
2498-
2498+
2499+
@xarm_is_connected(_type='set')
2500+
def set_control_modbus_baudrate(self, baud):
2501+
code = self.checkset_modbus_baud(baud, check=False, host_id=XCONF.LINEER_TRACK_HOST_ID)
2502+
self.log_api_info('API -> set_control_modbus_baudrate -> code={}'.format(code), code=code)
2503+
return code
2504+
24992505
def getset_tgpio_modbus_data(self, datas, min_res_len=0, ignore_log=False, host_id=XCONF.TGPIO_HOST_ID, is_transparent_transmission=False, use_503_port=False, **kwargs):
25002506
if not self.connected:
25012507
return APIState.NOT_CONNECTED, []

0 commit comments

Comments
 (0)