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!)
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
OLED display issues, gLCD_SH1106_I2C1, Arduino Nano
-
- 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
-
- 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
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
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
-
- 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
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
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
-
- 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
Hi Martin!
Yes now the display work in simulation too
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
Yes now the display work in simulation too
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
-
- 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
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?
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?
-
- 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
additional comment, flowcode goes into "not responding" mode and I have to "end task" in the task manager.
-
- 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
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.
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