brilliantlabsAR/monocle-micropython

display.show() too slow

Closed this issue · 3 comments

josuah commented

It is overly slow for drawing animations, it looked faster in the past.

The animations tested were vertical built out of polygons.

josuah commented

Testing on the nrf52-dk:

Input:

import display, gc, time, micropython

o  = 10; b1 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0xFF0000)
o += 24; b2 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0xFF6600)
o += 24; b3 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0xFFFF00)
o += 24; b4 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0x00FF00)
o += 24; b5 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0x0000FF)
o += 24; b6 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0xFF0066)
o += 24; b7 = display.Polygon([0 + o, 0, 24 + o, 0, 124 + o, 400, 100 + o, 400], 0xFF00AA)

l = [b1,b2,b3,b4,b5]
o = +1
fps = 0
next_ticks_ms = time.ticks_ms() + 1000
while True:
    o *= -1
    display.move(l, o, 0)
    display.show(l)
    fps += 1
    if time.ticks_ms() > next_ticks_ms:
        print(f'{fps} FPS')
        next_ticks_ms += 1000
        fps = 0

Result:

1 FPS
2 FPS
19 FPS
19 FPS
18 FPS
19 FPS
19 FPS
19 FPS
19 FPS
18 FPS
19 FPS
19 FPS
19 FPS
19 FPS
18 FPS
19 FPS
19 FPS
19 FPS
19 FPS
18 FPS
19 FPS
19 FPS
19 FPS
19 FPS
18 FPS
19 FPS
19 FPS
[...]

This includes the SPI transfer time.

What is surprising is the 1 FPS at the beginning.

This does not draw any text.

josuah commented

Also adding the text to this text gives similar results:

2 FPS
19 FPS
18 FPS
19 FPS
18 FPS
19 FPS
18 FPS
19 FPS
18 FPS

Is it to be considered overly slow? It is not cinema-rate, but is fast enough to allow some movement.

https://en.wikipedia.org/wiki/Frame_rate#Animation shows a 12 FPS horse animation.

Fine now. Closing