question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flashing Pixels; Performance Issue?

See original GitHub issue

I think I may be seeing a performance issue. I’m using legacy.text() and draw.point() to light text (the time) plus a few pixels on 4 cascaded matrix displays. When doing this in a simple test script it works great. However, when moving this into my larger script I’m seeing flashing of the pixels I’m lighting individually (legacy.text is solid). Code is below. I can upload a video of the behavior I’m seeing if you’d like.

Thanks for your work here! Other than this flashing issue I’ve had a really easy time getting up a running. Great examples and documentation.

Type of Raspberry Pi

RPi3

Linux Kernel version

Linux piclock 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux

Expected behaviour

Pixels change to desired state and do not flash in transition or while lit.

Actual behaviour

Seeing pixels flashing either while in transition or while lit.

Here’s the code that works in this test script, but causes flashing behavior in my larger script:

#!/usr/bin/env python

from luma.core import legacy
from luma.led_matrix.device import max7219
from luma.core.serial import spi, noop
from luma.core.render import canvas

import datetime, time



# create matrix device
serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4, block_orientation="vertical")

show_dots = True
counter = 1

while True:
    clock_display = (datetime.datetime.now().strftime('%I:%M'))

    if show_dots == True:
        with canvas(device) as draw:
            legacy.text(draw, (0, 0), clock_display, fill="white", font=legacy.font.proportional(legacy.font.SINCLAIR_FONT))
            draw.point([(31, 7), (30, 7), (31, 6)], fill="white")
    elif show_dots == False:
        with canvas(device) as draw:
            legacy.text(draw, (0, 0), clock_display, fill="white", font=legacy.font.proportional(legacy.font.SINCLAIR_FONT))

    time.sleep(.5)
    counter += 1

    if counter == 8:
        show_dots = not show_dots
        counter = 1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
spencerhookscommented, Feb 26, 2017

Just wanted to follow up in case it can help someone in the future:

Using ps -ef | grep python showed me that there were in fact two copies of my script running.

My problem came from the fact that I am using Flask and was running in debug mode. Flask includes reloading functionality such that you can change code and you don’t need to restart your app. It’s handy. Well, it accomplishes this by basically running two instances of your script. This is what was causing the flashing that I saw (two scripts writing to the matrix display that weren’t perfectly in sync).

You can work around this issue in debug mode by adding use_reloader=False to your app.run() call. That fixed it for me. You lose the reloading functionality though. I believe switching out of debug mode should also solve it.

Anyway, problem solved. Thanks again @rm-hull

More info can be found here

0reactions
thijstriemstracommented, Feb 27, 2017

Personally, I would use asyncio over threads every time to avoid strange concurrency issues like this

@rm-hull we should move away from time.sleep stuff…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random Flickering Pixels - Tom's Hardware Forum
I overclocked it and set the idle speeds to roughly twice what they were, and the high performance mode to 3 times what...
Read more >
flickering pixels :/ : r/AMDHelp - Reddit
When I've done audio visual work, I've had sparkles in my image, it was usually a bad HDMI cable. Not saying that's your...
Read more >
Five tips to fix a screen flicker - TechRepublic
1. Check your cables · 2. Check the monitor refresh rate · 3. Check the video card · 4. Test the monitor ·...
Read more >
Flickering Red Pixels on Monitor? (Cause + Fix!) - Laptopar
Flickering red pixels on monitor is a phenomenon that occurs when you install and use the LCD monitor. A black screen or gray...
Read more >
Green flashing pixels on the screen. - Microsoft Community
Anyway, I am here because of green flashing pixels on my screen. They are not dead pixels because they move, and they won't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found