accelerometer on iphone and ipad has different orientation than in previous version

Hi, I upgraded to cocos2d-1.0.1-x-0.9.2 (from cocos2d-1.0.1-x-0.9.1) and I found out, that axis of accelerometer has different orientations than in previous version of cocos.

I tested it on iphone and ipad.

It looks that status bar orientation isn’t updated properly, because when I changed axis according to

(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{   
    if (! delegate_)
    {
        return;
    }

    acceleration_->x = acceleration.x;
    acceleration_->y = acceleration.y;
    acceleration_->z = acceleration.z;
    acceleration_->timestamp = acceleration.timestamp;

    double tmp = acceleration_->x;

    switch ([[UIApplication sharedApplication] statusBarOrientation]) 
    {
    case UIInterfaceOrientationLandscapeRight:
        acceleration_->x = -acceleration_->y;
        acceleration_->y = tmp;
        break;

    case UIInterfaceOrientationLandscapeLeft:
        acceleration_->x = acceleration_->y;
        acceleration_->y = -tmp;
        break;

    case UIInterfaceOrientationPortraitUpsideDown:
        acceleration_->x = -acceleration_->y;
        acceleration_->y = -tmp;
        break;

    case UIInterfaceOrientationPortrait:
        break;
    }

it started to work again as in previous version…

I am sorry, what did you mean.
The codes have bug?

Well, I will be more talkative.
I develop a minigame that uses accelerometer.
When I upgraded to version 0.9.2 it stopped working properly.

Values that I receive in function void CFishingMiniGame::didAccelerate(CCAcceleration* pAccelerationValue) are different than values in version of cocos 0.9.1.
Axis of that CCAcceleration* pAccelerationValue were mixed.

When I applied transformation that is written in function (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration

case UIInterfaceOrientationLandscapeRight:
        acceleration_->x = -acceleration_->y;
        acceleration_->y = tmp;
        break;

and 
case UIInterfaceOrientationLandscapeLeft:
        acceleration_->x = acceleration_->y;
        acceleration_->y = -tmp;
        break;

(I support only landscape orientation of this game), game started to work properly again.

Therefore I deduced that this code in function (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
didn’t perform this transformation.

Why? Probably because of statusBarOrientation isn’t set properly. - But it is only my deduction.

Oh, because we translate the axis according the orientation, then the developer don’t have to care about it.
Did your code written in 0.9.1 doing the translating by your self?
If so, I think you can delete the codes and use the axis dispatched from engine, because it is done by engine.

Oh, because we translate the axis according the orientation, then the developer don’t have to care about it.
Did your code written in 0.9.1 doing the translating by your self?
If so, I think you can delete the codes and use the axis dispatched from engine, because it is done by engine.

Now the axis of your codes is:

  1. Engine translate the axis according the orientation.
  2. Your code translate the axis to original value(the coordinate direction is not changed though the orientation changed).
  3. Your code translate axis according the orientation.

I think you can remove 2 and 3.

It is nice, if accelerometer values are converted according to orientation, but unfortunately I had to revert to the 0.9.1 because of another problem of 0.9.2 - see http://www.cocos2d-x.org/boards/6/topics/4714?r=4749#message-4749