Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ac' into AC2
Browse files Browse the repository at this point in the history
# Conflicts:
#	include/librealsense2/h/rs_types.h
#	src/l500/l500-depth.cpp
#	src/l500/l500-device.cpp
#	src/rs.cpp
#	src/types.cpp
#	tools/realsense-viewer/realsense-viewer.cpp
  • Loading branch information
maloel committed Jun 23, 2020
2 parents 0316b7c + ee3f2ab commit caf395e
Show file tree
Hide file tree
Showing 97 changed files with 6,475 additions and 684 deletions.
4 changes: 4 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(COMMON_SRC
"${CMAKE_CURRENT_LIST_DIR}/model-views.cpp"
"${CMAKE_CURRENT_LIST_DIR}/notifications.h"
"${CMAKE_CURRENT_LIST_DIR}/notifications.cpp"
"${CMAKE_CURRENT_LIST_DIR}/calibration-model.h"
"${CMAKE_CURRENT_LIST_DIR}/calibration-model.cpp"
"${CMAKE_CURRENT_LIST_DIR}/viewer.h"
"${CMAKE_CURRENT_LIST_DIR}/viewer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ux-window.h"
Expand All @@ -23,6 +25,8 @@ set(COMMON_SRC
"${CMAKE_CURRENT_LIST_DIR}/fw-update-helper.cpp"
"${CMAKE_CURRENT_LIST_DIR}/metadata-helper.h"
"${CMAKE_CURRENT_LIST_DIR}/metadata-helper.cpp"
"${CMAKE_CURRENT_LIST_DIR}/output-model.h"
"${CMAKE_CURRENT_LIST_DIR}/output-model.cpp"
"${CMAKE_CURRENT_LIST_DIR}/skybox.h"
"${CMAKE_CURRENT_LIST_DIR}/skybox.cpp"
"${CMAKE_CURRENT_LIST_DIR}/measurement.h"
Expand Down
498 changes: 498 additions & 0 deletions common/calibration-model.cpp

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions common/calibration-model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

#include <librealsense2/rs.hpp>
#include "ux-window.h"

namespace librealsense
{
struct float3x3;
}

namespace rs2
{
class calibration_model
{
public:
calibration_model(rs2::device dev);

bool supports();

void update(ux_window& window, std::string& error_message);

void open() { to_open = true; }

private:
void draw_float4x4(std::string name, librealsense::float3x3& feild, const librealsense::float3x3& original, bool& changed);
void draw_float(std::string name, float& x, const float& orig, bool& changed);

rs2::device dev;
bool to_open = false;
bool _accept = false;

std::vector<uint8_t> _calibration;
std::vector<uint8_t> _original;

int selected_resolution = 0;
};
}
12 changes: 6 additions & 6 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace rs2

auto flash = upd.create_flash_backup([&](const float progress)
{
_progress = ((ceil(progress * 5) / 5) * (30 - next_progress)) + next_progress;
_progress = int((ceil(progress * 5) / 5) * (30 - next_progress)) + next_progress;
});

auto temp = get_folder_path(special_folder::app_data);
Expand All @@ -221,7 +221,7 @@ namespace rs2
if (!check_for([this, serial, &dfu]() {
auto devs = _ctx.query_devices();

for (int j = 0; j < devs.size(); j++)
for (uint32_t j = 0; j < devs.size(); j++)
{
try
{
Expand Down Expand Up @@ -267,7 +267,7 @@ namespace rs2

dfu.update(_fw, [&](const float progress)
{
_progress = (ceil(progress * 10) / 10 * (90 - next_progress)) + next_progress;
_progress = int((ceil(progress * 10) / 10 * (90 - next_progress)) + next_progress);
});

log("Firmware Download completed, await DFU transition event");
Expand All @@ -279,15 +279,15 @@ namespace rs2
auto upd = _dev.as<updatable>();
upd.update_unsigned(_fw, [&](const float progress)
{
_progress = (ceil(progress * 10) / 10 * (90 - next_progress)) + next_progress;
_progress = int((ceil(progress * 10) / 10 * (90 - next_progress)) + next_progress);
});
log("Firmware Update completed, waiting for device to reconnect");
}

if (!check_for([this, serial, &dfu]() {
auto devs = _ctx.query_devices();

for (int j = 0; j < devs.size(); j++)
for (uint32_t j = 0; j < devs.size(); j++)
{
try
{
Expand Down Expand Up @@ -341,7 +341,7 @@ namespace rs2

ImGui::SetCursorScreenPos({ float(x + 9), float(y + height - 67) });

ImGui::PushStyleColor(ImGuiCol_Text, alpha(light_grey, 1. - t));
ImGui::PushStyleColor(ImGuiCol_Text, alpha(light_grey, 1.f - t));

if (update_state == RS2_FWU_STATE_INITIAL_PROMPT)
ImGui::Text("Firmware updates offer critical bug fixes and\nunlock new camera capabilities.");
Expand Down
22 changes: 11 additions & 11 deletions common/measurement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ void measurement::add_point(interest_point p)
state.polygons.clear();
}

int last = state.points.size();
if (current_hovered_point == -1 ||
int last = int(state.points.size());
if (current_hovered_point == -1 ||
current_hovered_point >= state.points.size())
{
state.points.push_back(p);
Expand Down Expand Up @@ -122,7 +122,7 @@ void measurement::add_point(interest_point p)
log_function(to_string() << "Measured distance of " << length_to_string(dist.length()));
}

last_hovered_point = state.points.size() - 1;
last_hovered_point = int(state.points.size() - 1);

commit_state();
}
Expand Down Expand Up @@ -186,18 +186,18 @@ void draw_sphere(const float3& pos, float r, int lats, int longs)
{
for(int i = 0; i <= lats; i++)
{
float lat0 = M_PI * (-0.5 + (float) (i - 1) / lats);
float lat0 = float(M_PI) * (-0.5f + (float) (i - 1) / lats);
float z0 = sin(lat0);
float zr0 = cos(lat0);

float lat1 = M_PI * (-0.5 + (float) i / lats);
float lat1 = float(M_PI) * (-0.5f + (float) i / lats);
float z1 = sin(lat1);
float zr1 = cos(lat1);

glBegin(GL_QUAD_STRIP);
for(int j = 0; j <= longs; j++)
{
float lng = 2 * M_PI * (float) (j - 1) / longs;
float lng = 2.f * float(M_PI) * (float) (j - 1) / longs;
float x = cos(lng);
float y = sin(lng);

Expand Down Expand Up @@ -305,7 +305,7 @@ void measurement::draw_ruler(ux_window& win, float3 from, float3 to, float heigh
// calculate center of the ruler line
float3 ctr = from + (to - from) / 2;
float distance = (to - from).length();
draw_label(win, ctr, distance, height);
draw_label(win, ctr, distance, int(height));
}
}

Expand Down Expand Up @@ -352,7 +352,7 @@ void measurement::update_input(ux_window& win, const rs2::rect& viewer_rect)
if (rect_copy.contains(win.get_mouse().cursor))
{
input_ctrl.click = true;
input_ctrl.click_time = glfwGetTime();
input_ctrl.click_time = float(glfwGetTime());
}
}
}
Expand Down Expand Up @@ -478,8 +478,8 @@ void measurement::draw(ux_window& win)
const int segments = 50;
for (int i = 0; i < segments; i++)
{
auto t1 = 2 * M_PI * ((float)i / segments);
auto t2 = 2 * M_PI * ((float)(i+1) / segments);
auto t1 = 2.f * float(M_PI) * ((float)i / segments);
auto t2 = 2.f * float(M_PI) * ((float)(i+1) / segments);
float4 xy1 { cosf(t1) * size, sinf(t1) * size, 0.f, 1.f };
xy1 = basis * xy1;
xy1 = float4 { _picked.x + xy1.x, _picked.y + xy1.y, _picked.z + xy1.z, 1.f };
Expand Down Expand Up @@ -556,7 +556,7 @@ void measurement::draw(ux_window& win)

auto area = calculate_area(points);

draw_label(win, mid, area, win.framebuf_height(), true);
draw_label(win, mid, area, int(win.framebuf_height()), true);
}

for (int i = 0; i < state.edges.size(); i++)
Expand Down
4 changes: 2 additions & 2 deletions common/measurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ namespace rs2
double selection_started = 0.0;
float2 down_pos { 0.f, 0.f };
int mouse_wheel = 0;
double click_time = 0.0;
float click_period() { return clamp((glfwGetTime() - click_time) * 10, 0.f, 1.f); }
float click_time = 0.f;
float click_period() { return clamp(float(glfwGetTime() - click_time) * 10, 0.f, 1.f); }
};
mouse_control input_ctrl;
int id = 0;
Expand Down
8 changes: 5 additions & 3 deletions common/metadata-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace rs2
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time

for (int i = 0; i < cSubKeys; i++)
for (auto i = 0ul; i < cSubKeys; i++)
{
TCHAR achKey[MAX_KEY_LENGTH];
DWORD cbName = MAX_KEY_LENGTH;
Expand All @@ -133,7 +133,8 @@ namespace rs2
{
std::wstring suffix = achKey;
device_id rdid;
if (parse_device_id(std::string(suffix.begin(), suffix.end()), &rdid))
auto a = std::string(suffix.begin(), suffix.end());
if (parse_device_id(a, &rdid))
{
for (auto&& did : kvp.second)
{
Expand Down Expand Up @@ -223,6 +224,7 @@ namespace rs2
CloseHandle(sei.hProcess);
if (exitCode)
throw std::runtime_error("Failed to set metadata registry keys!");
return true;
}
}
else
Expand Down Expand Up @@ -287,7 +289,7 @@ namespace rs2

rs2::context ctx;
auto list = ctx.query_devices();
for (int i = 0; i < list.size(); i++)
for (uint32_t i = 0; i < list.size(); i++)
{
try
{
Expand Down
Loading

0 comments on commit caf395e

Please sign in to comment.