Skip to content

Instantly share code, notes, and snippets.

@darthcloud
Created June 25, 2025 23:46
Show Gist options
  • Save darthcloud/aebeab685a74ebc3875a3c9bf39f0cd1 to your computer and use it in GitHub Desktop.
Save darthcloud/aebeab685a74ebc3875a3c9bf39f0cd1 to your computer and use it in GitHub Desktop.
DATA = bytes([
# Pro2 CalibA
# 0x01, 0xad, 0xd9, 0x9a, 0x55, 0x56, 0x65, 0xa0,
# 0x00, 0x0a, 0xa0, 0x00, 0x0a, 0xe2, 0x20, 0x0e,
# 0xe2, 0x20, 0x0e, 0x9a, 0xad, 0xd9, 0x9a, 0xad,
# 0xd9, 0x0a, 0xa5, 0x50, 0x0a, 0xa5, 0x50, 0x2f,
# 0xf6, 0x62, 0x2f, 0xf6, 0x62, 0x0a, 0xff, 0xff,
# 0xee, 0x07, 0x85, 0x83, 0x76, 0x64, 0x5e, 0x76,
# 0x61, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
# 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
# Pro2 CalibB
# 0x01, 0xad, 0xd9, 0x9a, 0x55, 0x56, 0x65, 0xa0,
# 0x00, 0x0a, 0xa0, 0x00, 0x0a, 0xe2, 0x20, 0x0e,
# 0xe2, 0x20, 0x0e, 0x9a, 0xad, 0xd9, 0x9a, 0xad,
# 0xd9, 0x0a, 0xa5, 0x50, 0x0a, 0xa5, 0x50, 0x2f,
# 0xf6, 0x62, 0x2f, 0xf6, 0x62, 0x0a, 0xff, 0xff,
# 0xa2, 0x38, 0x7d, 0x0d, 0x06, 0x66, 0x30, 0x06,
# 0x65, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
# 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
# GC CalibA
#0 0xff, 0x47, 0x79, 0x94, 0xb8, 0x86, 0x6b, 0xa0,
#8 0x00, 0x0a, 0xa0, 0x00, 0x0a, 0xff, 0xff, 0xff,
#16 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
#24 0xff, 0xbe, 0xe3, 0x3b, 0xbe, 0xe3, 0x3b, 0x06,
#32 0x65, 0x50, 0x06, 0x65, 0x50, 0x0a, 0xff, 0xff,
#40 0x22, 0x38, 0x82, 0xcd, 0xf4, 0x4b, 0xba, 0xe4,
# 0x4e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
# 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
# GC CalibB
# 0xff, 0x47, 0x79, 0x94, 0xb8, 0x86, 0x6b, 0xa0,
# 0x00, 0x0a, 0xa0, 0x00, 0x0a, 0xff, 0xff, 0xff,
# 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
# 0xff, 0x18, 0x83, 0x31, 0x18, 0x83, 0x31, 0x5f,
# 0xf4, 0x45, 0x5f, 0xf4, 0x45, 0x0a, 0xff, 0xff,
# 0x51, 0x88, 0x7f, 0x5c, 0x54, 0x46, 0x4c, 0xf4,
# 0x44, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
# 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
# User Pro2
0xb2, 0xa1, 0xf6, 0x37, 0x86, 0x7e, 0x96, 0x64,
0x6e, 0xb6, 0x62, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xb2, 0xa1, 0xae, 0xc8, 0x7d, 0xfa, 0xd5, 0x69,
0x4c, 0x96, 0x65, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])
def process_12bits_val(raw):
data = []
data.append(((raw[1] << 8) & 0xF00) | raw[0])
data.append((raw[2] << 4) | (raw[1] >> 4))
data.append(((raw[4] << 8) & 0xF00) | raw[3])
data.append((raw[5] << 4) | (raw[4] >> 4))
data.append(((raw[7] << 8) & 0xF00) | raw[6])
data.append((raw[8] << 4) | (raw[7] >> 4))
return data
loop_cnt = len(DATA) - 8
for idx in range(loop_cnt):
raw = DATA[idx:idx + 9]
#print(f"{raw.hex()}")
val = process_12bits_val(raw)
print(f"{idx}: {val}")
#Results
# Calib data is at offset 40
# Pro2
# CalibA [2030, 2128, 1667, 1607, 1630, 1559]
# CalibB [2210, 2003, 1549, 1632, 1584, 1616]
# GC
# CalibA [2082, 2083, 1229, 1215, 1210, 1262]
# CalibB [2129, 2040, 1116, 1125, 1100, 1103]
# User is a offset 2 & 34
# 2: [2038, 2147, 1662, 1609, 1646, 1579]
# 34: [2222, 2012, 1530, 1693, 1612, 1625]
# Data field order
# LX Center, LY Center, LX MAX, LY MAX, LX MIN, LY MIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment