-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add buffer to screen edge for validation crosshair placement #175
base: master
Are you sure you want to change the base?
Conversation
tests/ts_calibrate.c
Outdated
@@ -160,6 +161,12 @@ static int ts_validate(struct tsdev *ts, int boundary, unsigned int loops, int t | |||
|
|||
if (loops == 0) | |||
loops = VALIDATE_LOOPS_DEFAULT; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are spaces. please remove.
tests/ts_calibrate.c
Outdated
@@ -358,6 +369,16 @@ int main(int argc, char **argv) | |||
|
|||
validate_loops = atoi(optarg); | |||
break; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces or tabs here. please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than the spaces/tabs this looks really good! thanks.
tests/ts_calibrate.c
Outdated
@@ -160,6 +161,11 @@ static int ts_validate(struct tsdev *ts, int boundary, unsigned int loops, int t | |||
|
|||
if (loops == 0) | |||
loops = VALIDATE_LOOPS_DEFAULT; | |||
if ((edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should also do a lower bounds check in case EDGE_BUFFER_MIN changes in the future:
if (edgebuf < EDGE_BUFFER_MIN || (edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added lower bounds check for edgebuf
tests/ts_calibrate.c
Outdated
@@ -160,6 +161,11 @@ static int ts_validate(struct tsdev *ts, int boundary, unsigned int loops, int t | |||
|
|||
if (loops == 0) | |||
loops = VALIDATE_LOOPS_DEFAULT; | |||
if (edgebug < EDGE_BUFFER_MIN || (edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "edgebug". please test your changes! thanks, looks good otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo corrected.
edgebuf = EDGE_BUFFER_MIN; | ||
fprintf(stderr, "Edge buffer out of range. Using %d\n", | ||
edgebuf); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the cast to int here? anyways: gcc warns here, which we want to avoid:
ts_calibrate.c: In function ‘ts_validate’:
ts_calibrate.c:164:14: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
if (edgebuf < EDGE_BUFFER_MIN || (edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) {
^
ts_calibrate.c:164:49: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
if (edgebuf < EDGE_BUFFER_MIN || (edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) {
^
ts_calibrate.c:164:82: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
if (edgebuf < EDGE_BUFFER_MIN || (edgebuf + 1) > ((int)xres/2) || (edgebuf + 1) > ((int)yres/2)) {
I was about to open a similar pull request. An option to keep the validation crosses away from the screen edge would be useful. With our typical screen resolutions, using int instead of unsigned int would be ok and not cause different signedness warnings, if that is the main objection. |
does the now merged |
Adds an optional command line setting to configure buffer around screen perimeter in which crosshairs will not appear during validation. Useful for cases with bezels or screens with hard-to-reach corners.