Skip to content

81 Mech Status (Mechanical Status) ​

MechStatus stores the status of each hardware in sesame5.

Structure of mechStatus: ​

c
#pragma pack(1)
typedef struct mech_status_s {
    uint16_t battery;
    int16_t target;                     // The place the motor wants to reach
    int16_t position;                   // The latest angle synced by the sensor
    uint8_t is_clutch_failed: 1;        // Whether the electromagnet has succeeded (not used)
    uint8_t is_lock_range: 1;           // In the lock position
    uint8_t is_unlock_range: 1;         // In the unlock position
    uint8_t is_critical: 1;             // Open and close lock time exceeded, motor stops
    uint8_t is_stop: 1;                 // The angle of the handle does not change
    uint8_t is_low_battery: 1;          // Low battery (<5V)
    uint8_t is_clockwise: 1;            // Direction of motor rotation
} mech_status_t;
#pragma pack()

To prevent clients from frequently requesting the mechanical status from sesame5, the mechanical status can only be sent proactively by sesame5 when there is a change.

Sequence diagram of mechStatus interaction between mobile and ssm5 ​

Contents of ssm5 push ​

ByteN ~ 210
Datapayloaditem_codetype
DescriptionData sent to the phoneCommand numberPush Type

type : SSM2_OP_CODE_PUBLISH (0x08)

item code : SSM2_ITEM_CODE_INITIAL (81)

payload : See the following table for details

payload ​

Byte6 ~ 0
DatamechStatus

mech status ​

Byte65 ~ 43 ~ 21 ~ 0
Dataother datapositiontargetbattery

other data ​

Bit76543210
DataNULLis_clockwiseis_low_batteryis_stopis_criticalis_unlock_rangeis_lock_rangeis_clutch_failed

iOS, Android, ESP32 examples ​