-
Notifications
You must be signed in to change notification settings - Fork 214
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
fixed extends for dynamic rotation, added simple rotate function, added example #70
Conversation
…for dynamic rotation
Thanks @espHorst ! I have been doing further testing of this PR but wondered if you could confirm for me the default config you started with in your tests on the ILI9341? ie.
Thanks! |
I did not change the default config in the commited GUIslice_config_ard.h file. #define DRV_DISP_ADAGFX_AS |
The code looks good, and I like the partitioning of functionality between When testing the PR, I did notice that the Empirically, it looks like ILI9341+STMPE610 might expect the following as a function of
On the basis of your XPT2046 config and the new transform logic in DrvRotate, I assume ILI9341+XPT2046 might require: (this was done by hand, so hopefully I got it right)
If the above is correct, then I'm starting to wonder if:
I generally don't like hardcoding, but IF the mapping from However, I suspect the mapping from GSLC_ROTATE/nRotation to Swap/FlipX/FlipY might be dependent on the combination of display module and touch driver ( Given the difference in behavior I've noted here between touch controllers, do you have an opinion on an approach that makes sense? thanks again |
I have made a mistake in the calculations. Indeed the calculations depend on the state of the swap, not only on the difference between the current and the next rotation. Thus the false behaviour for your touch. It just starts with another swap setting. I will work on a fix. If all touch screens have in their default setting a correct x and y direction, i. e. x and y are not flipped, then a simple rotation will do the job for all different touch displays. Then it is sufficient to specify a "GLSC_TOUCH_ROTATION". This could be specified by the user. So at maximum the user has to try four settings. I hope this is easier for the user as to try eight settings for flipX,Y and swap. If the GLSC_TOUCH_ROTATION is specified correctly then a bug fixed version of gslc_DrvRotate should do the job for dynamic rotation. I will commit a fix into the PR within the next day(s). |
Thanks for identifying the difference -- seems to explain the observations. I agree that it appears likely that we could get away with a touch controller orientation setting (ie. 4 settings) in the config. As for defining the config settings: I'm thinking it should be relatively straightforward to create a training example that instructs the user what touch setting(s) to use: reset the Swap/FlipX/FlipY and then ask the user to press a button in each nRotation mode (maybe facilitated by #24). Assuming the button was placed well to the interior of a given quadrant (and with layout scaled to screen size), one should be able to detect the mapping based on what quadrants were actually clicked. BTW -- later on, I intend to create a |
…h screens than XPT2046
I have pushed a bug fix. I have successfully tested it for STM32F1+ILI9341+XPT2046 and furthermore I have printed the settings with default values for STMPE610 - the results looks promising, i.e. this are the values that @ImpulseAdventure you have evaluated empirically:
Moreover in the GUIslice_config_ard.h you can configure now both ways: By the way: Maybe this can be combined with a touch screen calibration.
|
One further comment:
|
I have tested your pull request with my setup and so far it has been working nicely. I made a couple additional updates:
Config Breaking ChangeOne important point about the PR is that it would normally be a breaking change. If users have not updated their config files to the latest version, compilation would normally fail due to the missing Thankfully, in most cases the minimal config update for users should just require the addition of the following line to their
Config PatchingOn the topic of changes to config files, I have considered creating a "patch" flow for users. As the config files are moderately complex, it may require moderate effort to update one's config file if many parts have changed. Ideally, a user could always update to the latest config without losing their customizations by using a "patch" script... something to consider for later. Next StepsAssuming this update works for people, I will proceed to implement the equivalent functionality for other display drivers. Creating a rotation detection & calibration example might be worth considering later. |
…ADAGFX - NOTE: Breaking change for configuration update. GUIslice_config_*.h will require an update to add the new GSLC_TOUCH_ROTATE parameter. The most minimal update would require adding the following line: `#define GSLC_TOUCH_ROTATE 1` (the number may need to be changed to a value between 0..3 to provide correct touch detection) - Add GuiRotate() as simple wrapper for DrvRotate(). Note that only DRV_DISP_ADAGFX and DRV_DISP_ADAGFX_AS modes are supported at the moment, with others to follow. - Add compiler warning to detect config file needing update for GSLC_TOUCH_ROTATE - Relocated TOUCH_ROTATION_* macros into GUIslice.h from config - Update example gslc_ex17_ard to use GuiRotate instead of DrvRotate
Note that I have filed PR #72 to incorporate the combination of changes in this PR as well as the additional edits mentioned above. @espHorst -- if you could have a look at my proposed changes, that would be great. I wasn't sure of the best way to enable you to test my additional changes without pushing to your master branch, so I created a separate branch (& PR) with the merged changes. If there was a better approach without effectively duplicating the PR, I'd be interested in learning :) |
Dynamic Screen Rotation, includes espHorst PR #70 - The GUI can change orientation dynamically with the GuiRotate() command - Note that the GUIslice_config should be updated to include the new GSLC_TOUCH_ROTATE parameter (which defines the orientation of the touch handler with respect to the display)
Hi ImpulseAdventure,
as discussed in #68 here a PR trying to fix the dynamic
bool gslc_DrvRotateSwapFlip(gslc_tsGui* pGui, uint8_t nRotation, uint8_t nSwapXY, uint8_t nFlipX, uint8_t nFlipY )
function.
Furthermore I have added the function
bool gslc_DrvRotate(gslc_tsGui* pGui, uint8_t nRotation)
This function auto sets nSwapXY, nFlipX and nFlipY by inspecting the change of nRotation to the previous pGui->nRotation.
Finally this was tested on a STM32F1 with ILI9341 and XPT2046. The according
example is added as gslc_ex17_ard.ino
For me it works perfect, and I assume that it works with every combination display / touch.
But I was only able to test it on my hardware.
It only requires
in GUIslice_config_ard.h to be set correctly for the
#define GSLC_ROTATE
that is defined in GUIslice_config_ard.h