Open SuhEugene opened 8 months ago
The handleScale()
method is there to avoid the device's motor deadzone (where it can't spin the weight).
The 0x2a50
chacteristic is under the 0x180a
service and reads 0x01a70600000100
, which is the PnP ID of Manufacturer 06a7=Chipsea
, ProductId 0000=0
and Product Version 0100=1
BT Name:
XHTKJ
Service UUID:0xFF10
Characteristic UUID:0xFF12
Message:
0312f300fc00fe4001XXXX00fc00fe4001YYYY00
XXXX
andYYYY
is hex representation of strength-based UInt16(handleScale(strength) * 1023) << 6 | 60
Scale handling
```js function handleScale(v) { if (!v) return 0; if (is019DDevice()) return (v * 0.8) + 0.2; if (is030Device()) return (v * 0.7) + 0.3; if (is035Device()) return (v * 0.6) + 0.4; if (is018Device()) return (v * 0.6) + 0.4; return (v * 0.7) + 0.3; } ```Device types
Device info is in the `0x2A50` characteristic, no service stated. You need to get little-endian UInt16 with byte offset 3. My device has no binary information in any of `0x2A50` characteristics, so i can't provide any example ```js const is018Device = () => deviceType == 1; const is030Device = () => deviceType == 2; const is035Device = () => deviceType == 3; const is019DDevice = () => deviceType == 4; const is029Device = () => deviceType == 29; ```Examples:
WeChat app sends message every 0.2 seconds If no message sent within a cetain amount of time, toy stops
Also app has some setModel and setClear messages
setClear is sent once when user touches drag bar It is constant message:
0312f00700000000000000000000000000000000
setModel(0) is called when app pages are unloaded and in some other cases i don't understand. Message:
0312f60000000000000000000000000000000000