Skip to content

Commit

Permalink
roleoroleo#184 Avoid negative numbers in PTZ presets
Browse files Browse the repository at this point in the history
  • Loading branch information
flreinhard committed Mar 2, 2025
1 parent f83fcd8 commit 275de71
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ptz/ptz/ptz.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,14 @@ int main(int argc, char **argv)
fprintf(stderr, "Error reading position\n");
return -2;
}
x = preset_buffer[3];
y = preset_buffer[4];
if (debug) fprintf(stderr, "Current position: (%d, %d)\n", x, y);

if (x < MIN_X) x = MIN_X;
if (x > MAX_X) x = MAX_X;
if (y < MIN_Y) y = MIN_Y;
if (y < MAX_Y) y = MAX_Y;
x = preset_buffer[3];
y = preset_buffer[4];
if (debug) fprintf(stderr, "Current position: (%d, %d)\n", x, y);
}

presets[preset_num].x = x;
Expand Down Expand Up @@ -569,13 +570,14 @@ int main(int argc, char **argv)
fprintf(stderr, "Error reading position\n");
return -2;
}
x = preset_buffer[3];
y = preset_buffer[4];
if (debug) fprintf(stderr, "Current position: (%d, %d)\n", x, y);

if (x < MIN_X) x = MIN_X;
if (x > MAX_X) x = MAX_X;
if (y < MIN_Y) y = MIN_Y;
if (y < MAX_Y) y = MAX_Y;
x = preset_buffer[3];
y = preset_buffer[4];
if (debug) fprintf(stderr, "Current position: (%d, %d)\n", x, y);

presets[0].x = x;
presets[0].y = y;
Expand Down

0 comments on commit 275de71

Please sign in to comment.