Jump to content

Accelerometer


Guest friedgoldmole

Recommended Posts

Guest newbe5

Been searching around and found this thread: http://groups.google.com/group/android-dev...7c6a87e502a7a17

From the thread:

i found a solution of this problem:

in the onSensorChanged function

public void onSensorChanged(int sensor, float[] values) {

/*

that is the normal code with have the problem

float x=values[0];

float y=values[1];

float z=values[2];

which 0,1,2 is the Accelerometer values based on the orientation and this

give an error some time in the landscape orientation

*/

/*

this is the correct code

*/

float tmpX=values[3];

float tmpY=values[4];

float z=values[5];

/*

where 3,4,5 is the PORTRAIT screen orientation

so if u want to use it in the land scape orientation swap x and y

*/

float x = -1*tmpY;

float y = x;

}

Sounds like it makes sense to me, just need to find where we can change these values.

Confirmation on what I thought in the post further up: http://developer.android.com/reference/and...ensorEvent.html

The X axis is horizontal and points to the right, the Y axis is vertical and points up and the Z axis points towards the outside of the front face of the screen. In this system, coordinates behind the screen have negative Z values.

Currently the Vega reads X as top to bottom (ie from the camera (being the top) to the bottom). Basically, the device THINKS it should be held in portrait mode.

Edited by newbe5
Link to comment
Share on other sites

Guest newbe5

AAAaaaaand... FIXED!

Accelerometer fixed and working with all games I have tested (Raging Thunder 1 and 2 as well as Floating Images) and the G-Sensor app I have is now reporting X and Y the correct way round...

HERE is the file you will need, just do an ADB pull of your own first to keep a backup, and then ADB push this framework.jar to /system/framework/framework.jar

YOU WILL NEED TO HAVE GAME MODE TURNED ON FOR THIS... Otherwise your controls will be backwards! Another interesting side-effect of using this, is it maximises games to fit the whole screen. For example, Raging Thunder 2 previously was small i the center-top of my screen, it now fills the whole screen (although the android status bar is still overlapping it, which im sure can be fixed).

I CANNOT TAKE FULL CREDT FOR THIS, all I did was take the plunge, poke around in the files a LOT to find out where this was controlled from, full credit HAS to go to the guys in the VEGAn-Tab team, I simply did a lot of hacking to find the correct file, and did testing.

I HAVE NOT EXTENSIVELY TESTED THIS... So if the world explodes, don't go blaming me!

Stuff will probably not be right with this, and stuff might need fixing, so for now treat this as an ALPHA! But at least it is a step in the right direction :unsure: This is kind of a proof thing, that this CAN be fixed, it will probably need a little work (the gallery goes a little screwy and menu's open sideways unless you tick the "Do not Rotate" box in the display settings... We will get there though B) Games work!

newbe5

Edited by newbe5
Link to comment
Share on other sites

Guest Lennyuk
http://forum.xda-developers.com/showpost.p...mp;postcount=38

There is a post I found, containing the source code for what the guy did to fix this issue for the Folio100. the files linked there DO NOT work on the Vega however, as I just tested and bricked mine :unsure:

But with the source surely we can fix it too!?

surely we could pull framework.jar (or whatever, not looked into it yet) and make the required changes ourselves (making our own fixed file not using the bad one).

Edited by Lennyuk
Link to comment
Share on other sites

Guest newbe5
surely we could pull framework.jar (or whatever, not looked into it yet) and make the required changes ourselves (making our own fixed file not using the bad one).

Well, at a guess that would mean having the source for the Vega framework.jar, or getting the source for the VEGAn build version which DOES work on the Vega, but is slightly strange and you have to turn off screen rotation to make it work (so you are basically stuck in landscape all of the time). Games work on it, the Gallery gets pretty confused and is on a permanent lant, but the G-sensor appears to be working fully for games.

we have a one-or-the-other situation now, we just need to find that sweet spot in the middle.

Personally, I am not a developer, just a fairly technical user with some balls to test things on my lovely toy (12th brick so far!), and a fair idea where to search online to get answers. We need an Android Dev to grab this and run with it now I think (nudge nudge Paul :unsure:)

Link to comment
Share on other sites

Guest godinandroid
Well, at a guess that would mean having the source for the Vega framework.jar, or getting the source for the VEGAn build version which DOES work on the Vega, but is slightly strange and you have to turn off screen rotation to make it work (so you are basically stuck in landscape all of the time). Games work on it, the Gallery gets pretty confused and is on a permanent lant, but the G-sensor appears to be working fully for games.

we have a one-or-the-other situation now, we just need to find that sweet spot in the middle.

Personally, I am not a developer, just a fairly technical user with some balls to test things on my lovely toy (12th brick so far!), and a fair idea where to search online to get answers. We need an Android Dev to grab this and run with it now I think (nudge nudge Paul :unsure:)

Blimey, nicely done. Thanks:)

I'll have a play with this, all we need now for another stop-gap is for someone to write this into an app, similar to the usb host thing.

Link to comment
Share on other sites

Guest Graham Macleod

Whilst it would be nice to have a fix, there's a real sense in which the Vega isn't doing anything wrong.

The problem is Android itself and the unexpected complexity of handling devices which have a landscape mode default. Have a look at this problem from the Dell Streak forum. It's not just us.

What we could do is write to developers of the Applications which don't work, like Abduction, and point them to the article which ColonelK linked to above

http://android-developers.blogspot.com/201...es-another.html

The article is pretty technical, but developers should understand what it's asking them to do. They should also appreciate that - with the expected flood of Android tablets - they don't want to get this wrong. It's embarrassing as much as anything else.

But a 'fix' along the lines of the Gsensor setting would be welcome. I've spent the day playing with Adobe Air and the accelerometer support in there, using it on the Vega I simply have to swap X and Y readings. I don't really understand how I'm supposed to do this properly. Thick I guess ;-)

Edited by Graham Macleod
Link to comment
Share on other sites

  • 2 months later...
Guest stoolzo
This is just a reply for those who are subscribed to this thread, I have posted an accelerometer fix in this thread.

newbe5

hi, i did read that in its entirety and applied the fix but it didn't work, however I missed the part about not installing it in cwr, this probably why it didn't work.

still cant find any fixes for the no 1080p in flash and very poor sound quality, if I dont get a fix for the sound in a couple of days I am going to return it as quite a a few people already have.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.