Skip to content

Commit

Permalink
PR IntelRealSense#12798 from noacoohen: Fix IMU back compat for D457
Browse files Browse the repository at this point in the history
(cherry picked from commit 46b2b79)
  • Loading branch information
Nir-Az committed Mar 26, 2024
1 parent 293fcae commit 5074ec3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
13 changes: 13 additions & 0 deletions src/platform/hid-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ struct hid_data


struct hid_mipi_data
{
uint8_t typeID;
uint8_t skip1;
uint64_t hwTs;
int16_t x;
int16_t y;
int16_t z;
uint64_t hwTs2;
uint64_t skip2;
};


struct hid_mipi_data_32
{
uint8_t typeID;
uint8_t skip1;
Expand Down
18 changes: 8 additions & 10 deletions src/proc/motion-transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ namespace librealsense

if (is_mipi)
{
auto hid = (hid_mipi_data*)(source);

if( ! high_accuracy )
if( ! high_accuracy )
{
//since D400 FW version 5.16 the hid report struct changed to 32 bit for each paramater.
//To support older FW versions we convert the data to int16_t before casting to float as we only get valid data at the lower 16 bits.
hid->x = static_cast< int16_t >( hid->x );
hid->y = static_cast< int16_t >( hid->y );
hid->z = static_cast< int16_t >( hid->z );
auto hid = (hid_mipi_data *)( source );
res = float3{ float( hid->x ), float( hid->y ), float( hid->z ) } * float( factor );
}
else
{
auto hid = (hid_mipi_data_32 *)( source );
res = float3{ float( hid->x ), float( hid->y ), float( hid->z ) } * float( factor );
}

res = float3{ float( hid->x ), float( hid->y ), float( hid->z ) } * float( factor );
}
else
{
Expand Down

0 comments on commit 5074ec3

Please sign in to comment.