Skip to content

Commit 3a5ca39

Browse files
committed
Merge branch 'main' into feature-logger
2 parents a67d75a + 33fb988 commit 3a5ca39

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ int main() {
146146
float pos_offset_x = 0;
147147
float pos_offset_y = 0;
148148

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+
149156
// param to specify whether this is the first loop
150157
int count_one = 0;
151158

@@ -198,6 +205,10 @@ int main() {
198205
vtm_pos_x += ref->ref_data.kbm_interaction.mouse_speed_x * 0.05 * delta;
199206
vtm_pos_y += ref->ref_data.kbm_interaction.mouse_speed_y * 0.05 * delta;
200207

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+
201212
float chassis_vel_x = 0;
202213
float chassis_vel_y = 0;
203214
float chassis_pos_x = 0;

tools/monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#include <fts.h> // FTS stuff
1010

1111
/// @brief Max path size for the serial device
12-
#define PATH_MAX 4096
12+
#define SERIAL_PATH_MAX 4096
1313

1414
/// @brief Size of the serial buffers
1515
const size_t read_size = 8ul * 1024ul;
1616

1717
/// @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;
1919

2020
/// @brief In serial buffer
2121
char* in_buffer = NULL;

0 commit comments

Comments
 (0)