The open source OpenXR runtime
0
fork

Configure Feed

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

d/wmr: Fix warnings/issues, mostly related to 32-bit builds

authored by

Ryan Pavlik and committed by
Jakob Bornecrantz
f43ac484 f230446c

+11 -9
+5 -4
src/xrt/drivers/wmr/wmr_controller_protocol.c
··· 12 12 #include "util/u_debug.h" 13 13 #include "util/u_logging.h" 14 14 #include "wmr_controller_protocol.h" 15 + #include <stdint.h> 15 16 16 17 /* 17 18 * ··· 115 116 vec3_from_wmr_controller_gyro(gyro, &decoded_input->imu.gyro); 116 117 117 118 118 - uint32_t prev_ticks = decoded_input->imu.timestamp_ticks & 0xFFFFFFFFUL; 119 + uint32_t prev_ticks = decoded_input->imu.timestamp_ticks & UINT32_C(0xFFFFFFFF); 119 120 120 121 // Write the new ticks value into the lower half of timestamp_ticks 121 - decoded_input->imu.timestamp_ticks &= (0xFFFFFFFFUL << 32); 122 + decoded_input->imu.timestamp_ticks &= (UINT64_C(0xFFFFFFFF) << 32u); 122 123 decoded_input->imu.timestamp_ticks += (uint32_t)read32(&p); 123 124 124 - if ((decoded_input->imu.timestamp_ticks & 0xFFFFFFFFUL) < prev_ticks) { 125 + if ((decoded_input->imu.timestamp_ticks & UINT64_C(0xFFFFFFFF)) < prev_ticks) { 125 126 // Timer overflow, so increment the upper half of timestamp_ticks 126 - decoded_input->imu.timestamp_ticks += (0x1UL << 32); 127 + decoded_input->imu.timestamp_ticks += (UINT64_C(0x1) << 32u); 127 128 } 128 129 129 130 /* Todo: More decoding here
+1 -1
src/xrt/drivers/wmr/wmr_hmd.c
··· 762 762 "Sleep until the HMD display is powered up, so the available displays can be enumerated by the host " 763 763 "system."); 764 764 765 - os_nanosleep(3L * U_TIME_1S_IN_NS); 765 + os_nanosleep(3LL * U_TIME_1S_IN_NS); 766 766 767 767 return 0; 768 768 }
+5 -4
src/xrt/drivers/wmr/wmr_source.c
··· 23 23 24 24 #include <assert.h> 25 25 #include <stdio.h> 26 + #include <inttypes.h> 26 27 27 28 #define WMR_SOURCE_STR "WMR Source" 28 29 ··· 91 92 struct wmr_source *ws = container_of(sink, struct wmr_source, left_sink); 92 93 ws->cam_hw2mono = ws->hw2mono; // We want the right frame to use the same offset 93 94 xf->timestamp += ws->cam_hw2mono; 94 - WMR_TRACE(ws, "left img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp); 95 + WMR_TRACE(ws, "left img t=%" PRId64 " source_t=%" PRId64, xf->timestamp, xf->source_timestamp); 95 96 u_sink_debug_push_frame(&ws->ui_left_sink, xf); 96 97 if (ws->out_sinks.cams[0] && ws->first_imu_received) { 97 98 xrt_sink_push_frame(ws->out_sinks.cams[0], xf); ··· 103 104 { 104 105 struct wmr_source *ws = container_of(sink, struct wmr_source, right_sink); 105 106 xf->timestamp += ws->cam_hw2mono; 106 - WMR_TRACE(ws, "right img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp); 107 + WMR_TRACE(ws, "right img t=%" PRId64 " source_t=%" PRId64, xf->timestamp, xf->source_timestamp); 107 108 u_sink_debug_push_frame(&ws->ui_right_sink, xf); 108 109 if (ws->out_sinks.cams[1] && ws->first_imu_received) { 109 110 xrt_sink_push_frame(ws->out_sinks.cams[1], xf); ··· 117 118 118 119 // Convert hardware timestamp into monotonic clock. Update offset estimate hw2mono. 119 120 // Note this is only done with IMU samples as they have the smallest USB transmission time. 120 - const double IMU_FREQ = 250; //!< @todo use 1000 if "average_imus" is false 121 + const float IMU_FREQ = 250.f; //!< @todo use 1000 if "average_imus" is false 121 122 timepoint_ns now_hw = s->timestamp_ns; 122 123 timepoint_ns now_mono = (timepoint_ns)os_monotonic_get_ns(); 123 124 s->timestamp_ns = m_clock_offset_a2b(IMU_FREQ, now_hw, now_mono, &ws->hw2mono); ··· 125 126 timepoint_ns ts = s->timestamp_ns; 126 127 struct xrt_vec3_f64 a = s->accel_m_s2; 127 128 struct xrt_vec3_f64 w = s->gyro_rad_secs; 128 - WMR_TRACE(ws, "imu t=%ld a=(%f %f %f) w=(%f %f %f)", ts, a.x, a.y, a.z, w.x, w.y, w.z); 129 + WMR_TRACE(ws, "imu t=%" PRId64 " a=(%f %f %f) w=(%f %f %f)", ts, a.x, a.y, a.z, w.x, w.y, w.z); 129 130 130 131 // Push to debug UI 131 132 struct xrt_vec3 gyro = {(float)w.x, (float)w.y, (float)w.z};