AndersMalmgren / FreePIE

Programmable Input Emulator
650 stars 144 forks source link

Need a simple freepie scripts for gyro the mouse on pc #166

Closed Tonymazzz closed 6 years ago

Tonymazzz commented 6 years ago

Hello guys un streaming with Moonlight from Nvidia ti my Xiaomi mi máx 3 oreo and i only found one scripts that works but not like i need, os this one Android mouse emulation with deadband and continous yaw fronthe freepie oficial wetsite, do hoy have any other that can works for emulate the mouse with the gyro of the phone? Thanks un advance!

Tonymazzz commented 6 years ago

I found this one working perfecto except for some jitter:

def update(): global yaw global roll global pitch yaw = -android[0].googleYaw roll = -android[0].googleRoll pitch = android[0].googlePitch

if starting: yaw = 0 roll = 0 pitch = 0 enabled = False android[0].update += update

diagnostics.watch(yaw) diagnostics.watch(roll) diagnostics.watch(pitch)

deltaYaw = filters.delta(yaw) deltaPitch = filters.delta(pitch) deltaRoll = filters.delta(roll)

if math.fabs(deltaYaw) >= math.pi: deltaYaw = 0

if (enabled): mouse.deltaX = -deltaYaw400 mouse.deltaY = -deltaRoll800

toggle = keyboard.getPressed(Key.M)

if toggle: enabled = not enabled

And this one have bad the axis but with much less jitter:

def update():

Apply deadband filter to avoid drift

#And continousRotation filter to yaw axis to avoid jumps when passing tracker center
x = filters.deadband(filters.delta(math.degrees(filters.continousRotation(android[0].pitch))), deadband)
y = filters.deadband(filters.delta(math.degrees(filters.continousRotation(android[0].yaw))), deadband)

mouse.deltaX = x * multiply
mouse.deltaY = y * multiply

if starting: deadband = 0.01 multiply = 5 android[0].update += update

Can i just mix bouth?? Thanks ppl!

Tonymazzz commented 6 years ago

I found that the last scripts works perfect but only with the phone flat información the table, if i use informe landscape It losses their axes... And its not straight its like doing a curve.. Ty guys