The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/wmr: Rename variables and tidy code (NFC)

+23 -15
+15 -12
src/xrt/drivers/wmr/wmr_hmd.c
··· 147 147 vec3_from_hololens_gyro(wh->packet.gyro, i, &wh->raw_gyro); 148 148 vec3_from_hololens_accel(wh->packet.accel, i, &wh->raw_accel); 149 149 150 - os_mutex_lock(&wh->fusion_mutex); 151 - m_imu_3dof_update(&wh->fusion, wh->packet.gyro_timestamp[i] * WMR_MS_HOLOLENS_NS_PER_TICK, 152 - &wh->raw_accel, &wh->raw_gyro); 153 - os_mutex_unlock(&wh->fusion_mutex); 150 + os_mutex_lock(&wh->fusion.mutex); 151 + m_imu_3dof_update( // 152 + &wh->fusion.i3dof, // 153 + wh->packet.gyro_timestamp[i] * WMR_MS_HOLOLENS_NS_PER_TICK, // 154 + &wh->raw_accel, // 155 + &wh->raw_gyro); // 156 + os_mutex_unlock(&wh->fusion.mutex); 154 157 } 155 158 break; 156 159 case WMR_MS_HOLOLENS_MSG_UNKNOWN_05: ··· 370 373 // Clear relation. 371 374 U_ZERO(out_relation); 372 375 373 - os_mutex_lock(&wh->fusion_mutex); 374 - out_relation->pose.orientation = wh->fusion.rot; 375 - os_mutex_unlock(&wh->fusion_mutex); 376 + os_mutex_lock(&wh->fusion.mutex); 377 + out_relation->pose.orientation = wh->fusion.i3dof.rot; 378 + os_mutex_unlock(&wh->fusion.mutex); 376 379 377 380 out_relation->relation_flags = (enum xrt_space_relation_flags)( // 378 381 XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | // ··· 426 429 } 427 430 428 431 // Destroy the fusion. 429 - m_imu_3dof_close(&wh->fusion); 432 + m_imu_3dof_close(&wh->fusion.i3dof); 430 433 431 - os_mutex_destroy(&wh->fusion_mutex); 434 + os_mutex_destroy(&wh->fusion.mutex); 432 435 433 436 free(wh); 434 437 } ··· 463 466 snprintf(wh->base.str, XRT_DEVICE_NAME_LEN, "HP Reverb VR Headset"); 464 467 465 468 // Mutex before thread. 466 - ret = os_mutex_init(&wh->fusion_mutex); 469 + ret = os_mutex_init(&wh->fusion.mutex); 467 470 if (ret != 0) { 468 471 WMR_ERROR(wh, "Failed to init mutex!"); 469 472 wmr_hmd_destroy(&wh->base); ··· 511 514 return NULL; 512 515 } 513 516 514 - m_imu_3dof_init(&wh->fusion, M_IMU_3DOF_USE_GRAVITY_DUR_20MS); 517 + m_imu_3dof_init(&wh->fusion.i3dof, M_IMU_3DOF_USE_GRAVITY_DUR_20MS); 515 518 516 519 // Setup variable tracker. 517 520 u_var_add_root(wh, "WMR HMD", true); 518 521 u_var_add_gui_header(wh, &wh->gui.fusion, "3DoF Fusion"); 519 - m_imu_3dof_add_vars(&wh->fusion, wh, ""); 522 + m_imu_3dof_add_vars(&wh->fusion.i3dof, wh, ""); 520 523 u_var_add_gui_header(wh, &wh->gui.misc, "Misc"); 521 524 u_var_add_log_level(wh, &wh->log_level, "log_level"); 522 525
+8 -3
src/xrt/drivers/wmr/wmr_hmd.h
··· 72 72 struct xrt_vec3 raw_accel; 73 73 struct xrt_vec3 raw_gyro; 74 74 75 - struct os_mutex fusion_mutex; 76 - //! Protected by @ref fusion_mutex. 77 - struct m_imu_3dof fusion; 75 + struct 76 + { 77 + //! Protects all members of the `fusion` substruct. 78 + struct os_mutex mutex; 79 + 80 + //! Main fusion calculator. 81 + struct m_imu_3dof i3dof; 82 + } fusion; 78 83 79 84 struct 80 85 {