feat(android): update libmynteye and improve imu display
This commit is contained in:
parent
4ac353c8c1
commit
dfb2be71a6
|
@ -286,8 +286,17 @@ public class MainActivity extends BaseActivity implements CameraDialog.CameraDia
|
||||||
ImuData data = datas.get(0).imu();
|
ImuData data = datas.get(0).imu();
|
||||||
mTextView.post(() -> {
|
mTextView.post(() -> {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("Accel: ").append(data.getAccel());
|
final int flag = data.getFlag();
|
||||||
sb.append("\nGyro: ").append(data.getGyro());
|
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());
|
mTextView.setText(sb.toString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,14 +59,6 @@ std::shared_ptr<Device> Device::Create(const ::mynteye_jni::DeviceUsbInfo & info
|
||||||
auto pid = uvc::get_product_id(*device);
|
auto pid = uvc::get_product_id(*device);
|
||||||
VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex
|
VLOG(2) << "UVC device detected, name: " << name << ", vid: 0x" << std::hex
|
||||||
<< vid << ", pid: 0x" << std::hex << pid;
|
<< 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>(
|
return std::make_shared<DeviceImpl>(
|
||||||
MYNTEYE_NAMESPACE::Device::Create(name, device));
|
MYNTEYE_NAMESPACE::Device::Create(name, device));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ namespace uvc {
|
||||||
struct device;
|
struct device;
|
||||||
|
|
||||||
MYNTEYE_API std::shared_ptr<device> create_device(UsbInfo info);
|
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
|
} // namespace uvc
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user