Skip to content

Commit 266acce

Browse files
committed
raise rotation threshold
1 parent add28b5 commit 266acce

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#define DETECTION_THRESHOLD 25
3838
// How many abnormal rotations to receive before we consider it valid
3939
#define RESET_THRESHOLD 75
40+
// Invalid rotation threshold in radians
41+
#define ROTATION_THRESHOLD 0.52f
4042

4143
// TODO: move to esb
4244
extern uint8_t stored_trackers;

src/hid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ void hid_write_packet_n(uint8_t *data, uint8_t rssi)
294294
uint8_t *cur_p = &cur_p_trackers[data[1]];
295295
float mag = q_diff_mag(q, last_q); // difference between last valid
296296
float mag_cur = q_diff_mag(q, cur_q); // difference between last received
297-
bool mag_invalid = mag > 0.26f && mag < 6.28f - 0.26f; // possibly invalid rotation
298-
bool mag_cur_invalid = mag_cur > 0.26f && mag_cur < 6.28f - 0.26f; // possibly inconsistent rotation
297+
bool mag_invalid = mag > ROTATION_THRESHOLD && mag < 6.28f - ROTATION_THRESHOLD; // possibly invalid rotation
298+
bool mag_cur_invalid = mag_cur > ROTATION_THRESHOLD && mag_cur < 6.28f - ROTATION_THRESHOLD; // possibly inconsistent rotation
299299
if (mag_invalid && !last_invalid)
300300
{
301301
if (!mag_cur_invalid && last_valid_trackers[data[1]] >= RESET_THRESHOLD - 1)

0 commit comments

Comments
 (0)