diff --git a/pymycobot/common.py b/pymycobot/common.py index 28a2cb2..85d98c2 100644 --- a/pymycobot/common.py +++ b/pymycobot/common.py @@ -517,6 +517,9 @@ class ProtocolCode(object): SET_JOINT_DISABLE = '*7' SET_JOINT_ENABLE = '*8' + # MyArm M750 + IS_SD_INSERT = 0xC4 + class DataProcessor(object): crc_robot_class = ["Mercury", "MercurySocket", "Pro630", "Pro630Client", "Pro400Client", "Pro400", "MercuryTest", "Pro450Client"] diff --git a/pymycobot/myarm_api.py b/pymycobot/myarm_api.py index 76fa3f5..426ea4f 100644 --- a/pymycobot/myarm_api.py +++ b/pymycobot/myarm_api.py @@ -77,6 +77,8 @@ def _read(self, genre): timeout = 0.4 elif genre == ProtocolCode.POWER_ON: timeout = 2 + elif genre == ProtocolCode.IS_SD_INSERT: + timeout = 1 else: timeout = 0.1 @@ -132,7 +134,8 @@ def _mesg(self, genre, *args, **kwargs): ProtocolCode.POWER_ON, ProtocolCode.GET_MASTER_PIN_STATUS, ProtocolCode.GET_ATOM_PIN_STATUS, - ProtocolCode.GET_SERVO_D + ProtocolCode.GET_SERVO_D, + ProtocolCode.IS_SD_INSERT ] if genre in return_single_genres: diff --git a/pymycobot/myarmm.py b/pymycobot/myarmm.py index ce51d15..2906f0d 100644 --- a/pymycobot/myarmm.py +++ b/pymycobot/myarmm.py @@ -162,3 +162,11 @@ def is_tool_btn_clicked(self): def clear_recv_queue(self): """Clear the queue for receiving commands""" self._mesg(ProtocolCode.CLEAR_RECV_QUEUE) + + def is_sd_insert(self): + """Check if the SD card is inserted + + Returns: + int: 0/1, 1: insert, 0: no insert + """ + return self._mesg(ProtocolCode.IS_SD_INSERT, has_reply=True)