fix(channels):update control infos by model
This commit is contained in:
parent
5800e1c6c8
commit
b5a61075df
|
@ -169,13 +169,15 @@ enum class Option : std::uint8_t {
|
||||||
/**
|
/**
|
||||||
* Max gain, valid if auto-exposure
|
* Max gain, valid if auto-exposure
|
||||||
*
|
*
|
||||||
* range: [0,255], default: 8
|
* range of standard 1: [0,48], default: 48
|
||||||
|
* range of standard 2: [0,255], default: 8
|
||||||
*/
|
*/
|
||||||
MAX_GAIN,
|
MAX_GAIN,
|
||||||
/**
|
/**
|
||||||
* Max exposure time, valid if auto-exposure
|
* Max exposure time, valid if auto-exposure
|
||||||
*
|
*
|
||||||
* range: [0,1000], default: 333
|
* range of standard 1: [0,240], default: 240
|
||||||
|
* range of standard 2: [0,1000], default: 333
|
||||||
*/
|
*/
|
||||||
MAX_EXPOSURE_TIME,
|
MAX_EXPOSURE_TIME,
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +189,8 @@ enum class Option : std::uint8_t {
|
||||||
/**
|
/**
|
||||||
* Desired brightness, valid if auto-exposure
|
* Desired brightness, valid if auto-exposure
|
||||||
*
|
*
|
||||||
* range: [1,255], default: 122
|
* range of standard 1: [0,255], default: 192
|
||||||
|
* range of standard 2: [1,255], default: 122
|
||||||
*/
|
*/
|
||||||
DESIRED_BRIGHTNESS,
|
DESIRED_BRIGHTNESS,
|
||||||
|
|
||||||
|
@ -208,13 +211,15 @@ enum class Option : std::uint8_t {
|
||||||
/**
|
/**
|
||||||
* The range of accelerometer
|
* The range of accelerometer
|
||||||
*
|
*
|
||||||
* values: {6,12,24,48}, default: 6
|
* value of standard 1: 4,8,16,32}, default: 8
|
||||||
|
* value of standard 2: {6,12,24,48}, default: 6
|
||||||
*/
|
*/
|
||||||
ACCELEROMETER_RANGE,
|
ACCELEROMETER_RANGE,
|
||||||
/**
|
/**
|
||||||
* The range of gyroscope
|
* The range of gyroscope
|
||||||
*
|
*
|
||||||
* values: {250,500,1000,2000,4000}, default: 1000
|
* value of standard 1: {500,1000,2000,4000}, default: 1000
|
||||||
|
* value of standard 2: {250,500,1000,2000,4000}, default: 1000
|
||||||
*/
|
*/
|
||||||
GYROSCOPE_RANGE,
|
GYROSCOPE_RANGE,
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "mynteye/device/config.h"
|
||||||
#include "mynteye/logger.h"
|
#include "mynteye/logger.h"
|
||||||
#include "mynteye/util/strings.h"
|
#include "mynteye/util/strings.h"
|
||||||
#include "mynteye/util/times.h"
|
#include "mynteye/util/times.h"
|
||||||
|
@ -129,7 +131,7 @@ Channels::Channels(const Model &model, std::shared_ptr<uvc::device> device)
|
||||||
imu_callback_(nullptr) {
|
imu_callback_(nullptr) {
|
||||||
VLOG(2) << __func__;
|
VLOG(2) << __func__;
|
||||||
imu_res_version_ = (model == Model::STANDARD) ? 1 : 2;
|
imu_res_version_ = (model == Model::STANDARD) ? 1 : 2;
|
||||||
// UpdateControlInfos();
|
UpdateControlInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
Channels::~Channels() {
|
Channels::~Channels() {
|
||||||
|
@ -145,18 +147,24 @@ void Channels::LogControlInfos() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(Kalman): Compatible with two generation
|
|
||||||
void Channels::UpdateControlInfos() {
|
void Channels::UpdateControlInfos() {
|
||||||
for (auto &&option : std::vector<Option>{Option::BRIGHTNESS}) {
|
auto &&supports = option_supports_map.at(model_);
|
||||||
|
for (auto &&option : std::vector<Option>{
|
||||||
|
Option::GAIN, Option::BRIGHTNESS,
|
||||||
|
Option::CONTRAST}) {
|
||||||
|
if (supports.find(option) != supports.end())
|
||||||
control_infos_[option] = PuControlInfo(option);
|
control_infos_[option] = PuControlInfo(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &&option : std::vector<Option>{
|
for (auto &&option : std::vector<Option>{
|
||||||
Option::EXPOSURE_MODE, Option::DESIRED_BRIGHTNESS,
|
Option::FRAME_RATE, Option::IMU_FREQUENCY,
|
||||||
Option::MAX_GAIN, Option::MAX_EXPOSURE_TIME,
|
Option::EXPOSURE_MODE, Option::MAX_GAIN,
|
||||||
Option::MIN_EXPOSURE_TIME, Option::ACCELEROMETER_RANGE,
|
Option::MAX_EXPOSURE_TIME, Option::MIN_EXPOSURE_TIME,
|
||||||
|
Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
|
||||||
|
Option::HDR_MODE, Option::ACCELEROMETER_RANGE,
|
||||||
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
|
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
|
||||||
Option::GYROSCOPE_LOW_PASS_FILTER}) {
|
Option::GYROSCOPE_LOW_PASS_FILTER}) {
|
||||||
|
if (supports.find(option) != supports.end())
|
||||||
control_infos_[option] = XuControlInfo(option);
|
control_infos_[option] = XuControlInfo(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,13 +268,25 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
|
||||||
XuCamCtrlSet(option, value);
|
XuCamCtrlSet(option, value);
|
||||||
} break;
|
} break;
|
||||||
case Option::ACCELEROMETER_RANGE: {
|
case Option::ACCELEROMETER_RANGE: {
|
||||||
|
if (model_ == Model::STANDARD) {
|
||||||
|
if (!in_range() || !in_values({4, 8, 16, 32}))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (model_ == Model::STANDARD2) {
|
||||||
if (!in_range() || !in_values({6, 12, 24, 48}))
|
if (!in_range() || !in_values({6, 12, 24, 48}))
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
XuCamCtrlSet(option, value);
|
XuCamCtrlSet(option, value);
|
||||||
} break;
|
} break;
|
||||||
case Option::GYROSCOPE_RANGE: {
|
case Option::GYROSCOPE_RANGE: {
|
||||||
|
if (model_ == Model::STANDARD) {
|
||||||
|
if (!in_range() || !in_values({500, 1000, 2000, 4000}))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (model_ == Model::STANDARD2) {
|
||||||
if (!in_range() || !in_values({250, 500, 1000, 2000, 4000}))
|
if (!in_range() || !in_values({250, 500, 1000, 2000, 4000}))
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
XuCamCtrlSet(option, value);
|
XuCamCtrlSet(option, value);
|
||||||
} break;
|
} break;
|
||||||
case Option::ACCELEROMETER_LOW_PASS_FILTER: {
|
case Option::ACCELEROMETER_LOW_PASS_FILTER: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user