···1212#include "util/u_debug.h"
1313#include "util/u_logging.h"
1414#include "wmr_controller_protocol.h"
1515+#include <stdint.h>
15161617/*
1718 *
···115116 vec3_from_wmr_controller_gyro(gyro, &decoded_input->imu.gyro);
116117117118118118- uint32_t prev_ticks = decoded_input->imu.timestamp_ticks & 0xFFFFFFFFUL;
119119+ uint32_t prev_ticks = decoded_input->imu.timestamp_ticks & UINT32_C(0xFFFFFFFF);
119120120121 // Write the new ticks value into the lower half of timestamp_ticks
121121- decoded_input->imu.timestamp_ticks &= (0xFFFFFFFFUL << 32);
122122+ decoded_input->imu.timestamp_ticks &= (UINT64_C(0xFFFFFFFF) << 32u);
122123 decoded_input->imu.timestamp_ticks += (uint32_t)read32(&p);
123124124124- if ((decoded_input->imu.timestamp_ticks & 0xFFFFFFFFUL) < prev_ticks) {
125125+ if ((decoded_input->imu.timestamp_ticks & UINT64_C(0xFFFFFFFF)) < prev_ticks) {
125126 // Timer overflow, so increment the upper half of timestamp_ticks
126126- decoded_input->imu.timestamp_ticks += (0x1UL << 32);
127127+ decoded_input->imu.timestamp_ticks += (UINT64_C(0x1) << 32u);
127128 }
128129129130 /* Todo: More decoding here
+1-1
src/xrt/drivers/wmr/wmr_hmd.c
···762762 "Sleep until the HMD display is powered up, so the available displays can be enumerated by the host "
763763 "system.");
764764765765- os_nanosleep(3L * U_TIME_1S_IN_NS);
765765+ os_nanosleep(3LL * U_TIME_1S_IN_NS);
766766767767 return 0;
768768}
+5-4
src/xrt/drivers/wmr/wmr_source.c
···23232424#include <assert.h>
2525#include <stdio.h>
2626+#include <inttypes.h>
26272728#define WMR_SOURCE_STR "WMR Source"
2829···9192 struct wmr_source *ws = container_of(sink, struct wmr_source, left_sink);
9293 ws->cam_hw2mono = ws->hw2mono; // We want the right frame to use the same offset
9394 xf->timestamp += ws->cam_hw2mono;
9494- WMR_TRACE(ws, "left img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp);
9595+ WMR_TRACE(ws, "left img t=%" PRId64 " source_t=%" PRId64, xf->timestamp, xf->source_timestamp);
9596 u_sink_debug_push_frame(&ws->ui_left_sink, xf);
9697 if (ws->out_sinks.cams[0] && ws->first_imu_received) {
9798 xrt_sink_push_frame(ws->out_sinks.cams[0], xf);
···103104{
104105 struct wmr_source *ws = container_of(sink, struct wmr_source, right_sink);
105106 xf->timestamp += ws->cam_hw2mono;
106106- WMR_TRACE(ws, "right img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp);
107107+ WMR_TRACE(ws, "right img t=%" PRId64 " source_t=%" PRId64, xf->timestamp, xf->source_timestamp);
107108 u_sink_debug_push_frame(&ws->ui_right_sink, xf);
108109 if (ws->out_sinks.cams[1] && ws->first_imu_received) {
109110 xrt_sink_push_frame(ws->out_sinks.cams[1], xf);
···117118118119 // Convert hardware timestamp into monotonic clock. Update offset estimate hw2mono.
119120 // Note this is only done with IMU samples as they have the smallest USB transmission time.
120120- const double IMU_FREQ = 250; //!< @todo use 1000 if "average_imus" is false
121121+ const float IMU_FREQ = 250.f; //!< @todo use 1000 if "average_imus" is false
121122 timepoint_ns now_hw = s->timestamp_ns;
122123 timepoint_ns now_mono = (timepoint_ns)os_monotonic_get_ns();
123124 s->timestamp_ns = m_clock_offset_a2b(IMU_FREQ, now_hw, now_mono, &ws->hw2mono);
···125126 timepoint_ns ts = s->timestamp_ns;
126127 struct xrt_vec3_f64 a = s->accel_m_s2;
127128 struct xrt_vec3_f64 w = s->gyro_rad_secs;
128128- 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);
129129+ 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);
129130130131 // Push to debug UI
131132 struct xrt_vec3 gyro = {(float)w.x, (float)w.y, (float)w.z};