Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/calibration-engine-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class calibration_engine_interface
virtual int8_t get_triggered_calibration_progress() const = 0;
virtual std::vector<uint8_t> get_calibration_table(std::vector<uint8_t>& current_calibration) const = 0;
virtual void write_calibration(std::vector<uint8_t>& calibration) const = 0;
virtual void set_calibration_table(const std::vector<uint8_t>& calibration, std::vector<uint8_t>& current_calibration) const = 0;
virtual std::string get_calibration_config() const = 0;
virtual void set_calibration_config(const std::string& calibration_config_json_str) const = 0;
};
Expand Down
12 changes: 11 additions & 1 deletion src/ds/d500/d500-auto-calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,17 @@ namespace librealsense

void d500_auto_calibrated::set_calibration_table(const std::vector<uint8_t>& calibration)
{
_calib_engine->set_calibration_table(calibration, _curr_calibration);
if (_curr_calibration.size() != sizeof(ds::table_header) && // First time setting table, only header set by get_calibration_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _curr_calibration here is same as in d500_debug_protocol_calibration_engine? Notice that d500_debug_protocol_calibration_engine::get_calibration_table still uses the member

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_valibration_table remained in the engine, because it uses the debug protocol interface.
It gets the current_calibration as param - this is the same as the one used in the set_calibration_table method:
std::vector<uint8_t> d500_auto_calibrated::get_calibration_table() const
{
return _calib_engine->get_calibration_table(_curr_calibration);
}

_curr_calibration.size() != sizeof(ds::d500_coefficients_table)) // Table was previously set
throw std::runtime_error(rsutils::string::from() <<
"Current calibration table has unexpected size " << _curr_calibration.size());

if (calibration.size() != sizeof(ds::d500_coefficients_table) - sizeof(ds::table_header))
throw std::runtime_error(rsutils::string::from() <<
"Setting calibration table with unexpected size" << calibration.size());

_curr_calibration.resize(sizeof(ds::table_header)); // Remove previously set calibration, keep header.
_curr_calibration.insert(_curr_calibration.end(), calibration.begin(), calibration.end());
}

void d500_auto_calibrated::reset_to_factory_calibration() const
Expand Down
17 changes: 1 addition & 16 deletions src/ds/d500/d500-debug-protocol-calibration-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ std::vector<uint8_t> d500_debug_protocol_calibration_engine::get_calibration_tab
if (calib.size() < sizeof(ds::table_header) + header->table_size)
throw std::runtime_error("GET_HKR_CONFIG_TABLE response is smaller then expected table size!");

// Backwards compalibility dictates that we will return the table without the header, but we need the header
// Backwards compatibility dictates that we will return the table without the header, but we need the header
// details like versions to later set back the table. Save it at the start of _curr_calibration.
current_calibration.assign(calib.begin(), calib.begin() + sizeof(ds::table_header));

Expand All @@ -140,21 +140,6 @@ void d500_debug_protocol_calibration_engine::write_calibration(std::vector<uint8
_dev->send_receive_raw_data(cmd);
}

void d500_debug_protocol_calibration_engine::set_calibration_table(const std::vector<uint8_t>& calibration, std::vector<uint8_t>& current_calibration) const
{
if (current_calibration.size() != sizeof(ds::table_header) && // First time setting table, only header set by get_calibration_table
current_calibration.size() != sizeof(ds::d500_coefficients_table)) // Table was previously set
throw std::runtime_error(rsutils::string::from() <<
"Current calibration table has unexpected size " << current_calibration.size());

if (calibration.size() != sizeof(ds::d500_coefficients_table) - sizeof(ds::table_header))
throw std::runtime_error(rsutils::string::from() <<
"Setting calibration table with unexpected size" << calibration.size());

current_calibration.resize(sizeof(ds::table_header)); // Remove previously set calibration, keep header.
current_calibration.insert(current_calibration.end(), calibration.begin(), calibration.end());
}

std::string d500_debug_protocol_calibration_engine::get_calibration_config() const
{
calibration_config_with_header* result;
Expand Down
1 change: 0 additions & 1 deletion src/ds/d500/d500-debug-protocol-calibration-engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class d500_debug_protocol_calibration_engine : public calibration_engine_interfa
virtual int8_t get_triggered_calibration_progress() const override;
virtual std::vector<uint8_t> get_calibration_table(std::vector<uint8_t>& current_calibration) const override;
virtual void write_calibration(std::vector<uint8_t>& calibration) const override;
virtual void set_calibration_table(const std::vector<uint8_t>& calibration, std::vector<uint8_t>& current_calibration) const override;
virtual std::string get_calibration_config() const override;
virtual void set_calibration_config(const std::string& calibration_config_json_str) const override;
ds::d500_coefficients_table get_depth_calibration() const;
Expand Down