DSO Shell : High quality waveform display


I tried several methods to redraw the waveforms as fast as possible, while keeping a high quality display. The target is ~ 30 fps, crystal clear.
The underlying method is that we only draw vertical lines, not random lines.
That way we maximize the setAddrWindow/push colors mode of the display controller.

Method 1:

That method is the dumbest: we clear the area to paint and redraw everything needed.

Pros
It is actually very fast, because the amount of data to paint is small compared to the display.
Something like 5 to 10%
Clearing an area with black is fast, just put 0 on the bus and toggle the write pin as much as needed.
The speed is ~ ok (14ms)

Cons
It flickers a lot.
It flickers because we actually draw the screen twice : once in black, once with the waveform.

Method 2: Draw once

To avoid the aforementioned flicker, the idea is to pre-calculate a column and send it.
Pros
It does not flicker at all (we only draw once).

Cons
 it is kind of slow : 32 ms / frame
Why ? Because we redraw every pixels, even the ones that were not changed at all.
The drawing is  in a non put-zero-and-toggle-bits way and so much slower.

Method 3: Draw once, but only what's needed

The last method is a optimization of the previous one :
Keep in memory what was drawn the previous time and just update it with what's needed.

That means repainting over the previous data with "background" color.
Then pain the new data with "foreground" color and memorize it while we are at it.

Pros
The first numbers are good : ~ 16 ms per draw and absolutely no flicker
The trick is we precompute an "empty" column, with the division markers & everything, and use that as a background filler. That way the column is completely redrawn at no cost, with one move
Cons
A bit complicated

Comments

Popular posts from this blog

Component tester with STM32 : Part 1 ADC, Resistor

Fixing the INA3221

INA3221, weird wiring