You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Mouse firmware is hanging for me. It sends reports across the UART for movements with appropriate start and end markers. I'm able to decode them and pull the horizontal, vertical, and mouse button bytes from the report. However, after between 10 and 100 seconds into sending them it just stops. I get no response from the coprocessor until it is reset. I suspect a seg fault on the M0, but have no way to debug it.
I have tried your .UF2 file as well as compiling my own with some tweaks like turning on debugging and changing the UART speed to no avail... it eventually just hangs. Oddly, it seems to fail more quickly if I click the mouse or simulate "dragging" the mouse. Also, it seems like click events (without motion) are not reported.
Do you have any ideas on this? I am trying to make a mouse filter so that I can remove shakes, force orthogonality (vert/hor motion only), and remap buttons on arbitrary devices. When it works the code below actually does an interesting job of removing impulse movements.
Here's the code I'm using - it's a variant of your keyboard parser in CP
import board
import busio
import time
import usb_hid
import math
from adafruit_hid.mouse import Mouse
mouse = Mouse(usb_hid.devices)
def applyTransform(hor, vert):
LOGSTYLE=1
style=LOGSTYLE
print((hor, vert))
if (style == LOGSTYLE):
hor *= 6
vert *= 6
if (hor > 0):
hor = math.log(hor)
elif (hor < 0):
hor = -1*math.log(-1*hor)
if (vert > 0):
vert = math.log(vert)
elif (vert < 0):
vert = -1*math.log(-1*vert)
return (int(hor), int(vert))
STX=0x02
ETX=0x03
uart = busio.UART(board.TX, board.RX, baudrate=921600)
while True:
# time.sleep(.01)
data = uart.read(7)
if data is not None:
if (len(data) == 7) and (data[0] == STX) and (True or data[1] == 36) and (data[6] == ETX):
#print("good", data[1], data[2:6])
buttons = data[2]
hor = data[3]
if (hor > 127):
hor = hor - 255
vert = data[4]
if (vert > 127):
vert = vert - 255
vert = vert
# print((buttons, hor, vert))
(hor, vert) = applyTransform(hor, vert)
mouse.move(hor, vert)
else:
# Scan for STX ... ETX to resync
print("sync", data)
report = bytearray(7)
for i in range(0, len(data)):
if data[i] == STX:
report = data[i:len(data)] + uart.read(7-(len(data)-i))
# print("sync2", report)
# if (len(report) == 7) and (report[0] == STX) and (True or report[1] == 0x08) and (report[6] == ETX):
# print("sync3",report[2:6])
The text was updated successfully, but these errors were encountered:
Hello gdsports,
Thanks again for all this work.
The Mouse firmware is hanging for me. It sends reports across the UART for movements with appropriate start and end markers. I'm able to decode them and pull the horizontal, vertical, and mouse button bytes from the report. However, after between 10 and 100 seconds into sending them it just stops. I get no response from the coprocessor until it is reset. I suspect a seg fault on the M0, but have no way to debug it.
I have tried your .UF2 file as well as compiling my own with some tweaks like turning on debugging and changing the UART speed to no avail... it eventually just hangs. Oddly, it seems to fail more quickly if I click the mouse or simulate "dragging" the mouse. Also, it seems like click events (without motion) are not reported.
Do you have any ideas on this? I am trying to make a mouse filter so that I can remove shakes, force orthogonality (vert/hor motion only), and remap buttons on arbitrary devices. When it works the code below actually does an interesting job of removing impulse movements.
Here's the code I'm using - it's a variant of your keyboard parser in CP
The text was updated successfully, but these errors were encountered: