I’m currently work with a embedded linux and a touchscreen (display is send by linux frame buffer).
I use file properly adapted to execute tpcal.c. as stand alone. I can touch circles and see result near the screen borders.
I use evdev.h and fbdev.h drivers
I see that I need to adapt these lines in lv_drv_conf.h file to calibrate my device:
# define EVDEV_CALIBRATE 1 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
# if EVDEV_CALIBRATE
# define EVDEV_HOR_MIN 200 /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
# define EVDEV_HOR_MAX 3800
# define EVDEV_VER_MIN 200
# define EVDEV_VER_MAX 3800
# endif /*EVDEV_SCALE*/
#endif /*USE_EVDEV*/
But:
- I don’t understand how I can calculate correction?
- I don’t understand how to write driver function
xxx_set_cal_data (like tell in the appendix) - In the equation:
x_cal = ((x_act - x1_saved) * lcd_hor_res) / (x2_saved - x1_saved);
- x_cal: the calibrated X coordinate
- x_act: the currently measured X coordinate
- x1_saved, x2_saved: The raw X coordinates saved as calibration data
x1_saved, x2_saved are from a precedent calibration? I don’t understand how to get then.
I hope the problem is clearly expressed. Thank you for your help.