diff --git a/src/ptz/ptz/ptz.c b/src/ptz/ptz/ptz.c index 12afa4e..cc7846f 100644 --- a/src/ptz/ptz/ptz.c +++ b/src/ptz/ptz/ptz.c @@ -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; @@ -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;