trunet Posted July 11, 2014 Report Share Posted July 11, 2014 Hi,If I put GINPUT_MOUSE_NEED_CALIBRATION FALSE on my ginput_lld_mouse_config.h file, touchscreen doesn't work at all.Anything I can do to force it to work?Thanks,Wagner Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted July 11, 2014 Report Share Posted July 11, 2014 I'll have a look at this tonight. Can you please leave some more information about your hardware setup, which driver you are using and why you want to skip the calibration?There's a small hack: You can use 9999 as the instance parameter that you pass to gwinAttachMouse() to skip the calibration for now. However, this is not the desired way as it is a workaround.~ Tectu Link to comment Share on other sites More sharing options...
trunet Posted July 11, 2014 Author Report Share Posted July 11, 2014 I'm using that HY-MiniSTM32V with 3.2 TFT display. Driver is that one that I sent on my other thread.My current full code is at https://github.com/trunet/trunetreef. It's only tests for now... Note that I'm using chibios and ugfx master trunk.Tonight I'll add TFT/touch driver to my repository to easy your debugging. I'm at GMT-3. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted July 11, 2014 Report Share Posted July 11, 2014 I'm using that HY-MiniSTM32V with 3.2 TFT display. Driver is that one that I sent on my other thread.But which touch driver are you using? I don't see which driver from /drivers/ginput/touch you're using.Try the trick with the 9999 instance first. I'm currently not at home either so I cannot investigate.~ Tectu Link to comment Share on other sites More sharing options...
trunet Posted July 11, 2014 Author Report Share Posted July 11, 2014 TP is ADS7843. I copied ginput_lld_mouse* files from FireBull-STM32F103-FB.I'll try 9999 when I get back home tonight. Link to comment Share on other sites More sharing options...
trunet Posted July 12, 2014 Author Report Share Posted July 12, 2014 9999 doesn't work. :? Link to comment Share on other sites More sharing options...
inmarket Posted July 15, 2014 Report Share Posted July 15, 2014 There is a test program specifically designed to test mouse drivers.Try starting with that.It is in the tools/touch_driver_test directory. Link to comment Share on other sites More sharing options...
trunet Posted July 22, 2014 Author Report Share Posted July 22, 2014 It runs fine.gwinAttachMouse(9999) doesn't work, it skips calibration. gwinAttachMouse(0), asks for calibration and works fine after that.If this touch_test works, it's because it's not using widgets. I tested gwin/widgets demo and it doesn't work without calibration, as my custom software.I think the problem is a bug on GWIN. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted July 22, 2014 Report Share Posted July 22, 2014 There is definitely a problem as I can confirm it myself now.We will look into this as fast as possible.In the meantime you can probably try to add a custom calibration load function (using ginputSetMouseCalibrationRoutines()) and returning an empty struct. "Empty struct" means that the parameters are set in a way that they don't change anything. Probably "neutral calibration data" would be the more appropriate term. The neutral struct looks like this:ax = 1;bx = 0;cx = 0;ay = 0;by = 1;cy = 0;The struct itself is defined in mouse.c:typedef struct Calibration_t { float ax; float bx; float cx; float ay; float by; float cy;} Calibration;~ Tectu Link to comment Share on other sites More sharing options...
inmarket Posted July 22, 2014 Report Share Posted July 22, 2014 I think you are both missing the point. The driver is either calibrated and clipped or non - calibrated with raw readings. The touch driver test code uses this to enable testing of the touch parameters.If however you disable all calibration code this is NOT the same as running in the special raw mode used by the touch driver test tool. In this situation you will be getting raw readings but they will be clipped to the screen dimensions. As the touch scale is not likely to match one to one with pixel display scale this means the readings will not scale over the display and of course widgets will not work.In other words this touch controller cannot operate without calibration or atleast scaling of its readings. One that does is the Win32 touch driver as windows performs the scaling and clipping for you before passing them to the ugfx driver. Effectively mouse/touch scaling as seen at the driver level corresponds one to one with the display scaling. If you want to manually control the calibration and scaling then you need to use Tectu's method with calibration turned on but replace the 1's with the hardwired scaling factor. This will prevent the user being prompted for the calibration.Note also many touch panels are oriented transverse the the display orientation. If your panel is one of these calibration is the only reliable way to get a working translation and scaling matrix. The maths involved in doing it by hand are nasty. Link to comment Share on other sites More sharing options...
trunet Posted July 22, 2014 Author Report Share Posted July 22, 2014 I understood inmarket point.I got my calibration routine save string and statically set on myload function. Worked for me...static const char *myload(uint16_t instance){ char *buf; uint8_t bsize = 24; (void)instance; buf = gfxAlloc(bsize); strcpy(buf, "\x75\xD4\x84\xBD\x94\xE3\x72\xBA\x73\x76\x7E\x43\x2D\x67\x28\xBA\x17\x3A\xBB\x3D\x41\x05\xFA\xC1"); return buf;}ginputSetMouseCalibrationRoutines(0, NULL, myload, FALSE); Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 6, 2014 Report Share Posted August 6, 2014 Hi,how can I convert the calibration values into this format? I have the ax, bx, cx and ay, by, cy as floats. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted August 6, 2014 Report Share Posted August 6, 2014 how can I convert the calibration values into this format? What format do you mean? You can just assign them as any normal struct member:cal->ax = 32;cal->bx = 37;...If you refer to the strcpy() command of trunets code sample; it looks like he used some debugging tool to retrieve those values and simply copy pasted them.~ Tectu Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 6, 2014 Report Share Posted August 6, 2014 (edited) If I callmouse = ginputGetMouse(0); ginputSetMouseCalibrationRoutines(0, mysave, myload, FALSE);I can save the string like this: "Z,\202=\\\221b¹\037FaÁÅdI:䨹½´>³Cè\017" within the mysave function:static void mysave(uint16_t instance, const uint8_t *calbuf, size_t sz){ (void)instance; (void)calbuf; (void)sz; memcpy(&t_calibration, calbuf, (uint8_t) sz);}and than I got that string. But when I change the order of the two functions and the myload returns that string the touchscreen isn't working. Edited August 7, 2014 by Guest Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted August 6, 2014 Report Share Posted August 6, 2014 I can save the string like this: "Z,\202=\\\221b¹\037FaÁÅdI:䨹½´>³Cè\017" within the mysave function:Can you please elaborate how exactly you get this string? Some GDB examination?The normal process: Make 100% sure that your ginputSetMouseCalibrationRoutines() routine gets called before the ginputGetMouse() routine. At the first execution, make sure that the third parameter of the ginputSetMouseCalibrationRoutines() routine is NULL. Execute the program Either extract the calibration data using a debugger / serial console or any other kind of output or store it on non-volatile memory Set the third parameter of the ginputSetMouseCalibrationRoutines() routine to point to your actual loading routine which provides the data that you just exctracted/saved. Done. Your touchscreen should now automatically load with the correct calibration data.The wiki does also have this information.~ Tectu Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 7, 2014 Report Share Posted August 7, 2014 (edited) First I called the ginoutGetMouse() and within the debugger I copied the string from MouseCondig.caldata after the mysave has been called.This way when the mysave gets called I have the calbuf type const uint8_t* filled with this kind of string:0x20001c94 "½3\205=÷&\2348KÓcÁu-6:Í\220»½\n\207°Cð\017"I guess this is the calibration data. But when I load it back it does not work.I've tried what you have mentioned, but that way my mysave function never get called: ginputSetMouseCalibrationRoutines(0, mysave, NULL, FALSE);mouse = ginputGetMouse(0); Edited August 7, 2014 by Guest Link to comment Share on other sites More sharing options...
inmarket Posted August 7, 2014 Report Share Posted August 7, 2014 Write the save routine to output the data to a debug console in binary hex. You will then be able to read the results and potentially hard code them into your load routine.Note the data is binary not text and may contain as ascii null characters. Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 7, 2014 Report Share Posted August 7, 2014 (edited) Saddly I'm not that kind of programmer. I can't do that. I can chprintf to serial console but that's not enough.But I have hard coded them in this form:return ("=\136\004k:-\158c\193\145#\245\186E\158b\189\185\252\238C\178IH");This is the return of myload, but it still does not work. I guess I will have to do the calibration thing until I don't have the SD card. Edited August 7, 2014 by Guest Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted August 7, 2014 Report Share Posted August 7, 2014 You cannot simply return that string. You have to copy that string into a buffer and return the pointer to that buffer. Trunet showed how it's done in his code:strcpy(buf, "\x75\xD4\x84\xBD\x94\xE3\x72\xBA\x73\x76\x7E\x43\x2D\x67\x28\xBA\x17\x3A\xBB\x3D\x41\x05\xFA\xC1");return buf;P.S. Can you please stop quoting the previous post all the time? Quotes are used to answer specific text parts, not the whole post. It's getting very messy otherwise ;-)~ Tectu Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 7, 2014 Report Share Posted August 7, 2014 Sorry Tectu :oops: Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted August 7, 2014 Report Share Posted August 7, 2014 No reason to be sorry Did it work?~ Tectu Link to comment Share on other sites More sharing options...
dm13dv1b Posted August 7, 2014 Report Share Posted August 7, 2014 Not yet. I have to make a new clean project bcause the ADC did not worked.I'm on it... I guess tonight I'll make it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now