def mai_set_time(self, gpstime):
"""
Sets the ADACS clock.
Arguments:
gpstime - GPS time is a linear count of seconds elapsed since 0h Jan 6, 1980.
"""
DATA_LEN = 40 #always
data = bytearray(DATA_LEN)
syncbyte = 0xEB90 # TODO: the Pumpkin comments contain some confusing statements about endianness
commandID = 0x44 # set GPS time
# Create data
struct.pack_into('<HBL', data, 0, syncbyte, commandID,
gpstime)
# Add data checksum. (This is different than the packet checksum.)
checksum = 0xFFFF & sum(data[0:DATA_LEN])
struct.pack_into('<H', data, 38, checksum)
Send.send_bus_cmd(BusCommands.MAI_CMD, data)
评论列表
文章目录