Skip to content

Commit 600ffb5

Browse files
committed
Round float values for integer options with log
1 parent aeadb0f commit 600ffb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rs.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,9 @@ void rs2_set_option(const rs2_options* options, rs2_option option, float value,
911911
if (range.min != range.max && range.step)
912912
VALIDATE_RANGE(value, range.min, range.max);
913913
if ((int)value != value)
914-
throw invalid_value_exception(rsutils::string::from() << "not an integer: " << value);
915-
option_ref.set(value);
914+
LOG_INFO("Float value " << value << " given to integer option " << rs2_get_option_name(options, option, error)
915+
<< ", rounding to " << (int)value);
916+
option_ref.set((int)value);
916917
break;
917918

918919
case RS2_OPTION_TYPE_BOOLEAN:

0 commit comments

Comments
 (0)