예제 #1
0
void MPU9150::device_setup(){
  //Todo: Read calibration values from EPROM
  Wire.begin();
  MPU.selectDevice(MPUDeviceId);
  //  MAG fusion temprorarily disabled until we dial in the noisy MAG readings
  if (!MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_ONLY, MAG_UPDATE_RATE, MPU_LPF_RATE)){
	Serial.println(F("log:Trying other MPU9150 address to init;"));
	Serial.print(F("log:IMU Address was :"));
	Serial.print(1);
	MPUDeviceId = !MPUDeviceId;
	Serial.print(F(" but is now:"));
	Serial.print(MPUDeviceId);
	Serial.println(";");
	MPU.selectDevice(MPUDeviceId);
	if (MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_ONLY, MAG_UPDATE_RATE, MPU_LPF_RATE)){
		DidInit = true;
		Serial.println(F("log:Init worked the second time;"));
	} else {
		Serial.println(F("log:Failed to init on both addresses;"));
	}
  } else {
	DidInit = true;
	Serial.println(F("log:init on primary addresses;"));
  }                             // start the MPU
  Settings::capability_bitarray |= (1 << COMPASS_CAPABLE);
  Settings::capability_bitarray |= (1 << ORIENTATION_CAPABLE);
  MPU9150ReInit.reset();
}
예제 #2
0
void MPU9150::device_setup(){
  //Todo: Read calibration values from EPROM
  Wire.begin();
  MPU.selectDevice(1);
  MPU.init(MPU_UPDATE_RATE);                             // start the MPU
  Settings::capability_bitarray |= (1 << COMPASS_CAPABLE);
  Settings::capability_bitarray |= (1 << ORIENTATION_CAPABLE);
}