Page 4 of 6

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Wed Nov 15, 2023 5:59 pm
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 1010 times
GLCD_SH1106_I2C_fast.fcfx
(151.74 KiB) Downloaded 1088 times
gLCD_SH1106_I2C_Fast.fcpx
(12.08 KiB) Downloaded 1051 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

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 16, 2023 6:55 pm
by jgu1
Hi Martin!

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

Jorgen

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 16, 2023 7:21 pm
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

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 16, 2023 7:35 pm
by jgu1
Ok Martin, I will perform a test in "real" world, you her ;)

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Thu Nov 16, 2023 9:52 pm
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

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 17, 2023 5:31 pm
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

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 17, 2023 7:53 pm
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?

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 17, 2023 7:57 pm
by pmgreene01
additional comment, flowcode goes into "not responding" mode and I have to "end task" in the task manager.

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Fri Nov 17, 2023 8:02 pm
by mnfisher
Strange - can you post your program.

Can you compile the demo I posted above?

Martin

Re: OLED display issues, gLCD_SH1106_I2C1, Arduino Nano

Posted: Sat Nov 18, 2023 5:28 pm
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.