Skip to content

Bitmaps of certain heights don't draw correctly at non-zero y values #17

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

Closed
mikelowe983 opened this issue Mar 11, 2024 · 4 comments · Fixed by #18
Closed

Bitmaps of certain heights don't draw correctly at non-zero y values #17

mikelowe983 opened this issue Mar 11, 2024 · 4 comments · Fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@mikelowe983
Copy link
Contributor

mikelowe983 commented Mar 11, 2024

When using bitmaps of certain sizes, the oled.bitmap function will not draw the bitmap correctly.

See the below example bitmap:

/*
    SQ_Symbol [8, 9]

                     
             12345678
            .--------.
        0x01|********|
        0x02|*      *|
        0x04|*      *|
        0x08|*      *|
        0x10|*      *|
        0x20|*      *|
        0x40|*      *|
        0x80|*      *|
        0x01|********|   
            '--------'
*/

const int SQ_Symbol_Height = 9;
const int SQ_Symbol_Width = 8;
const uint8_t SQ_Symbol[] = {0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};

Calling oled.bitmap with a 0 for the y0 argument draws the bitmap as expected:

    oled.bitmap(0, 0, (uint8_t *)SQ_Symbol, SQ_Symbol_Width, SQ_Symbol_Height);

output:

********
*      *   
*      *
*      *
*      *
*      *
*      *
*      *
********

However, if I pass a non-zero value for y0, the bitmap does not draw correctly:

    oled.bitmap(0, 1, (uint8_t *)SQ_Symbol, SQ_Symbol_Width, SQ_Symbol_Height);

output:

********
*      *   
*      *
*      *
*      *
*      *
*      *
*      *

The bottom row is not drawn. This also occurs for bitmaps that have heights of 10, 11, 12, etc.

@gigapod gigapod self-assigned this Mar 11, 2024
@gigapod
Copy link
Member

gigapod commented Mar 11, 2024

Hi @mikelowe983 -

Quick question - which OLED screen where you using for your tests? I greb one of these when I take a look at this.

The bitmap code is very efficent, but a little complicated and I'll have to re-grok how I implemented it. I'll try to take a look at this in the next week.

-Kirk

@mikelowe983
Copy link
Contributor Author

Thanks @gigapod!

I am using this screen for my testing: https://www.digikey.com/en/products/detail/midas-displays/MCOT064048A1V-BM/18088018

It seems to be the same or very similar to the screen used in this breakout board: https://www.sparkfun.com/products/22495

I attempted to trace through the code within the QwGrSSD1306::drawBitmap function, but as you said, it was a bit tough to grok. I'll continue looking at it myself.

Let me know if there is anything I can do to help.

@mikelowe983
Copy link
Contributor Author

@gigapod I think I've isolated the issue. I've opened a PR which should resolve it here: #18

I read the contributing guidelines, which mentioned targeting the release_candidate branch, but I did not see one in this repo, so I targeted main instead.

Let me know if you have any feedback on the PR format, or code changes, let me know. Additionally, please test the changes yourself. I ran through some tests on my own, but it would be great to have your eyes on it as well.

Thanks!

@gigapod
Copy link
Member

gigapod commented Mar 12, 2024

Thaks for finding this @mikelowe983 . I'll get a release updated so the Arduino library bot picks this up.

@gigapod gigapod added the bug Something isn't working label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants