Skip to content

Commit c850c17

Browse files
committed
worked on robot
1 parent 834d837 commit c850c17

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ int main() {
144144
float pos_offset_x = 0;
145145
float pos_offset_y = 0;
146146

147+
// get the pitch min and max, and shift them to be centered around 0
148+
float pitch_min = config->set_reference_limits[4][0][0];
149+
float pitch_max = config->set_reference_limits[4][0][1];
150+
float pitch_average = 0.5 * (pitch_min + pitch_max);
151+
pitch_min -= pitch_average;
152+
pitch_max -= pitch_average;
153+
147154
// param to specify whether this is the first loop
148155
int count_one = 0;
149156

@@ -195,14 +202,7 @@ int main() {
195202
vtm_pos_x += ref->ref_data.kbm_interaction.mouse_speed_x * 0.05 * delta;
196203
vtm_pos_y += ref->ref_data.kbm_interaction.mouse_speed_y * 0.05 * delta;
197204

198-
// get pitch limits from config to clamp the pitch
199-
float pitch_min = config->set_reference_limits[4][0][0];
200-
float pitch_max = config->set_reference_limits[4][0][1];
201-
// shift the range to center around 0
202-
float pitch_average = 0.5 * (pitch_min + pitch_max);
203-
pitch_min -= pitch_average;
204-
pitch_max -= pitch_average;
205-
// do the clamp
205+
// clamp to pitch limits
206206
if (dr16_pos_y < pitch_min) { dr16_pos_y = pitch_min; }
207207
if (dr16_pos_y > pitch_max) { dr16_pos_y = pitch_max; }
208208

0 commit comments

Comments
 (0)