From 519b28224ea39ea0f42cdf83dd7b1e67b4b3caf3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 20 Dec 2018 21:07:24 +0100 Subject: tracker/wii: fix function-static data --- tracker-wii/wii_camera.cpp | 10 ++++------ tracker-wii/wii_camera.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'tracker-wii') diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp index c8276796..4054523a 100644 --- a/tracker-wii/wii_camera.cpp +++ b/tracker-wii/wii_camera.cpp @@ -282,16 +282,14 @@ void WIICamera::get_status(struct wii_info& wii) wii.bBatteryDrained = m_pDev->bBatteryDrained; //draw horizon - static int p = 0; - static int r = 0; if (m_pDev->Nunchuk.Acceleration.Orientation.UpdateAge < 10) { - p = m_pDev->Acceleration.Orientation.Pitch; - r = m_pDev->Acceleration.Orientation.Roll; + horizon.p = m_pDev->Acceleration.Orientation.Pitch; + horizon.r = m_pDev->Acceleration.Orientation.Roll; } - wii.Pitch = p; - wii.Roll = r; + wii.Pitch = horizon.p; + wii.Roll = horizon.r; } void WIICamera::on_state_change(wiimote &remote, diff --git a/tracker-wii/wii_camera.h b/tracker-wii/wii_camera.h index fb864548..3b67b286 100644 --- a/tracker-wii/wii_camera.h +++ b/tracker-wii/wii_camera.h @@ -64,6 +64,7 @@ private: pt_camera_info cam_info; pt_camera_info cam_desired; QString desired_name, active_name; + struct { float p = 0, r = 0; } horizon; pt_settings s; -- cgit v1.2.3