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

SSD1306 display rotation support and fix for #421 #422

Merged
merged 12 commits into from
Jan 22, 2023

Conversation

diyelectromusic
Copy link
Collaborator

Fix for Issue #421 - circle sound drivers have moved to their own subdirectory and library.

probonopd and others added 4 commits January 18, 2023 20:40
for SSD1306 display rotation support

probonopd#412
probonopd#420)

Requires an update to circle (PR submitted to develop branch)

Co-authored-by: diyelectromusic <68612569+diyelectromusic@users.noreply.github.com>
Needed to support Circle develop?
@diyelectromusic
Copy link
Collaborator Author

This will need the latest develop branch of circle of course...

@probonopd
Copy link
Owner

In file included from kernel.h:23,
                 from kernel.cpp:20:
circle_stdlib_app.h: In member function 'virtual bool CStdlibAppStdio::Initialize()':
circle_stdlib_app.h:218:33: error: invalid initialization of reference of type 'CConsole&' from expression of type 'FATFS'
  218 |                 CGlueStdioInit (mFileSystem, mConsole);
      |                                 ^~~~~~~~~~~

@probonopd
Copy link
Owner

It built 👍

Let's test it:
MiniDexed_2023-01-20-d0b139c

@probonopd probonopd changed the title Fix for Issue #421 SSD1306 display rotation support and fix for Issue #421 Jan 20, 2023
@probonopd probonopd changed the title SSD1306 display rotation support and fix for Issue #421 SSD1306 display rotation support and fix for #421 Jan 20, 2023
@diyelectromusic
Copy link
Collaborator Author

I get an assertion failing in circle-stdlib/libs/circle-newlib/libgloss/circle/io.cpp(687): circle_fat_fs

There was a corresponding update to newlib as well as stdlib so are you using the develop version of that too?

@diyelectromusic
Copy link
Collaborator Author

Yep, looks like we need this too: smuehlst/circle-newlib@48bf91d

@probonopd
Copy link
Owner

Can you spot where we are pulling in circle-newlib? I don't see where I could change it...

@diyelectromusic
Copy link
Collaborator Author

I believe it is one of the sub-modules for circle_stdlib, alongside circle itself...?

@diyelectromusic
Copy link
Collaborator Author

Yes, so in the build.yml I guess we need to add something to also checkout the develop branch of newlib alongside circle (after checking out the develop branch of circle-stdlib itself)?

@probonopd
Copy link
Owner

Indeed. Submodules are pulling in other submodules.

Needed for circle ec09d7e
@probonopd
Copy link
Owner

@diyelectromusic how does MiniDexed_2023-01-21-63fac3c look?

@probonopd
Copy link
Owner

probonopd commented Jan 21, 2023

Reminder to self, also need to add descriptions for

SSD1306LCDRotate=0
SSD1306LCDMirror=0

to the wiki. I wonder whether someone will come up with a cool HW project using the mirror feature ;-)

@diyelectromusic which values are allowed for these, just 0 and 1?

@diyelectromusic
Copy link
Collaborator Author

That seems to have done the trick! :)

Phew, that was a lot more complicated than it should have been!!

Kevin

@diyelectromusic
Copy link
Collaborator Author

@diyelectromusic which values are allowed for these, just 0 and 1?

Actually 0 and <>0 - I think that is the same as other boolean values in the config file...

@probonopd
Copy link
Owner

probonopd commented Jan 21, 2023

OK, for simplicty let's document it as 0/1 then.

Thanks a lot for your help!

Awaiting @vujnovich's response, will then merge.

@vujnovich
Copy link

vujnovich commented Jan 21, 2023 via email

@probonopd
Copy link
Owner

Yes, please try it out and let us know whether it works for you. Thanks!

@Banana71
Copy link

Banana71 commented Jan 22, 2023

Moin,
You've done a lot of good there :-)
SSD1306LCDRotate & SSD1306LCDMirror work perfectly.
But why does the mirror effect work over the short axis? I would have expected mirroring over the long axis, similar to a head-up display in a car.
All other functions on the MiniDexed work as usual.

@diyelectromusic
Copy link
Collaborator Author

diyelectromusic commented Jan 22, 2023

But why does the mirror effect work over the short axis?

As the starting point was MT32-Pi I just ported over the two modes it already uses. I had a quick look at the ssd1306 datasheet, but haven't fully decoded the registers to know if there are additional feasible modes. But now it all looks up and running I might take a look again at some point...

Update: Thinking a little more - isn't this what Mirrored + Rotated does? Now I'm really confused! :)

Update again: Actually mirrored can be viewed in a mirror in either axis regardless!? Or am I missing something (highly likely)?

This is Mirrored = 1; Rotated = 0 :)

IMG_6808

Final Thought: I think there is where I defer to "Physics Girl" - https://www.youtube.com/watch?v=vBpxhfBlVLU :)

Kevin

@probonopd
Copy link
Owner

probonopd commented Jan 22, 2023

Yes, if you mirror something along the x-axis and then rotate it by 180 degrees, the final result will be the same as if you had just mirrored it along the y-axis.

We should test and put this into the documentation. Is the following correct?

  • To rotate the display by 180 degrees, set SSD1306LCDRotate=1
  • To mirror the display along the short axis, set SSD1306LCDMirror=1
  • To mirror the display along the long axis, set SSD1306LCDMirror=1 and SSD1306LCDRotate=1

@diyelectromusic
Copy link
Collaborator Author

We should test and put this into the documentation. Is the following correct?

I think we're saying:

  • To rotate the display by 180 degrees, set SSD1306LCDRotate=1
  • To mirror the display set SSD1306LCDMirror=1

Note that a mirrored display will be the same orientation when viewed mirrored via the short axis, but upside down when viewed mirrored via the long axis. For a "heads up display" style effect it would need to be both mirrored and rotated.

@Banana71
Copy link

Banana71 commented Jan 22, 2023

Haha,
with 2 bits you can represent 4 possibilities.
Now everything is clear, it was still very early in the morning when I tried it out. It's my pleasure to cause confusion.
Good that we talked about it, all ambiguities have been eliminated :-D

@probonopd probonopd merged commit fcea41e into probonopd:main Jan 22, 2023
@probonopd
Copy link
Owner

probonopd commented Jan 22, 2023

Also added to documentation.

Again, thank you very, very much @diyelectromusic 👍

@diyelectromusic
Copy link
Collaborator Author

We've made it! Hurrah! :)

@vujnovich
Copy link

vujnovich commented Jan 23, 2023 via email

@diyelectromusic
Copy link
Collaborator Author

So I just had the time to try the new build. Looking at the config, I noticed the lcd mirror option is in the ssd1306 , not the hd44780. Bah, I'm gonna try it anyway 😜. Suppose I didn't mention I was using the hd44780 with a backpack. Anyway cheers

I thought you'd said you'd tried it with MT32-Pi and wondered if we could do the same. MT32-Pi can only rotate a SSD1306 based display too (well, actually it might support other "graphical" displays, but ssd1306 is the only one we do too).

The hd44780 is not a "graphical" display and support in MT32-Pi can't rotate either, so I didn't bother even looking...

Kevin

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.

4 participants