[HD2 Android SD Development] memin1857:
[Solved] TS FREEZE FIXED / Orientation offset calibration & G-SENSOR CALIBRATION FIX

UPDATE: (13/11) A patch has been developed that completely eliminates TS FREEZE for good.

Thanks to mdebeljuh and jdivic, I tested it and it seems to be working perfectly.

Check post 140 on page 14:

http://xdaforums.com/showpost.php?p=9194473&postcount=140

UPDATE: (20/11)A new patched 8.2 kernel without logging (better for daily use) is available.

Check post 234 on page 24:

http://xdaforums.com/showpost.php?p=9304396&postcount=234

-----

EDIT: If you did autocalibration and messed your g-sensor, read post 10 & 11 to see a fix for it. (before going through post 1)

EDIT 2: Freezes of sensors and touch screen seem to be related to offset values. See post 10 & 11

Post 1 is for orientation offset. Check post 10 & 11 for g-sensor and ts freeze fix.

----

If your orientation is off when you lay your phone on a level surface and can't calibrate it in Android (because many people found it gets corrupted after auto calibration), this is one way to do so. (Winmo g-sensor calibration does not seem to affect android orientation)

Install an app that displays sensor information along with pitch and roll. (such as SensorDebug from Android market)

Put your phone on a level surface such as the floor or a table.

Note your pitch and roll values.

Use rootexplorer or similar file manager to edit /data/misc/AK8973Prms.txt file. (open in text editor) (For ASTRO CHECK POST 70 in page 7)

You will see AOFFSET.x and AOFFSET.y at the bottom. (May be on top if you autocalibrated previously)

y affects pitch and x affects roll, there is about 4 to 1 ratio.

What you are trying to do is make pitch and roll 0 with minimum flicker.

Press and hold home button to switch between rootexplorer and sensordebug. Your changes will be reflected in realtime (with most builds). Go back and forth a few times to get perfect result. (You can press and hold home button to go back and forth) If you think changing values don't have an affect, try to temprorarily change AOFFSET.x=90 and return to your app. When phone is on the table, your leveling bubble or pitch/roll must be way off. This way you can see if with your build changes are reflected in realtime or not. If not try restarting, use different sensor app and give feedback please. (After that revert AOFFSET.x to 0 or other value your want to fix back orientation)

For example:

If pitch is 3 and roll is -1

you may start by

AOFFSET.x=4

AOFFSET.y=-12

Then adjust with 1 increments to get rid of flicker.

It is best to adjust one value at a time.

EDIT: IF YOU WANT TO CALIBRATE Z AXIS, CHECK POST 61 in page 7

Calibrated AOFFSET values for my phone are x=2 y=-9 z=12

You can use gpsstatus or bubble app (to find bubble app search the market for bz.ktk.bubble and enable "show angle" from bubble apps settings.) for visual check of orientation calibration. Because of the protruding camera lens of hd2, there can be 1 degree difference between sideways and normal orientation. (It seems you can adjust in about 0.25 degree increments by each 1 increment of AOFFSET and compansate by lowering AOFFSET=y by 2 that gives 0 degrees in both normal and sideways orientation in bubble app)

- You don't need to reboot for most builds (if there is no affect check post 11)

- You don't need to kill/restart akmd

- You don't even need to close sensor app

- Because of not perfect kernel/build support for sensors, you may see them freeze when you move the phone (TS will also freeze). With evo kernels, just wait a few seconds and it will resume. (With nexus kernels they may freeze until sleep/wakeup) Interestingly the values of AK8973Prms.txt affect shake/move freezes. I wrote about this in post 10 and 11.

IT IS A GOOD IDEA TO BACKUP COMPLETE ANDROID FOLDER BEFOREHAND just in case something goes wrong. Chefs say you shouldn't auto calibrate your g-sensor under Android because with many people it gets messed up. Also good idea to backup your /data/misc/AK8973Prms.txt

You may have trouble accessing data folder with a file manager other than rootexplorer. Your build must be rooted. (most are) It is a good idea to update your su binary inside superuser app settings TWICE. If you change permissions of /data /data/misc folders you may access them even with standart astro file manager. Try chmod 777 /data from terminal emulator.

This procedure is also possible with adb or droidexplorer. But my way of doing is practical and it is in realtime. If your build has different file name, please tell us.

This IS a development thread, please don't tell me to post in generic section or clutter.

This is manual workaround for non-working auto calibration. If auto-calibration works in the future, it may very well fix your freezes.

Values of AK8973Prms.txt file may solve touch screen/sensor freeze problems with your games. Feedbacks are always welcome. We should find out what the other values do exactly. Also check post 10 & 11