OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

For general Flowcode discussion that does not belong in the other sections.
mnfisher
Valued Contributor
Posts: 955
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by mnfisher »

Okay - converted to a component.

To install:

Copy the .fcpx file to a directory (eg c:\Flowcode) - where you wish to store 'custom' components.
In the build tab - customize - locations add this folder to 'Look for components in'

Refresh components (or restart FC)

The component is called glcd_sh1106_i2c_fast (snappy eh) - add this to your project.

Initialise as usual - then 'draw' stuff to the display using Print, DrawRectangle etc as usual - it's only copied to the display when you call Display() (I renamed from CopyData in the above code)

ClearDisplay (if needed) and repeat

I also attach a simple demo program that uses a different font (they work!)
fast_test.fcfx
(11.42 KiB) Downloaded 596 times
GLCD_SH1106_I2C_fast.fcfx
(151.74 KiB) Downloaded 627 times
gLCD_SH1106_I2C_Fast.fcpx
(12.08 KiB) Downloaded 609 times
I've made a few compromises - I ignore FG and BG colours - Plot is white, BPlot black. It doesn't handle the display orientation either (though this could be handled entirely in plot / bplot I think)
Nothing gets display in simulation - I hoped base_glcd would handle this - maybe I did something wrong?
The display is hard coded as 128 x 64 (other (smaller) displays maybe available?)

Martin

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by jgu1 »

Hi Martin!

Look good ;) Is it correct it not is possible to simulate?

Jorgen

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by mnfisher »

Hi Jorgen,

Didn't seem to work in simulation when I tried - I think the glcd_base should handle this so it might just be a couple of extra calls in plot/bplot or a modification to Display?

Martin

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by jgu1 »

Ok Martin, I will perform a test in "real" world, you her ;)

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by mnfisher »

Thanks,

I made a little progress - sort of sim now works - but items displayed as drawn rather than on Display - so things don;t look quite right (for example in fast_test above - the display is cleared immediately after printing)
I'd forgotten to call Initialise on glcd_base. I also added a DrawRect_sim.

I'll think if there is a way Display can do the magic (and it might just be a full copy using plot?)



Martin

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by jgu1 »

Hi Martin!

Yes now the display work in simulation too :D

I think, we may not hijack this topic from pmgreene01 ;) And as he ask, what about the original component for SH1106 Maybe MM team could use some of your correction?



Jorgen

pmgreene01
Posts: 35
Joined: Sat Jul 08, 2023 7:39 pm
Has thanked: 3 times
Been thanked: 4 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by pmgreene01 »

Martin,
I appreciate all the work that you have done on this. However, when I use this component in my program, it won't compile. When I hit the "compile to target" button, I get the pop up asking me to save the program, but then flowcode just locks up. I went back and downloaded some other programs that I have and everything works fine. if I include this new component, then I never get the pop up window showing the compilation progress.

Any thoughts?

pmgreene01
Posts: 35
Joined: Sat Jul 08, 2023 7:39 pm
Has thanked: 3 times
Been thanked: 4 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by pmgreene01 »

additional comment, flowcode goes into "not responding" mode and I have to "end task" in the task manager.

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by mnfisher »

Strange - can you post your program.

Can you compile the demo I posted above?

Martin

pmgreene01
Posts: 35
Joined: Sat Jul 08, 2023 7:39 pm
Has thanked: 3 times
Been thanked: 4 times

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Post by pmgreene01 »

I wrote a simpler program that simulates fine.

Hitting the "compile" button locks up Flowcode (have to kill it in task manager). My other programs still compile.

As a test, I opened a working program and just added this component to the 2D panel, but did not call any of the macros. That also puts flowcode into a hard lockup.

I also re-downloaded the gLCD_SH1106_I2C1.fcfx and replaced it in my components folder but have the same issue.

I am really sorry to bother you with all this. I appreciate that you have been working on it.
Attachments
DisplayTest_Simple01.fcfx
(12.19 KiB) Downloaded 605 times

Post Reply