feat(android): update libmynteye and improve imu display

This commit is contained in:
John Zhao 2019-03-04 10:48:27 +08:00
parent 4ac353c8c1
commit dfb2be71a6
5 changed files with 13 additions and 11 deletions

View File

@ -286,8 +286,17 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia
ImuData data = datas.get(0).imu();
mTextView.post(() -> {
StringBuffer sb = new StringBuffer();
final int flag = data.getFlag();
if (flag == 0) { // accel & gyro
sb.append("Accel: ").append(data.getAccel());
sb.append("\nGyro: ").append(data.getGyro());
} else if (flag == 1) { // accel
sb.append("Accel: ").append(data.getAccel());
sb.append("\nGyro: -");
} else if (flag == 2) { // gyro
sb.append("Accel: -");
sb.append("\nGyro: ").append(data.getGyro());
}
mTextView.setText(sb.toString());
});
}

View File

@ -59,14 +59,6 @@ std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info
auto pid = uvc::get_product_id(*device);
VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex
<< vid << ", pid: 0x" << std::hex << pid;
if (strings::starts_with(name, "MYNT-EYE-")) {
std::string model_s = name.substr(9, 5);
if (strings::starts_with(model_s, "S1")) {
uvc::set_bytes_per_packet(device, 0x4000);
} else if (strings::starts_with(model_s, "S2")) {
uvc::set_bytes_per_packet(device, 0x5400);
}
}
return std::make_shared<DeviceImpl>(
MYNTEYE_NAMESPACE::Device::Create(name, device));
}

View File

@ -9,7 +9,8 @@ namespace uvc {
struct device;
MYNTEYE_API std::shared_ptr<device> create_device(UsbInfo info);
MYNTEYE_API void set_bytes_per_packet(std::shared_ptr<device>, int bytes);
MYNTEYE_API void set_bytes_per_packet(int bytes);
} // namespace uvc