Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:dev:tailcontrol-command-protocol [2024/10/19 16:04] – [USERMOVE Examples] darkgrueen:dev:tailcontrol-command-protocol [2024/12/16 00:12] (current) – [User-defined Tail Moves and LEDs Patterns] darkgrue
Line 6: Line 6:
 All commands are case-sensitive. Trailing whitespace (e.g., `NULL`, `CR`, etc.) are ignored. The space between a command keyword and the parameters is mandatory. All commands are case-sensitive. Trailing whitespace (e.g., `NULL`, `CR`, etc.) are ignored. The space between a command keyword and the parameters is mandatory.
  
-<WRAP round todo>+<WRAP round todo 90%>
 **IMPORTANT NOTICE:** TailCoNTROL and the TailCoNTROL Protocol is still under development. Some commands and features described here relate to a future release and are subject to change at this time, especially EarGear 2 features. **IMPORTANT NOTICE:** TailCoNTROL and the TailCoNTROL Protocol is still under development. Some commands and features described here relate to a future release and are subject to change at this time, especially EarGear 2 features.
 </WRAP> </WRAP>
Line 28: Line 28:
   * TX Characteristic is ''c6612b64-0087-4974-939e-68968ef294b0'', and the   * TX Characteristic is ''c6612b64-0087-4974-939e-68968ef294b0'', and the
   * Battery Voltage is ''b08fed02-0584-40ef-b006-aff7e0d24e13''.   * Battery Voltage is ''b08fed02-0584-40ef-b006-aff7e0d24e13''.
- 
-<WRAP round important> 
-For tail-series v3.6 controller hardware, the battery charging characteristic is unset (charging state is not available). 
-</WRAP> 
- 
  
 The BLE Device Service for the EarGear 2 is ''927dee04-ddd4-4582-8e42-69dc9fbfae66'': The BLE Device Service for the EarGear 2 is ''927dee04-ddd4-4582-8e42-69dc9fbfae66'':
Line 39: Line 34:
   * Battery Voltage is ''54fa919d-e8a8-4841-b280-c5461161304f''.   * Battery Voltage is ''54fa919d-e8a8-4841-b280-c5461161304f''.
  
 +<WRAP round todo 90%>
 +TailCoNTROL will use a new Service and Characteristics UUIDs going forward, to distinguish it from previous firmwares (and to further enforce the “forklift upgrade” required).
 +
 +The BLE Device Service for TailCoNTROL is ''19f8ade2-d0c6-4c0a-912a-30601d9b3060'':
 +  * RX Characteristic is ''5e4d86ac-ef2f-466f-a857-8776d45ffbc2'' and
 +  * TX Characteristic is ''567a99d6-a442-4ac0-b676-4993bf95f805''.
 +  * Under the standard Device Information Service (DIS, ''0x180A'') is
 +    * Manufacturer Name ''0x2A29'' (''The Mechanical Tail Company Limited''),
 +    * Model Number ''0x2A24'',
 +    * Firmware Revision ''0x2A26'', and
 +    * Hardware Revision ''0x2A27''.
 +  * Under the standard Battery Service UUID (''0x180F'') is
 +    * Battery Percentage ''0x2A19'',
 +    * Battery Voltage is ''e818bda3-88a7-43c0-8509-6e0bbb6f55d9'', and the
 +    * Charging State (if hardware supported) is ''5073792e-4fc0-45a0-b0a5-78b6c1756c91''.
 +</WRAP>
 +
 +<WRAP round important 90%>
 +For tail-series (MiTail, MiTail Mini, and FlutterWings) v3.6 controller hardware, the battery charging characteristic is unset (charging state is not available).
 +</WRAP>
  
 ===== TailCoNTROL Device Indicators ===== ===== TailCoNTROL Device Indicators =====
