Open blackspherefollower opened 3 years ago
Since the CRC16 thing makes testing with nRF Connect hard, I threw together a test app here: https://glitch.com/edit/#!/cactus-square-debt After connect send the messages without the CRC16 (send will calculate and add the data)
Valid movement positions: | Hex | Dec | Depth |
---|---|---|---|
0x00 | 0 | 170mm | |
0x0a | 10 | 180mm | |
0x14 | 20 | 197mm | |
0x1e | 30 | 205mm | |
0x28 | 40 | 214mm | |
0x32 | 50 | 223mm | |
0x3c | 60 | 231mm | |
0x46 | 70 | 240mm | |
0x50 | 80 | 248mm | |
0x5a | 90 | 258mm | |
0x64 | 100 | 266mm | |
0x6e | 110 | 275mm | |
0x78 | 120 | 284mm | |
0x82 | 130 | 292mm | |
0x8c | 140 | 300mm | |
0x96 | 150 | 310mm |
Right... an update, because I've been covering my progress on my patron and I need to replicate it here. I have a decent surface fit: TIME = 2.61607666e+03 (SPEED ^ -9.64147031e-01) ((DISTANCE*10) ^ 2.28645432e-01) Where time is in ms, speed is 1-15 and distance is 0-15.
Here's the relevant cross links:
FYI, according to the I/O byte pattern, I believe this is MODBUS RTU. You can check https://www.modbustools.com/modbus.html for more details.
Address | Function | Data | CRC |
---|---|---|---|
1 byte | 1 byte | N bytes | 2 bytes |
The first byte 02
is the device ID, the second byte is Function, where
01 (0x01) Read Coils 02 (0x02) Read Discrete Inputs 03 (0x03) Read Holding Registers 04 (0x04) Read Input Registers 05 (0x05) Write Single Coil 06 (0x06) Write Single Register 08 (0x08) Diagnostics (Serial Line only) 11 (0x0B) Get Comm Event Counter (Serial Line only) 15 (0x0F) Write Multiple Coils 16 (0x10) Write Multiple Registers 17 (0x11) Report Server ID (Serial Line only) 22 (0x16) Mask Write Register 23 (0x17) Read/Write Multiple Registers 43 / 14 (0x2B / 0x0E) Read Device Identification
@forest-devil Do you know what is the current status of F21S support in the library? On iostindex it is added as supported, but I've seen posts on reddit that position control is not working (at least on xtoys)
@forest-devil Do you know what is the current status of F21S support in the library? On iostindex it is added as supported, but I've seen posts on reddit that position control is not working (at least on xtoys)
The protocol is implemented and "works". The timings in Buttplug are off, but we do at least have the numbers (see https://www.patreon.com/posts/66668487).
Position control "should" be fine, but we do not control the Xtoys implementation.
BLE Name: YXlinksSPP Service UUID: 0000ffb0-0000-1000-8000-00805f9b34fb Tx Characteristic UUID: 0000ffb1-0000-1000-8000-00805f9b34fb Rx Characteristic UUID: 0000ffb2-0000-1000-8000-00805f9b34fb
Device is a positional belt driven linear actuator:
Pattern mode:
01 06 00 64 00 00 CRC16
01 06 00 65 00 01 CRC16
01 06 00 65 00 00 CRC16
01 06 00 66 00 02 CRC16
01 06 00 66 00 01 CRC16
01 06 00 67 00 02 CRC16
01 06 00 67 00 01 CRC16
01 06 00 68 00 0X CRC16
(X 1-9 pattern number)Free mode:
01 06 00 64 00 02 CRC16
01 06 00 A7 XX YY CRC16
(XX YY position 16-bit hex value which seems to max out at 225 but app sends 0-100, like 0x00 0x99 for 99, in decimal, like 0x00 0x99 for 99, which I bet this is a bug in their app)Program mode:
01 06 00 64 00 01 CRC16
01 06 00 69 00 01 CRC16
01 06 00 69 00 00 CRC16
01 06 00 6a 00 01 CRC16
/01 06 00 6a 00 00 CRC16
01 10 00 6B 00 05 0a [speed out] [speed in] [position in] [position out] [repeat count] CRC16
Turns out that if you initialise the program with:
01 06 00 64 00 01 CRC16
: Set to program mode01 06 00 69 00 00 CRC16
: Set to record state01 10 00 6b 00 05 0a 00 05 00 05 00 00 00 00 00 01 CRC16
: Set the first oscillation pattern to move to 0 and stay01 06 00 69 00 01 CRC16
: Run the program01 06 00 6a 00 01 CRC16
: Enable loopYou can then send follow-up position/speeds by just sending:
01 10 00 6b 00 05 0a 00 05 00 05 00 90 00 90 00 01 CRC16
: Move to 144 at speed 5