I haven't looked at the code yet, but my instinctive approach would be to calculate the direction of the "down" vector (constant 9.8m/s2 acceleration) and then compare that to the phone's "down" direction. It is the difference between these two vectors that I am referring to. Even if the error is great, surely it is not superior to 45 degrees (a quarter turn)? Is this not the way it is done?
Fox Mulder wrote: > This is not so easy to do. The rotation comes out of a calculation of > the values from acceleration sensors. There are no "angle" sensors for > this operation. So there is no way of exactly say which angle the neo > currently has instead these are just aproximations. > > Ciao, > Rainer > > Vasco Névoa wrote: > >> That's very cool. I appreciate the mod. :) >> I'm seeing something that looks like a bug (in both versions)... but I'm >> not sure if the accelerometers require calibration or something. >> With the FR in vertical position, if I tilt it counter-clockwise, it >> takes just over 90 degrees to get 'accel-rotate' to change the >> orientation; but if I tilt it even less than 10 degrees clockwise after >> that, it reverts back to the original orientation. >> Shouldn't the threshold be set at the midpoint angles (45, 135, 225, 315 >> degrees)? >> Anyway, good work to both coders, it's just what I wanted. :D >> Maybe someone cares to extend this simple app to use some kind of sexy >> morph instead of the disruptive xrandr rotation? 8-) >> >> Rui Miguel Silva Seabra wrote: >> >>> Done. I've added a reference to it at http://wiki.openmoko.org/wiki/Rotate >>> but my page about it is at >>> http://blog.1407.org/2008/09/20/openmoko-rotate-now-using-libxrandr/ >>> >>> Users of Rotate, I've patched it so it doesn't use system+xrandr but >>> simply call directly the xrandr function using libxrandr. >>> >>> This means: >>> * quicker >>> * less battery consumption >>> >>> Best, >>> Rui >>> >>> On Fri, Sep 19, 2008 at 10:13:29AM +0100, Rui Miguel Silva Seabra wrote: >>> >>> >>>> Hi, >>>> >>>> I'm preparing a patch for using xrandr api directly in Rotate instead of >>>> system(). It's almost done but I can only code it at home time (which, for >>>> me, starts again in about 9 hours) :) >>>> >>>> This will be much better in terms of speed and battery life! >>>> >>>> Best, >>>> Rui >>>> >>>> >>> >>> >> _______________________________________________ >> Openmoko community mailing list >> community@lists.openmoko.org >> http://lists.openmoko.org/mailman/listinfo/community >> >> > > _______________________________________________ > Openmoko community mailing list > community@lists.openmoko.org > http://lists.openmoko.org/mailman/listinfo/community > > > _______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community