Android script mouse emulation

Official forum for open source FreePIE discussion and development.
Post Reply
Tonymaz
One Eyed Hopeful
Posts: 8
Joined: Sun Oct 21, 2018 8:38 am

Android script mouse emulation

Post by Tonymaz »

Hello guys!! :) Any script to use the gyro of my android??? i tried the basic script from the website and It moves but not with the correct axes... :(

Thanks a lot!! :lol:
Tonymaz
One Eyed Hopeful
Posts: 8
Joined: Sun Oct 21, 2018 8:38 am

Re: Android script mouse emulation

Post by Tonymaz »

I want just for Stream games from Moonlight(nvidia) plus aim with the gyro of the phone. Ty!
Tonymaz
One Eyed Hopeful
Posts: 8
Joined: Sun Oct 21, 2018 8:38 am

Re: Android script mouse emulation

Post by Tonymaz »

I tried a lot of scripts and no one works coz always give errors on the log except the official one from freepie website
-Android mouse emulation with deadband and continous yaw-

But its not working properly dont know why, Maybe its a problem for curves... Help me please :$
Tonymaz
One Eyed Hopeful
Posts: 8
Joined: Sun Oct 21, 2018 8:38 am

Re: Android script mouse emulation

Post by Tonymaz »

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! :)
Tonymaz
One Eyed Hopeful
Posts: 8
Joined: Sun Oct 21, 2018 8:38 am

Re: Android script mouse emulation

Post by Tonymaz »

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!
Post Reply

Return to “FreePIE”