Closed c0dexter closed 2 years ago
What logs do you see?
Hi, have a few more problems, but at first I will show you my logs when I pair device with Android smartphone - Huawei P20 Pro (Android 10, EMUI 10):
Server created
no secrets available
BLE on
Registering services
Writing service characteristics
Writing device information service characteristics
Writing battery service characteristics
Writing hid service characteristics
Advertiser created: Trackball with services: [UUID(0x1812)]
Server started
Started advertising
Started advertising
Started advertising
Central connected: 0 // Here I was able to establish connection for a while
Notify with report: (0, 4, 6, 0) // Here I started using trackbal, gathering logs about trackball position
Notify with report: (0, 4, 5, 0)
Notify with report: (0, 4, 4, 0)
Notify with report: (1, 4, 4, 0)
Notify with report: (0, 4, 4, 0)
Connection update // Connection has been refreshed, but I don't know why
Notify with report: (1, 4, 4, 0)
Notify with report: (0, 4, 4, 0)
Notify with report: (1, 4, 4, 0) // I clicked trackbal, then I was able to see that deveice started advertising again
Started advertising // Started advertisng after I clicked trackball button
Notify with report: (0, 4, 4, 0)
Notify with report: (1, 4, 4, 0)
Notify with report: (0, 4, 4, 0)
Notify with report: (1, 4, 4, 0)
Notify with report: (0, -9, 2, 0)
Central disconnected: 0 // I've lost connection
Started advertising // Trackball clicked, advertising has been started, but I coudn't establish connection again
Started advertising // Trackball clicked
Started advertising // Trackball clicked
Issues:
Questions:
EDIT: I was able to establish connection with Windows 11, but when I stopped using trackball for a while, then HID device has been disconnected in a very short time. Logs below:
MicroPython v1.15 on 2021-06-04; ESP32 module with ESP32
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
Server created
no secrets available
BLE on
Registering services
Writing service characteristics
Writing device information service characteristics
Writing battery service characteristics
Writing hid service characteristics
Advertiser created: Trackball with services: [UUID(0x1812)]
Server started
Started advertising
Central connected: 0
MTU exchanged: 23
Connection update
Notify with report: (0, 0, -2, 0)
Notify with report: (0, 0, -3, 0)
Notify with report: (0, 0, -4, 0)
Notify with report: (0, 0, -6, 0)
Notify with report: (0, -1, -6, 0)
Notify with report: (0, -1, -8, 0)
Notify with report: (0, -2, -10, 0)
Notify with report: (0, -2, -12, 0)
Notify with report: (0, -2, -14, 0)
Notify with report: (0, 0, -15, 0)
Notify with report: (0, 2, -15, 0)
Notify with report: (0, 4, -15, 0)
Notify with report: (0, 6, -15, 0)
Notify with report: (0, 6, -13, 0)
Notify with report: (0, 8, -13, 0)
Notify with report: (0, 8, -11, 0)
Notify with report: (0, 8, -10, 0)
Notify with report: (0, 8, -9, 0)
Notify with report: (0, 8, -7, 0)
Notify with report: (0, 8, -8, 0)
Notify with report: (0, 6, -8, 0)
Notify with report: (0, 6, -10, 0)
Notify with report: (0, 6, -12, 0)
Notify with report: (0, 6, -13, 0)
Notify with report: (0, 6, -14, 0)
Notify with report: (0, 5, -16, 0)
Notify with report: (0, 4, -16, 0)
Notify with report: (0, 4, -18, 0)
Notify with report: (0, 2, -18, 0)
Notify with report: (0, 0, -18, 0)
Notify with report: (0, 0, -16, 0)
Notify with report: (0, 0, -15, 0)
Notify with report: (0, 0, -14, 0)
Notify with report: (0, 0, -12, 0)
Notify with report: (0, 0, -10, 0)
Notify with report: (0, 2, -10, 0)
Notify with report: (0, 2, -11, 0)
Notify with report: (0, 2, -12, 0)
Notify with report: (0, 3, -12, 0)
Notify with report: (0, 4, -12, 0)
Notify with report: (0, 5, -12, 0)
Notify with report: (0, 4, -12, 0)
Notify with report: (0, 3, -12, 0)
Notify with report: (0, 3, -14, 0)
Notify with report: (0, 2, -14, 0)
Notify with report: (0, 1, -14, 0)
Notify with report: (0, 0, -12, 0)
Notify with report: (0, -1, -12, 0)
Notify with report: (0, -2, -10, 0)
Notify with report: (0, -3, -10, 0)
Notify with report: (0, -4, -10, 0)
Notify with report: (0, -5, -9, 0)
Notify with report: (0, -5, -8, 0)
Notify with report: (0, -7, -8, 0)
Notify with report: (0, -6, -8, 0)
Notify with report: (0, -6, -7, 0)
Notify with report: (0, -5, -7, 0)
Notify with report: (0, -4, -7, 0)
Notify with report: (0, -4, -9, 0)
Notify with report: (0, -4, -11, 0)
Notify with report: (0, -4, -13, 0)
Notify with report: (0, -2, -13, 0)
Notify with report: (0, -2, -15, 0)
Notify with report: (1, -2, -15, 0)
Notify with report: (0, -2, -15, 0)
Notify with report: (1, -2, -15, 0)
Notify with report: (0, -2, -14, 0)
Notify with report: (0, -4, -12, 0)
Notify with report: (0, -5, -12, 0)
Central disconnected: 0
Started advertising
Thank you in advance for reply
Ha! You're using my tinypico_trackball personal project! As this is a personal project, it behalves different than you'd expect. It actually uses the trackball as a joystick that doesn't self center. As a result, your cursor flies to a corner and stays there because you're not manually centering it. You really should have started from the mouse example, not a personal project.
I can explain the issues, but the simple solution is probably to change
self.axes = (self.clamp(self.axes[0] + left - right), self.clamp(self.axes[1] + up - down))
to
self.axes = (right - left, down - up)
If that doesn't work, please try starting from the mouse example. You can adapt that easily to use the trackball.py file.
Finally, when you power cycle your board or restart the services, always remove the paired device before connecting again.
Hi, At first I would like to say thank you for your effort in creating library and examples :) Sorry that I bother you, my question is probably dumb, but I'm a noob in programming on micro controllers. I found your library and example of code snippets - generaly it's working, but I can see only logs when I move the trackball, but cursor on screen is not moving. I reviewed hid_services.py lib and I cannot see there any method for moving cursor. What I suppose to do, to move cursor in real?
My current code: https://pastebin.com/GTNPsnEg
Thank you in advance for the response