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

SH1107 128x64 offset and sideways #48

Closed
spotrevoc opened this issue Feb 24, 2021 · 8 comments
Closed

SH1107 128x64 offset and sideways #48

spotrevoc opened this issue Feb 24, 2021 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@spotrevoc
Copy link

Using ESP32 with Adafruit OLED Featherwing display (SH1107 128x64 I2C).

lcdgfx library version 1.0.6

When running the sh1107_demo sketch from the example folder, image is rotated 90 degrees and only works in bottom right 64x32 pixels. Bottom left 64x32 pixels show a snowy pattern.

64x128 example works fine but screen is rotated and does not fit my needs that way.

Compiled using Arduino IDE 1.8.13 in Windows 10

20210224_141341

@spotrevoc spotrevoc added the bug Something isn't working label Feb 24, 2021
@lexus2k
Copy link
Owner

lexus2k commented Feb 24, 2021

@spotrevoc
hi

Are you sure you have 128x64 display, and not 64x128?

@spotrevoc
Copy link
Author

spotrevoc commented Feb 24, 2021

I believe technically it's a 64x128. Adafruit markets it as 128x64 but as I'm diving into their library they document it as "rotated" 64x128.

How easy could it be to swap x/y and add a separate constructor with the same startline and offset they use?

If that's not feasible, I really don't mind using it as 64x128 and swapping cursor position x and y in my code, as long as there's a way to rotate text and sprites with the library.

image

@lexus2k lexus2k added enhancement New feature or request and removed bug Something isn't working labels Feb 25, 2021
@spotrevoc
Copy link
Author

Also, nothing against Ada, but I really like your library overall and would like to stick with it since I've already developed a lot of code with it for an SH1106. I had hoped the Adafruit SH1107 oled shield would be pretty much a drop in replacement.

@lexus2k
Copy link
Owner

lexus2k commented Feb 25, 2021

Adafruit SH1107 is a good library, like many others Adafruit libraries. But they use a lot of virtual functions in their implementation, and their library consumes too much flash size and memory. And profit they have is ease of new features development. And they always use double buffering which eats 1024 bytes of RAM in case 128x64 monochrome displays.
So, to support specific display, or rotation feature they need to rewrite only single method.

lcdgfx, unlike Adafruit library, is built around C++ templates. It provides similar interface for users, but implementation is much more difficult. The advantage of such approach is small flash, ram requirements and faster speed. lcdgfx supports direct draw functions (to draw on the display without double buffering), and nano engine - use double buffering to refresh only part of the display content.
Some specific displays, rotation modes in lcdgfx library require too much code. That's not easy.

Actually there are 2 types of 128x64 lcd displays based on SH1107 controller. And there orientation is hardware feature (you can see the difference in flex cable connection to the matrix):
изображение
изображение

How easy could it be to swap x/y and add a separate constructor with the same startline and offset they use?

The offset has nothing to do with the problem solution. And it is already used by lcdgfx: " 0xD3, 0x01, 0x60, // offset 0x60 according to datasheet",

If that's not feasible, I really don't mind using it as 64x128 and swapping cursor position x and y in my code, as long as there's a way to rotate text and sprites with the library.

That's not easy. The most simple solution in your case is to use canvas and write new method rotate for it.

@lexus2k
Copy link
Owner

lexus2k commented Mar 29, 2021

I'm closing the issue, since there is no any activity. But feel free to reopen if you have any questions

@lexus2k lexus2k closed this as completed Mar 29, 2021
@guhland
Copy link

guhland commented Nov 18, 2021

How would I go about using canvas to write a rotate method?

@Pedrohpcavalcante
Copy link

How would I go about using canvas to write a rotate method?

@lexus2k
Copy link
Owner

lexus2k commented Mar 9, 2022

The solution for 1-bit displays is in #72 ticket

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

No branches or pull requests

4 participants