Skip to content
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

row_offsets #15

Merged
merged 3 commits into from Oct 30, 2020
Merged

row_offsets #15

merged 3 commits into from Oct 30, 2020

Conversation

ghost
Copy link

@ghost ghost commented Oct 24, 2020

Corrected 'row_offsets' for LCDs with 4 lines.

IMG_0881

@mathertel
Copy link
Owner

image

This is a picture of another 4-row LCD that has 20 columns each row. Here the original values fit.
Here the offset for the 3. line offset = 1 line offset + 20.

Your display has 16 cols per row and need the adjustment 3. line offset = 1 line offset + 16.

The cols actually are known from the begin() function but not yet used. They can be used to calculate the offset array properly.
row_offsets[2] = row_offsets[0] + cols; row_offsets[3] = row_offsets[1] + cols.
You ma ylike to add this to your pull request.
Thanks for pointing to that incompatibility with 4 lines-16 cols displays..

@ghost
Copy link
Author

ghost commented Oct 27, 2020

I created a new function for preparing row_offsets at begin(), then setCursor() may faster change the cursor position. Please review changes.

@mathertel mathertel merged commit 9af188e into mathertel:master Oct 30, 2020
@mathertel
Copy link
Owner

Thanks a lot.

@mathertel
Copy link
Owner

While doing some quality checks I found a simpler way of initializing.
The row_offsets can always be initialized for max 4 rows. In a 2*16 case only 2 of them are actually used.
Added some boundary checks as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants