I am using an arduino where a OLED screen is connected to display COM and NAV frequencies.
I am using the message port to interface to AM 4.0
Also a dual encoder is connected to change the frequencies.
This all is interfacing well, only it is very laggy....
When turning the encoder frequencies on the OLED screen which are transfered back from AM appear with a small delay.
Is there a way to fix this lag .
USB settings are all set to the max, and sim and am are on the same pc...for now..
API communication slow using messageport
Re: API communication slow using messageport
Hi.
Your problem can well be related to the interface type of your screen
If you are using an Oled screen with an I2C interface, the refresh rate is way slower than using the same OLED but with an SPI interface.
SPI uses more pins than I2C but is generally faster.
It also can depend on which display library you are using, I found out that u8g2 is typically faster than the Adafruit library.
My 10 cents
Jacques
Your problem can well be related to the interface type of your screen
If you are using an Oled screen with an I2C interface, the refresh rate is way slower than using the same OLED but with an SPI interface.
SPI uses more pins than I2C but is generally faster.
It also can depend on which display library you are using, I found out that u8g2 is typically faster than the Adafruit library.
My 10 cents
Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
Re: API communication slow using messageport
Also consider how often you’re updating the display. I found that constantly sending messages through message port will cause delays, sometimes massive ones. Consider only sending a message from your instrument and to your display only when there’s a change in what it needs to display.
Re: API communication slow using messageport
Yes i have an I2C OLED interface.
I do update the display frequently, i was thinking this would perhaps speed up the interface.
hmm...i will go and try this.
Thanks guys!
I do update the display frequently, i was thinking this would perhaps speed up the interface.
hmm...i will go and try this.
Thanks guys!
Re: API communication slow using messageport
As I understand it (and maybe somebody more knowledgeable will come along and correct me), when you send a message from your instrument and your Arduino is not yet ready to read it, the message gets put in a queue/buffer until it can be read. Any further messages will get put in the buffer until it’s their turn, and as these messages stack up, you end up with latency and sometimes (in my experience) a crash of your hardware.
Re: API communication slow using messageport
Hi Lonespace.
The very best thing to do is write an Arduino only program that simulates updates to the display in use. See how this performs. As Jacques says, the update speed of 'some' of the oleds can be pretty slow - depending on what you are doing.
BUT, if everything is great in an Arduino only situation, then you can then look at messageport, but, only after running an independent Arduino prog first - without AM. You can simulate random updates with a basic timer in Arduino (WITHOUT DELAY() !) - try to never use DELAY() with Arduino.
Let us know the results of that. Also the display model you are using.
The very best thing to do is write an Arduino only program that simulates updates to the display in use. See how this performs. As Jacques says, the update speed of 'some' of the oleds can be pretty slow - depending on what you are doing.
BUT, if everything is great in an Arduino only situation, then you can then look at messageport, but, only after running an independent Arduino prog first - without AM. You can simulate random updates with a basic timer in Arduino (WITHOUT DELAY() !) - try to never use DELAY() with Arduino.
Let us know the results of that. Also the display model you are using.
Joe. CISSP, MSc.
Re: API communication slow using messageport
I am using a 1.54" I2C Oled display, similar to this one
https://nl.aliexpress.com/item/10050020 ... 4c4djIxXgv
I tried reducing the messageport ticks in my Arduino sketch, but this did even caused more latency!!
So i increased the messageport ticks and this did speed up the interfacing!!
I is acceptable now...but not as i would like
Maybe using the u8g2 library also will help.
I will try this too.
https://nl.aliexpress.com/item/10050020 ... 4c4djIxXgv
I tried reducing the messageport ticks in my Arduino sketch, but this did even caused more latency!!
So i increased the messageport ticks and this did speed up the interfacing!!
I is acceptable now...but not as i would like
Maybe using the u8g2 library also will help.
I will try this too.
Re: API communication slow using messageport
A dumb remark, but make sure that the screen is powered in 3.3V instead of 5V as this information is often lacking from the site vendor. I had a hard time trying to make my own SPI Oled screen to work properly without artifacts and errors until I powered them in 3.3V
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
Re: API communication slow using messageport
Using the u8g2 library makes a huge difference!!!
When using this library instead of the AdaFruit, responses of turning the encoders are correct now.
When using this library instead of the AdaFruit, responses of turning the encoders are correct now.
Re: API communication slow using messageport
i have to adjust my analysis.....
The smaller the font the smoother the interfacing runs.
When using a larger font there is lag again...also with the u8g2 library...
The smaller the font the smoother the interfacing runs.
When using a larger font there is lag again...also with the u8g2 library...