Line 103: Line 118:
 Easing functions are as per the ServoEasing libary [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]]. However, those functions are presented in Hexidecimal and must be converted to a Decimal number before being used in command syntax. The [[https://easings.net/|Easing Functions Cheat Sheet]] is useful to help visualize what easing functions do. Easing functions are as per the ServoEasing libary [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]]. However, those functions are presented in Hexidecimal and must be converted to a Decimal number before being used in command syntax. The [[https://easings.net/|Easing Functions Cheat Sheet]] is useful to help visualize what easing functions do.
  
-| **TAILHM** | **H**o**M**e position | +^ Command  ^ MiTail  ^ MiTail Mini  ^ FlutterWings  ^ Ear Gear 2  ^ 
-| **TAILS1** | **S**low wag **1** | +| **TAILHM** | **H**o**M**e position | **H**o**M**e position | **H**o**M**e position | **H**o**M**e position | 
-| **TAILS2** | **S**low wag **2** | +| **TAILS1** | **S**low wag **1** | **S**low wag **1** | Slow Full Flap | Slow Outward Turn 
-| **TAILS3** | **S**low wag **3** | +| **TAILS2** | **S**low wag **2** | **S**low wag **2** | Slow Low Flap | Slow Left Ear Turn 
-| **TAILFA** | **FA**st wag | +| **TAILS3** | **S**low wag **3** | **S**low wag **3** | Slow High Flap | Slow Right Ear Turn 
-| **TAILSH** | **SH**ort wag | +| **TAILFA** | **FA**st wag | **FA**st wag | Fast Full Flap | Left Tilt 
-| **TAILHA** | **HA**ppy wag | +| **TAILSH** | **SH**ort wag | N/A | Fast Low Flap | Right Tilt 
-| **TAILER** | **ER**ect | +| **TAILHA** | **HA**ppy wag | N/A | Fast Asymmetrical Flap | Quick Outward Turn 
-| **TAILEP** | **E**rect **P**ulse | +| **TAILER** | **ER**ect | N/A | Full Close | Right Twist, Left Twist 
-| **TAILT1** | **T**remble **1** | +| **TAILEP** | **E**rect **P**ulse | N/A | Low Pulse | Double Right Ear Twist 
-| **TAILT2** | **T**remble **2** | +| **TAILT1** | **T**remble **1** | N/A | Slow Asymmetrical Flap | Flick Left Ear 
-| **TAILET** | **E**rect **T**rem | +| **TAILT2** | **T**remble **2** | N/A | Settle | Flick Right Ear 
-| **TAILU1** | **U**ser defined **1** | +| **TAILET** | **E**rect **T**rem | N/A | High Pulse | Double Left Ear Twist 
-| **TAILU2** | **U**ser defined **2** | +| **TAILU1** | **U**ser defined **1** | **U**ser defined **1** | **U**ser defined **1** | **U**ser defined **1** | 
-| **TAILU3** | **U**ser defined **3** | +| **TAILU2** | **U**ser defined **2** | **U**ser defined **2** | **U**ser defined **2** | **U**ser defined **2** | 
-| **TAILU4** | **U**ser defined **4** |+| **TAILU3** | **U**ser defined **3** | **U**ser defined **3** | **U**ser defined **3** | **U**ser defined **3** | 
 +| **TAILU4** | **U**ser defined **4** | **U**ser defined **4** | **U**ser defined **4** | **U**ser defined **4** |
  
  
Line 187: Line 203:
 **DSSP [E<easeType<sub>1</sub>>F<easeType<sub>1</sub>>] A<point<sub>1</sub>>B<point<sub>1</sub>> L<numticks<sub>1</sub>>M<numticks<sub>1</sub>> [H{0|1}]**   **DSSP [E<easeType<sub>1</sub>>F<easeType<sub>1</sub>>] A<point<sub>1</sub>>B<point<sub>1</sub>> L<numticks<sub>1</sub>>M<numticks<sub>1</sub>> [H{0|1}]**  
  
-^ Prefix ^ Parameter Type  ^ Range of Values for Moves  ^ +^ Prefix  ^ Parameter Type  ^ Range of Values for Moves  ^ 
-| **E** | Easing function to apply to Servo 1 | Default is Linear, if not specified.\\ This is the decimal representation of the (hexadecimal) easing type enumeration, as per [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]];\\ e.g., 0 = Linear (no easing), 129 = Quadratic, 130 = Cubic,  131 = Quartic |+| **E** | Easing function to apply to Servo 1 | Default is Linear (no easing), if not specified.\\ This is the decimal representation of the (hexadecimal) easing type enumeration, as per [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]] (e.g., 0 = Linear, 129 = Quadratic in/out, 130 = Cubic in/out,  131 = Quartic in/out). |
 | **F** | Easing function to apply to Servo 2 | (Same as **E**) | | **F** | Easing function to apply to Servo 2 | (Same as **E**) |
 | **A** | Point for Servo 1 | <0 ... 8>\\ 0 -> 25 degrees\\ 1 -> 41 degrees\\ 2 -> 58 degrees\\ ...\\ 8 -> 160 degrees | | **A** | Point for Servo 1 | <0 ... 8>\\ 0 -> 25 degrees\\ 1 -> 41 degrees\\ 2 -> 58 degrees\\ ...\\ 8 -> 160 degrees |
