7-Segment displays sometimes lagging badly

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

7-Segment displays sometimes lagging badly

#1 Post by Tetrachromat »

I recently coverted my 737 MCP controller to Air Manager.

As you can see from the following picture it uses 22 7-segment digits to display various AP reference values.
MCP_frontm.jpg
The 22 digits are controlled by 3 daisy-chained MAX7219 display controllers.

Now the issue I have is, that the displays sometimes take a very long time (several seconds) to display new values. I try to describe the situation:
  • I'm flying under the control of the autopilot straight and level with a heading set to 85°for quite some time.
    At some point I decide to change heading to 120°.
    I turn the encoders clockwise.
    The aircraft starts to bank and turning towards the set value.
    The instrument in the 3D cockpit shows the selected value but the 7-segment displays still show the initial value of 85°
    Only after some seconds the displays are updated.
    When I continue to turn the encoder, the display updates rather quickly without much delay.
Only if some time passes after the last display update, the issue repeats.

It looks like the display update process is in a sleep mode, maybe a timer issue... Just a wild guess.

Paul

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: 7-Segment displays sometimes lagging badly

#2 Post by Ralph »

Already discussed on the forums a few times. It's gonna be improved in version 4.1.

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: 7-Segment displays sometimes lagging badly

#3 Post by Corjan »

Hi,


You can try the latest AM 4.1 BETA. Make sure to flash your Arduino with it.
It should perform better, but it hasn't been fully tested yet.


Please let me know if you are taking the plunge, and if so, please let me know how it performs for you,

Corjan

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: 7-Segment displays sometimes lagging badly

#4 Post by Tetrachromat »

The hardware is built into the cockpit. I have only Air Player running on that machine.

Air Manager is running on the remote development/instructor station.

I do need an second license to run Air Manager on the cockpit machine, right?

Paul

User avatar
Ralph
Posts: 7878
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: 7-Segment displays sometimes lagging badly

#5 Post by Ralph »

You can reset your license for testing if you want. We can reset the reset limit, just let us know.
http://siminnovations.com/wiki/index.ph ... ense_reset

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: 7-Segment displays sometimes lagging badly

#6 Post by Tetrachromat »

Ok, thats fair. I will prepare this. I assume I have to transfer the panel "manually", using export and import to the BETA version.

Will do the testing tomorrow and let you know how it performs.

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: 7-Segment displays sometimes lagging badly

#7 Post by Tetrachromat »

First: I could not import the exported siff files (panel and instruments) from 4.0 to 4.1 BETA. I had to copy the instruments manually from the folder structure of Air Player to the folder structure of Air Manager BETA (OPEN_DIRECTORY of instruments and panels). I assumed that this does not influence the outcome of the testing.

RESULTS:
The 4.1 BETA 2 is behaving much better. I wouldn't say "sometimes lagging badly" anymore, just "lagging occasionally".

Before the lag was up to several (6,7 .. 8) seconds and it occured after short periods of inactivity. Now the lag is around 2 to 3 seconds and it takes more time of inactivity to occure. It also occures mostly on the altitude reference value, not that much on the heading or course values.

If it is lagging and I turn another encoder, both values display immediately.

I must note that the 3 hw_char_display_set_text() functions are called only when a variable callback message is received. It is not timer triggered.

Side Note:
I had to change the formatting string for the first display (has only 6 digits, 3 for COURSE and 3 for SPEED) from "%03.0f%3.0f" to " %03.0f%3.0f" (adding 2 leading blanks) to get a display of "000" + " 0". Without the change it produced a display of "0 " + "0 ".

I will keep Air Manager BETA for a while on the cockpit machine. When I reset back, I will let you know for restoring the reset limit.

Paul

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: 7-Segment displays sometimes lagging badly

#8 Post by Corjan »

Hi,


Good to hear that it is at least improving.

I would say that in theory it wouldn't have to lag at all.
There should be systems in play in AM that throttle the data being sent to the Arduino. So from a lua perspective you can send as much data as you want.

If you have time this week for debugging the game controller, we might be able to figure out what it going on here.


Could you send me your instrument in advance for this issue?

Corjan

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: 7-Segment displays sometimes lagging badly

#9 Post by Tetrachromat »

I have no access to the sim currently. Will be back home on Wednesday evening earliest.

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: 7-Segment displays sometimes lagging badly

#10 Post by Tetrachromat »

As you have suggested, I did some more testing with extensive logging.

The following events are logged now:
- all callbacks for the 6 subscribed variable values displayed (course1, speed, heading, altitude, verrtical speed, course2)
- the 3 'display' functions used for updating the text string used in hw_chr_display_set_text function
- the pressing of the altitude encoder switch

I used to press the encoder switch to "confirm" that the display has actually changed.

The proedure was, turning an encoder and pressing the altitude encoder when the display changed. If the display did not change I just keept turning the encoder. When turning fast I was not able to confirm each single change, but it should be obvious from the timestamps logged when lag occured.

As you can see from the attached log file, it did log some cases where i could turn the encoder for several seconds without the display changing. Relevant cases were at
- 21:47:28 with continously setting the altitude, display has changed at 21:47:34 (6 seconds lag).
- 21:53:22 with continously setting the course 1, display has changed at 21:53:28 (6 seconds lag).
- 22:24:18 with continously setting the heading, display has changed at 22:24:22 (4 seconds lag).

The new values were received immediately after turning the encoder and the 'hw_chr_display_set_text' function was called with updated values.
log_display.txt
(130.19 KiB) Downloaded 161 times
Attached is also the corresponding code used (relevant parts only).
logic.lua
(2.88 KiB) Downloaded 161 times
What I observed this time is that the lag is not necessarily dependent on a long interval of inactivity (no encoder actions), but it may occure also when switching from one encoder to another. Like turning course encoder without lag, then turning altitude encoder with a lag.

Paul

Post Reply