File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,13 @@ int main() {
146
146
float pos_offset_x = 0 ;
147
147
float pos_offset_y = 0 ;
148
148
149
+ // get the pitch min and max, and shift them to be centered around 0
150
+ float pitch_min = config->set_reference_limits [4 ][0 ][0 ];
151
+ float pitch_max = config->set_reference_limits [4 ][0 ][1 ];
152
+ float pitch_average = 0.5 * (pitch_min + pitch_max);
153
+ pitch_min -= pitch_average;
154
+ pitch_max -= pitch_average;
155
+
149
156
// param to specify whether this is the first loop
150
157
int count_one = 0 ;
151
158
@@ -198,6 +205,10 @@ int main() {
198
205
vtm_pos_x += ref->ref_data .kbm_interaction .mouse_speed_x * 0.05 * delta;
199
206
vtm_pos_y += ref->ref_data .kbm_interaction .mouse_speed_y * 0.05 * delta;
200
207
208
+ // clamp to pitch limits
209
+ if (dr16_pos_y < pitch_min) { dr16_pos_y = pitch_min; }
210
+ if (dr16_pos_y > pitch_max) { dr16_pos_y = pitch_max; }
211
+
201
212
float chassis_vel_x = 0 ;
202
213
float chassis_vel_y = 0 ;
203
214
float chassis_pos_x = 0 ;
Original file line number Diff line number Diff line change 9
9
#include <fts.h> // FTS stuff
10
10
11
11
/// @brief Max path size for the serial device
12
- #define PATH_MAX 4096
12
+ #define SERIAL_PATH_MAX 4096
13
13
14
14
/// @brief Size of the serial buffers
15
15
const size_t read_size = 8ul * 1024ul ;
16
16
17
17
/// @brief Max size of the serial path, - 1 for null terminator
18
- const size_t SERIAL_PATH_SIZE = PATH_MAX - 1 ;
18
+ const size_t SERIAL_PATH_SIZE = SERIAL_PATH_MAX - 1 ;
19
19
20
20
/// @brief In serial buffer
21
21
char * in_buffer = NULL ;
You can’t perform that action at this time.
0 commit comments