Line 218: Line 234:
 **USERMOVE U<preset> P<numpoints> N<numcycles> [E<easeType<sub>1</sub>>F<easeType<sub>1</sub>> ... E<easeType<sub>n</sub>>F<easeType<sub>n</sub>>] A<point<sub>1</sub>>B<point<sub>1</sub>> ... A<point<sub>n</sub>>B<point<sub>n</sub>> L<numticks<sub>1</sub>>M<numticks<sub>1</sub>> ... L<numticks<sub>n</sub>>M<numticks<sub>n</sub>> [H{0|1}]**   **USERMOVE U<preset> P<numpoints> N<numcycles> [E<easeType<sub>1</sub>>F<easeType<sub>1</sub>> ... E<easeType<sub>n</sub>>F<easeType<sub>n</sub>>] A<point<sub>1</sub>>B<point<sub>1</sub>> ... A<point<sub>n</sub>>B<point<sub>n</sub>> L<numticks<sub>1</sub>>M<numticks<sub>1</sub>> ... L<numticks<sub>n</sub>>M<numticks<sub>n</sub>> [H{0|1}]**  
  
-^ Prefix ^ Parameter Type  ^ Range of Values for Moves  ^+^ Prefix  ^ Parameter Type  ^ Range of Values for Moves  ^
 | **U** | User preset number | <1 ... 4> | | **U** | User preset number | <1 ... 4> |
