{"action":"opened","issue":{"url":"https://api.github.com/repos/DFRobot/DFRobot_BMI160/issues/1","repository_url":"https://api.github.com/repos/DFRobot/DFRobot_BMI160","labels_url":"https://api.github.com/repos/DFRobot/DFRobot_BMI160/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/DFRobot/DFRobot_BMI160/issues/1/comments","events_url":"https://api.github.com/repos/DFRobot/DFRobot_BMI160/issues/1/events","html_url":"https://github.com/DFRobot/DFRobot_BMI160/issues/1","id":339485187,"node_id":"MDU6SXNzdWUzMzk0ODUxODc=","number":1,"title":"Minor correction in .cpp file","user":{"login":"renr3","id":39769942,"node_id":"MDQ6VXNlcjM5NzY5OTQy","avatar_url":"https://avatars0.githubusercontent.com/u/39769942?v=4","gravatar_id":"","url":"https://api.github.com/users/renr3","html_url":"https://github.com/renr3","followers_url":"https://api.github.com/users/renr3/followers","following_url":"https://api.github.com/users/renr3/following{/other_user}","gists_url":"https://api.github.com/users/renr3/gists{/gist_id}","starred_url":"https://api.github.com/users/renr3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renr3/subscriptions","organizations_url":"https://api.github.com/users/renr3/orgs","repos_url":"https://api.github.com/users/renr3/repos","events_url":"https://api.github.com/users/renr3/events{/privacy}","received_events_url":"https://api.github.com/users/renr3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-09T14:56:52Z","updated_at":"2018-07-09T14:56:52Z","closed_at":null,"author_association":"NONE","body":"Hello! First of all, great library. While using the function getSensorData, to get only acceleration or gyro data (not both together), I noticed an unexpected behaviour: the values were always constant.\r\nLooking through the source code, I noticed in the .cpp file needed a minor correction in the function getSensorData, that I posted below, on the bolded/italic parts. They need to be changed with each other for correct behaviour. \r\n\r\nWhat do you guys think?\r\n\r\nBest regards\r\n\r\n\r\n`int8_t DFRobot_BMI160::getSensorData(uint8_t type, int16_t* data)\r\n{\r\n  int8_t rslt=BMI160_OK;\r\n  if (type==onlyAccel){\r\n    rslt = getSensorData(BMI160_ACCEL_SEL, Oaccel, NULL, Obmi160);\r\n    if(rslt == BMI160_OK){\r\n      **_data[0]=Ogyro->x;\r\n      data[1]=Ogyro->y;\r\n      data[2]=Ogyro->z;_**\r\n    }\r\n  }else if(type==onlyGyro){\r\n    rslt = getSensorData(BMI160_GYRO_SEL, NULL, Ogyro, Obmi160); \r\n    if(rslt == BMI160_OK){\r\n      _**data[0]=Oaccel->x;\r\n      data[1]=Oaccel->y;\r\n      data[2]=Oaccel->z;**_\r\n    }\r\n  }else if(type==bothAccelGyro){\r\n    rslt = DFRobot_BMI160::getSensorData((BMI160_ACCEL_SEL | BMI160_GYRO_SEL),Oaccel, Ogyro, Obmi160);\r\n    if(rslt == BMI160_OK){\r\n      data[0]=Ogyro->x;\r\n      data[1]=Ogyro->y;\r\n      data[2]=Ogyro->z;\r\n      data[3]=Oaccel->x;\r\n      data[4]=Oaccel->y;\r\n      data[5]=Oaccel->z;\r\n    } \r\n  }else{\r\n    rslt = BMI160_ERR_CHOOSE; \r\n  }\r\n   \r\n  return rslt;\r\n}` "}}
{"actor":{"display_login":"renr3"}}