Hi.
I have been trying to use the Init Variables Device Orientation action but I am not getting the expected values.
I have created a test flow that just reports the Pitch and Roll in a screen notification. With the phone face up on the table the reported pitch is about 0 (or 360) but as I rotate the phone leaving the bottom edge on the table the pitch reduces to 275 with the phone is standing upright on its bottom edge. If I continue to rotate so the screen starts to become face down the pitch increases again and when the screen is completely face down pitch is about 360 again. A similar thing happens if I rotate the phone with the leaving the top edge on the table. The pitch starts at 0, increases to 90 when the phone is standing upside down on its top edge and then reduces again to 0 (360) when the screen is completely face down.
I have used the app Droid info to look at the values from the orientation sensor and they are as expected (i.e. 0 when face up on table, -90 when standing on bottom edge, -180 when face down, 90 when standing on top edge)
I really want to be able use the pitch to tell if the phone is nearly upright (e.g. setting in a dock with a slight lean back). Say -40 > Pitch > -60.
Help with Init Variables Device Orientation
Moderator: Martin
Re: Help with Init Variables Device Orientation
https://stackoverflow.com/questions/259 ... roll-pitch
Make your own calculations, I made that too to show an icon for 4 directions.
Make your own calculations, I made that too to show an icon for 4 directions.
All systems nominal.
-
- Posts: 13
- Joined: 28 Oct 2014 09:20
Re: Help with Init Variables Device Orientation
Wow. Thanks for the reply. That is all slightly more complex than I would have thought.
To be honest I am not sure where I would start with all that.
To be honest I am not sure where I would start with all that.
Re: Help with Init Variables Device Orientation
I tried and have the same problem. So it seems when the sensor app read the value, they adjust directly to the magnet and acceleration. Need to know how to calculate that in automagic.
BTW, how do you check the orientation change? Do you use trigger period timer persecond? I mean the value change very frequently, how do you stream the sensor value to output in automagic? I can only get the value persecond, which is very slow in this case.
BTW, how do you check the orientation change? Do you use trigger period timer persecond? I mean the value change very frequently, how do you stream the sensor value to output in automagic? I can only get the value persecond, which is very slow in this case.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 13
- Joined: 28 Oct 2014 09:20
Re: Help with Init Variables Device Orientation
At moment I am just testing, but my plan was to use a power connected condition as the trigger.
-
- Posts: 13
- Joined: 28 Oct 2014 09:20
Re: Help with Init Variables Device Orientation
Anyone got any ideas on this issue. I want to use orientation in a flow that starts a dashcam app when car Bluetooth connects and the phone is in the car dock (i.e. almost standing upright or laying on one side). The Device Orientation: standing upright condition works sometimes but sometimes phone is leaning a bit too much.
Re: Help with Init Variables Device Orientation
If your use case only limited to car dock, then you can just deal with the value there. I assume you have the timer to loop check the orientation after the flow triggered by bluetooth connected. Since the value range from 360 - 270 - 360, then just use probably range from 270-300 (30 degree in both way). This means if your phone leans slightly forward or backward, will continue the flow.
Other way around is to use magnet. Put a small magnet near (but not too close) at the dock. Then try out the trigger magnetic field sensor, check the value and adjust to which level you wanna trigger. Put the whole action of starting dashcam app in this flow. Then when your bluetooth connected, enabled this flow and disable it after 1 minute. Means the flow only check for the magnet during the 1 minute window after connected to your car's bluetooth, minimizing the sensor usage (since it is specific for the car only). You can put the phone in any orientation, as long as it can sense that magnet nearby, then it will trigger the flow.
If your phone has nfc, you might want to use that instead.
Other way around is to use magnet. Put a small magnet near (but not too close) at the dock. Then try out the trigger magnetic field sensor, check the value and adjust to which level you wanna trigger. Put the whole action of starting dashcam app in this flow. Then when your bluetooth connected, enabled this flow and disable it after 1 minute. Means the flow only check for the magnet during the 1 minute window after connected to your car's bluetooth, minimizing the sensor usage (since it is specific for the car only). You can put the phone in any orientation, as long as it can sense that magnet nearby, then it will trigger the flow.
If your phone has nfc, you might want to use that instead.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Help with Init Variables Device Orientation
Maybe not applicable in your situation, but my phone has Qi charging. All my home chargers are horizontal, so my phone is always in face up orientation when charging there. In my car, the Qi charger is almost upright. So I trigger a flow using Power Source connected, then I have a Device Orientation condition, Face Up. True = charging at home (which activates some time-dependent flows e.g if late at night, turns off the screen). False = charging in car (which turns on my Drive Mode flow)postaletter wrote:Anyone got any ideas on this issue. I want to use orientation in a flow that starts a dashcam app when car Bluetooth connects and the phone is in the car dock (i.e. almost standing upright or laying on one side). The Device Orientation: standing upright condition works sometimes but sometimes phone is leaning a bit too much.