-| **E** | Easing function to apply to Servo 1 | Default is Linear, if not specified.\\ As per [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]];\\ e.g., 0 = Linear (no easing), 129 = Quadratic, 130 = Cubic,  131 = Quartic |+| **E** | Easing function to apply to Servo 1 | Default is Linear (no easing), if not specified.\\ This is the decimal representation of the (hexadecimal) easing type enumeration, as per [[https://github.com/ArminJo/ServoEasing/blob/bb19cd4cfd9e92fed3b0f91b90a7b2f7dd83094a/src/ServoEasing.h#L296|EaseTypes]] (e.g., 0 = Linear, 129 = Quadratic in/out, 130 = Cubic in/out,  131 = Quartic in/out). |
 | **F** | Easing function to apply to Servo 2 | (Same as **E**) | | **F** | Easing function to apply to Servo 2 | (Same as **E**) |
 | **A** | Point for Servo 1 | <0 ... 8>\\ 0 -> 25 degrees\\ 1 -> 41 degrees\\ 2 -> 58 degrees\\ ...\\ 8 -> 160 degrees | | **A** | Point for Servo 1 | <0 ... 8>\\ 0 -> 25 degrees\\ 1 -> 41 degrees\\ 2 -> 58 degrees\\ ...\\ 8 -> 160 degrees |
Line 233: Line 249:
 | **U** | User preset number | <1 ... 4> | | **U** | User preset number | <1 ... 4> |
 | **P** | Number of points in the Glow Tip pattern | <1 ... 32> | | **P** | Number of points in the Glow Tip pattern | <1 ... 32> |
-| **N** | Number of cycles (times the pattern will be repeated) | <0 ... 255> |+| **N** | Number of cycles (times the pattern will be performed) | <0 ... 255> |
 | **A** | Brightness point for Glow Tip | <0 ... 8>\\ 0 -> LEDs off\\ ...\\ 4 -> 50% intensity\\ ...\\ 8-> LEDs max intensity | | **A** | Brightness point for Glow Tip | <0 ... 8>\\ 0 -> LEDs off\\ ...\\ 4 -> 50% intensity\\ ...\\ 8-> LEDs max intensity |
 | **S/L** | Time between the current point and the next (in 20 ms increments)\\ **S** will wait in the current position, then move to the next when the time has elapsed\\ **L** will gradually move from the current position to the next, over the time specified | 0 ... 127 (time * 20 ms) | | **S/L** | Time between the current point and the next (in 20 ms increments)\\ **S** will wait in the current position, then move to the next when the time has elapsed\\ **L** will gradually move from the current position to the next, over the time specified | 0 ... 127 (time * 20 ms) |
Line 257: Line 273:
   * **U1** Store into user preset 1     * **U1** Store into user preset 1  
   * **P2** The move consists of 2 points     * **P2** The move consists of 2 points  
-  * **N3** Repeat the sequence 3 times  +  * **N3** Perform the sequence 3 times  
   * **E0E66** Servo 1 move to Position 1 has no easing, move to Position 2 uses EASE_CUBIC_OUT (0x42)   * **E0E66** Servo 1 move to Position 1 has no easing, move to Position 2 uses EASE_CUBIC_OUT (0x42)
   * **F0F66** Servo 2 move to Position 1 has no easing, move to Position 2 uses EASE_CUBIC_OUT (0x42)   * **F0F66** Servo 2 move to Position 1 has no easing, move to Position 2 uses EASE_CUBIC_OUT (0x42)
Line 275: Line 291:
   * **U2** Store into user preset 2     * **U2** Store into user preset 2  
   * **P4** The move consists of 4 points     * **P4** The move consists of 4 points  
-  * **N3** Repeat the sequence 3 times  +  * **N3** Perform the sequence 3 times  
   * **A0A4A8A4** Move Servo 1 90° at a time, starting from 0°     * **A0A4A8A4** Move Servo 1 90° at a time, starting from 0°  
   * **B4B8B4B0** Move Servo 2 90° at a time, starting from 90°     * **B4B8B4B0** Move Servo 2 90° at a time, starting from 90°  
Line 282: Line 298:
   * **H1** Home at end of move   * **H1** Home at end of move
  
-<WRAP round info>+<WRAP round info 90%>
 Because no easing parameters (''E'' or ''F'') are specified, no easing is used by default. Because no easing parameters (''E'' or ''F'') are specified, no easing is used by default.
 </WRAP> </WRAP>
Line 297: Line 313:
   * **U1** Store into user preset 1     * **U1** Store into user preset 1  
   * **P2** The pattern consists of 2 brightness points     * **P2** The pattern consists of 2 brightness points  
-  * **N5** Repeat pattern 5 times  +  * **N5** Perform the pattern 5 times  
   * **A8A0** Start at full brightness, then turn off     * **A8A0** Start at full brightness, then turn off  
   * **S5S95** On for 5 * 20 ms = 100 ms; off for 50 * 20ms = 1 s     * **S5S95** On for 5 * 20 ms = 100 ms; off for 50 * 20ms = 1 s  
Line 303: Line 319:
 === Example 2 – Fade in/out (similar to ''LEDTRI'') === === Example 2 – Fade in/out (similar to ''LEDTRI'') ===
  
-The Glow Tip LEDs light up slowly, then dim until completely off; this is repeated 3 times.+The Glow Tip LEDs light up slowly, then dim until completely off; this is performed 3 times.
  
 **USERLEDS U2 P2 N3 A0A8 L100L100** **USERLEDS U2 P2 N3 A0A8 L100L100**
Line 309: Line 325:
   * **U2** Store into user preset 2     * **U2** Store into user preset 2  
   * **P2** The pattern consists of 2 brightness points     * **P2** The pattern consists of 2 brightness points  
-  * **N3** Repeat pattern 3 times  +  * **N3** Perform the pattern 3 times  
   * **A0A8** Start off, finish at full brightness     * **A0A8** Start off, finish at full brightness  
   * **L100L100** Each brightness point is reached in 100 * 20 ms = 2 s   * **L100L100** Each brightness point is reached in 100 * 20 ms = 2 s
Line 347: Line 363:
 Conference mode pairs the user's phone with the TailCoNTROL device and establishes a bond that performs long-term storage of encryption info (particularly keys) so that the devices “know” each other and can easily reconnect in an encrypted way. This protects your device in a number of different ways: Conference mode pairs the user's phone with the TailCoNTROL device and establishes a bond that performs long-term storage of encryption info (particularly keys) so that the devices “know” each other and can easily reconnect in an encrypted way. This protects your device in a number of different ways:
  
-  * Authentication: verifying the identity of the device connecting. +  * **Authentication:** verifying the identity of the device connecting. 
-  * MITM (Man In The Middle): process by which a third device impersonates the other two legitimate devices, in order to fool them into connecting to it. Both BLE central and peripheral will connect to the malicious device, which in turn routes the communication between the other two devices. The malicious device intercepts all data being sent and can inject false data or remove data before it reaches its recipient. +  * **MITM (Man In The Middle):** process by which a third device impersonates the other two legitimate devices, in order to fool them into connecting to it. Both BLE central and peripheral will connect to the malicious device, which in turn routes the communication between the other two devices. The malicious device intercepts all data being sent and can inject false data or remove data before it reaches its recipient. 
-  * Replay Attack: a type of network attack in which an attacker captures a valid network transmission and then retransmits it later. The main objective is to trick the system into accepting the retransmission of the data as legitimate.+  * **Replay Attack:** a type of network attack in which an attacker captures a valid network transmission and then retransmits it later. The main objective is to trick the system into accepting the retransmission of the data as legitimate.
  
 ==== Enabling Conference Mode (Pairing and Binding) ==== ==== Enabling Conference Mode (Pairing and Binding) ====
Line 379: Line 395:
       - Ten seconds after the triple-flash (13 seconds total of continuous holding), the blue LED will blink quickly continuously, release to perform the factory reset. The blue LED will go solid, then the ESP will restart, with the blue LED flashing slowly (ready to connect).       - Ten seconds after the triple-flash (13 seconds total of continuous holding), the blue LED will blink quickly continuously, release to perform the factory reset. The blue LED will go solid, then the ESP will restart, with the blue LED flashing slowly (ready to connect).
  
 +<WRAP round info 90%>
 The bond will also need to be removed on the phone or other device as well, or it will attempt to continue to use the bond (which will fail, because those stored credentials will no longer be valid). The bond will also need to be removed on the phone or other device as well, or it will attempt to continue to use the bond (which will fail, because those stored credentials will no longer be valid).
  
   * On Android, enter Settings, Connections, Bluetooth and find the device to remove (e.g., "mitail"). Select the gear icon, and then select "Unpair". Confirm the dialog to unpair and forget the device.   * On Android, enter Settings, Connections, Bluetooth and find the device to remove (e.g., "mitail"). Select the gear icon, and then select "Unpair". Confirm the dialog to unpair and forget the device.
   * On iOS, enter Settings, Bluetooth and find the device to remove under "My Devices". Select the circle-i icon next to the device name, and then select "Forget This Device". Confirm by selecting "Forget Device".   * On iOS, enter Settings, Bluetooth and find the device to remove under "My Devices". Select the circle-i icon next to the device name, and then select "Forget This Device". Confirm by selecting "Forget Device".
 +
 +</WRAP>
  
  
 ===== iOS Casual Mode ===== ===== iOS Casual Mode =====
  
-<WRAP round todo>+<WRAP round todo 90%>
 This feature is pending removal in a future release. This feature is pending removal in a future release.
 </WRAP> </WRAP>
Line 441: Line 460:
  
 Triggering by Tilt Mode is inhibited when the ears are in motion, as well as a 3-second counter that runs once a sound trigger has finished executing a move AND the EarGear 2 has returned to the neutral tilt position during that time. This prevents tilt re-triggering if the user stays in the tilt position for an extended time. Triggering by Tilt Mode is inhibited when the ears are in motion, as well as a 3-second counter that runs once a sound trigger has finished executing a move AND the EarGear 2 has returned to the neutral tilt position during that time. This prevents tilt re-triggering if the user stays in the tilt position for an extended time.
 +
 +
 +===== Debugging =====
 +
 +TailCoNTROL has ample output to the serial console that can be invaluable when debugging controllers. The device can also be commanded from the console as well.
 +
 +==== MiTail, MiTail Mini, FlutterWings ====
 +
 +Hardware console can be accessed from unpopulated board connector (requires opening the case) with a 3.3 V USB to TTL interface. If you also wish to be able to hardware flash, make sure that it provides RXD, TXD, RTS (Ready to Send), and DTR (Data Terminal Ready) signals (i.e., a 6-pin connector with the appropriate signals). Numerous inexpensive USB to TTL cables and interfaces are not capable of doing this, check carefully before investing in a tool to perform this.
 +
 +The [[https://1bitsquared.com/products/tigard|Tigard Protocol Tool]] works very nicely, though it is massively overkill in that it has many more capabilities than are required.
 +
 +The interface pinout on the board is below. Pins are numbered counting from Pin 1, closest to the servo connector, on the component side of the controller board.
 +
 +{{ :en:esp32_uart0_connections.jpg?direct&400 |ESP32 UART0 Connections}}
 +
 +**Note:** USB to TTL interfaces are available with 5 V, 3.3 V, or selectable voltage. The ESP32 //must// be used with 3.3 V interfaces //only//! Ensure that your cable or device is configured for 3.3 V before connecting it to the controller board, or your ESP32 may be permanently damaged.
 +
 +==== Ear Gear 2 ====
 +
 +The Ear Gear 2 uses the USB CDC, which may be accessed from the USB-C connector on the right ear.
  
  
 == Copyright 2024 © The Mechanical Tail Company Limited contact@thetailcompany.com. All Rights Reserved. == == Copyright 2024 © The Mechanical Tail Company Limited contact@thetailcompany.com. All Rights Reserved. ==
  
Back to top